1use blib; 2use strict; 3use vars qw($perl $output $test_file $test_result); 4 5use Test::More tests => 9; 6 7$perl = $^X; 8isnt($perl, '', "perl executable found: [$perl]"); 9 10$output = `$perl -e'print 1;'`; 11ok($output, "perl executable can be run: [$output]"); 12 13my $test_file = 't/basic1.xml'; 14ok(-e $test_file, "test file found: [$test_file]"); 15 16$output = `$perl $test_file`; 17ok($output, "running $test_file produces some output: [".length($output)." bytes]"); 18 19($test_result) = $output =~ m{<h1>(.*?)</h1>}; 20is($test_result, '0123456789', "<perl>print (0..9)</perl> code can be executed: [$test_result]"); 21 22($test_result) = $output =~ m{(<p>.*?</p>)}s; 23is($test_result, "<p>\nplain text\n</p>", "plain text prints ok: [$test_result]"); 24 25($test_result) = $output =~ m{<h2>(.*?)</h2>}; 26is($test_result, 'abcdef', "prints across two <perl> blocks ok: [$test_result]"); 27 28($test_result) = $output =~ m{<h3>(.*?)</h3>}; 29is($test_result, 'defghi', "print from a subroutine in a diferent <perl> block ok: [$test_result]"); 30 31($test_result) = $output =~ m{<h4>(.*?)</h4>}; 32is($test_result, 'bang! bang! bang! ', "print across looped <perl> blocks is ok: [$test_result]"); 33 34print $output; 35__END__