]> begriffs open source - libtap/blob - t/test.t
Test each file with a .expected file instead of within the .t script
[libtap] / t / test.t
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
4 use Test::More;
5
6 my $x = $^O eq 'MSWin32' ? ".exe" : "";
7
8 for my $cfile (glob "t/*.c") {
9     $cfile =~ m{([^/]+)\.c$};
10     my $name = $1;
11     my $output = `t/$name$x 2>&1`;
12     open my $fh, ">", "t/$name.got" or die "Can't open t/$name.got: $!\n";
13     print $fh $output;
14     close $fh;
15     system "diff", "-up", "t/$name.expected", "t/$name.got";
16     ok !($? >> 8), $name;
17 }
18
19 done_testing;