add build_requires for Test::Deep
[TAP-Harness-JUnit.git] / t / outputs_with_time.t
blob78f2e0b962bc20279bb6b247a86996b74c20beaa
1 #!/usr/bin/perl
3 use TAP::Harness::JUnit;
4 use Test::More;
5 use XML::Simple;
6 use Test::Deep;
7 use File::Temp;
8 use File::Basename;
9 use Encode;
11 my %tests = (
12 resultcode => 'Successful test with good plan and a bad return code',
13 badplan => 'Has a plan, successful tests, just too small amount of them',
14 funkyindent => 'Indentation of comments',
15 uniquename => 'Multiple tests with identical names',
16 nonutf8log => 'Special characters in log',
17 earlyterm => 'Bad plan and non-zero return value',
20 plan tests => int (keys %tests);
22 foreach my $test (keys %tests) {
23 my $model = dirname($0)."/tests/$test.xml";
24 my $outfile = File::Temp->new (UNLINK => 0)->filename;
26 $harness = new TAP::Harness::JUnit ({
27 xmlfile => $outfile,
28 verbosity => -1,
29 merge => 1,
30 exec => ['cat'],
31 });
33 $harness->runtests ([dirname($0)."/tests/$test.txt" => $tests{$test}]);
35 my $expected = XMLin ($model);
36 $expected->{testsuite}{'time'} = re('^\d+\.\d+');
38 cmp_deeply(XMLin ($outfile), $expected, "Output of $test matches model");
40 unlink $outfile;