DASM
test-dump-fail/Tests.pm
Go to the documentation of this file.
00001 #!/usr/bin/perl -w
00002 ##
00003 # Test rules for the test-dump directory: negative tests.
00004 #
00005 # These routines provide regression tests to ensure that the dump load
00006 # routines generate the same results in repeated runs.
00007 #
00008 # We read .dump files and re-dump them. We expect this to fail, and record
00009 # the results appropriately.
00010 #
00011 # We assemble .dasm files and try to dump it. We expect this to fail, and
00012 # record the results appropriately.
00013 #
00014 
00015 
00016 ##
00017 # Load a .dump file, which should fail; comparing to the expectation.
00018 addTest('name' => 'Load failures',
00019         'input'    => '.dump$',
00020         'expect'   => '.fail.output',
00021         'generate' => sub {
00022                 my ($directory, $input) = @_;
00023 
00024                 my $cmd = "./dasm.pl -o .dump -i $directory/$input";
00025                 my ($rc, $output) = capture_output($cmd);
00026 
00027                 return ($rc, $output, $cmd);
00028             },
00029 
00030         'compare' => \&comparefail,
00031        );
00032 
00033 ##
00034 # Assemble a .dasm file, which should fail; comparing to the expectation.
00035 addTest('name' => 'Save failures',
00036         'input'    => '.dasm$',
00037         'expect'   => '.fail.output',
00038         'generate' => sub {
00039                 my ($directory, $input) = @_;
00040 
00041                 my $cmd = "./dasm.pl -o .dump -i $directory/$input";
00042                 my ($rc, $output) = capture_output($cmd);
00043 
00044                 return ($rc, $output, $cmd);
00045             },
00046 
00047         'compare' => \&comparefail,
00048        );
00049 
00050 1;