relaxng.tests.driver.xhtml5core Maven / Gradle / Ivy
The newest version!
#!/usr/bin/perl
# Configuration ########################################################
$schema = '../xhtml5core.rnc';
@testdirs = ('html5core/valid',
'html5core/invalid');
$testFilenamePattern = '\.xhtml$';
$driverID = $0;
if ($driverID =~ /^.*driver\.([^\/]+)$/) { $driverID = $1 };
# Note: This program will create and/or modify the files BASELINE.$driverID
# and VERIFY.$driverID in the current directory.
########################################################################
if ('verify' eq $ARGV[0]) {
$outfile = "VERIFY.$driverID";
}
elsif ('baseline' eq $ARGV[0]) {
$outfile = "BASELINE.$driverID";
}
else {
print "Usage: $0 [baseline|verify]\nA successful run will print nothing.\n\nNote: This program requires rnv to be installed.\n";
exit;
}
open OUTFILE, ">$outfile" or die "Could not open output file $outfile:$!";
foreach $dir (@testdirs) {
opendir DIR, "$dir" or die "Could not open test directory $dir: $!";
@testfiles = grep { /$testFilenamePattern/ } readdir(DIR);
close DIR;
foreach $test (sort @testfiles) {
print OUTFILE "*** Test $dir/$test ***\n";
print OUTFILE `rnv -q $schema $dir/$test 2>&1`;
}
}
close OUTFILE;
if ('verify' eq $ARGV[0]) {
print `diff -u BASELINE.$driverID VERIFY.$driverID`;
}