# TWikiSuite.t - run the complete TWikiSuite tests under prove
# ----------------------------------------------------------------------
# See http://twiki.org/cgi-bin/view/Codev/TestingTWikiThePerlWay
# ----------------------------------------------------------------------
# Copyright 2017 Harald.Joerg@arcor.de
# License: GPL V3
# ----------------------------------------------------------------------

use Test::More;
note("Running TWiki's TestSuite.  This will take a while...\n");
chdir "test/unit";
open (my $testout, '-|', 'perl ../bin/TestRunner.pl -clean TWikiSuite.pm')
    or die "Failed to fork TestRunner.pl: '$!'";
my $summary;
my %seen;
while (my $result = <$testout>) {
    note $result  if  $result =~ /^Running\s+/; # Report test suites, but not cases
    if (($result =~ /^(\S+?)\s+FAILED\s+-\s+(.*?) at /)
            and (not $seen{"$1: $2"})) {
        $seen{"$1: $2"} = 1;
        fail("$1: $2");
    }
    if ($result =~ /All tests passed \(\d+\)/s) {
        pass($result);
    }
}

done_testing;
