Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

use Test::Version; use Test::Simple =>10; $file=Simple.pm; version_ok( $file );
It gives error as 1..10 not ok 1 - VERSION test for Test::Simple # Failed test (ver.pl.bak at line 9) # Did not find Test::Simple

20040701 Edit by castaway: Changed title from 'Why doesnt ths code work ??'

Replies are listed 'Best First'.
Re: Test::Simple problem
by Happy-the-monk (Canon) on Jun 28, 2004 at 08:49 UTC

    use Test::Simple =>10;

    Executing your code gives a syntax error:  syntax error at ... line ..., near "use Test::Simple =>"
    A brief look into the Test::Simple manual shows you left out the keyword "tests", so try this:

    use Test::Version;

    use Test::Simple tests =>10;
    $file=Simple.pm;
    version_ok( $file );

    Cheers, Sören

      Out of curiosity I wanted to see what these modules were all about (Never used the test modules before). Looks like this particular code should parse Simple.pm and tell us if "VERSION" was in the code. I copy/pasted the code and the following error appeared running just one test iteration:
      1..1
      not ok 1 - VERSION test for Simplepm
      #     Failed test (./test at line 7)
      # Did not find Simplepm
      # Looks like you failed 1 tests of 1.
      
      I was able to fix it with the following:
      #!/usr/bin/perl + use Test::Version; + use Test::Simple tests => 1; $file="Simple.pm"; version_ok( $file );
      What's interesting here is I didn't receive any message that VERSION was found in Simple.pm.
      1..1
      not ok 1 - VERSION test for Simple.pm
      #     Failed test (./test at line 7)
      # Found no VERSION in Simple.pm
      # Looks like you failed 1 tests of 1.
      
      Am I on the right track or did I miss something? Hoping to understand these two modules a little better :-)