1#!/usr/bin/perl 2 3use Test::Inter; 4$o = new Test::Inter; 5 6print "The following tests test some improperly formed tests\n\n"; 7 8sub func1 { 9 my($a,$b) = @_; 10 11 if ($a eq 'a' && $b eq 'b') { return 1; } 12 elsif ($a eq 'c' && $b eq 'd') { return 2; } 13 elsif ($a eq 'e' && $b eq 'f') { return 3; } 14} 15 16print "The 2nd one fails with 'expected results for some, not others\n\n"; 17$o->tests(func => \&func1, 18 tests => "a b => 1 19 20 c d 21 22 e f => 3"); 23 24print "\n\nFails with '=>' found twice\n\n"; 25$o->tests(func => \&func1, 26 tests => "a b => 1 => 1"); 27 28print "\n\nFails with odd number of elements in hash\n\n"; 29$o->tests(func => \&func1, 30 tests => "{ a b c } => 1"); 31 32print "\n\nFails with improper quoting\n\n"; 33$o->tests(func => \&func1, 34 tests => "a 'b => 1"); 35 36print "\n\nFails with unable to parse\n\n"; 37$o->tests(func => \&func1, 38 tests => "(a b c"); 39 40print "\n\nFails with unexpected token\n\n"; 41$o->tests(func => \&func1, 42 tests => "(a b c)(d e) => 1"); 43