Commit 1c4705c7 authored by Jonas Smedegaard's avatar Jonas Smedegaard

Add testsuite.

parent b116727f
#!perl
use strict;
use warnings;
use Test::More tests => 2;
use Test::Script;
script_compiles 'bin/rdfpuml.pl';
script_runs [ 'bin/rdfpuml.pl', '--help' ], { exit => 1 };
done_testing;
#!perl
use strict;
use warnings;
use Test::More tests => 18;
use Test::Script;
use Test::File::Contents;
use Path::Tiny;
sub inspect {
my $stem = shift;
my $infile = "$stem.ttl";
my $reffile = "$stem.puml";
my $outfile = path($reffile)->exists ? Path::Tiny->tempfile : $reffile;
subtest "Regenerate $reffile" => sub {
plan tests => 2;
script_runs [ 'bin/rdfpuml.pl', '--outfile', "$outfile", $infile ];
if ( "$outfile" ne $reffile ) {
files_eq_or_diff "$outfile", $reffile, 'Contents are the same';
}
else {
fail "Reference data recreated";
}
}
}
# To regenerate reference test data, simply delete the obsolete files.
  • So is the idea to remove the two Makefiles? if so, is it also possible to make the PNG? No human being can grok those PUML files, so we need the PNG for visual inspection.

  • Quoting Vladimir Alexiev (2018-12-07 11:14:32)

    Vladimir Alexiev started a new discussion on t/PUML.t:

    • my $outfile = path($reffile)->exists ? Path::Tiny->tempfile : $reffile;
    • subtest "Regenerate $reffile" => sub {
    • plan tests => 2;
    • script_runs [ 'bin/rdfpuml.pl', '--outfile', "$outfile", $infile ];
    • if ( "$outfile" ne $reffile ) {
    •  files_eq_or_diff "$outfile", $reffile, 'Contents are the same';
    • }
    • else {
    •  fail "Reference data recreated";
    • }
    • } +}

    +# To regenerate reference test data, simply delete the obsolete files.

    So is the idea to remove the two Makefiles? if so, is it also possible to make the PNG? No human being can grok those PUML files, so we need the PNG for visual inspection.

    The idea with the Perl-style testsuite is to do what can be automated.

    This commit implements tests to validate generated puml against a reference copy.

    Validating if PlantUML generates sensible output is more complex and is arguably outside the scope of this project. I an happy to discuss that further but please let's do that separately from this commit which does not remove any of your code, only adds additional code.

    signature.asc

Please register or sign in to reply
inspect 'test/PCDM/PCDM_Multi_Page_Text';
inspect 'test/PCDM/PCDM_Multi_Page_Text-circles';
inspect 'test/TRR/awardWinner';
inspect 'test/TRR/project-participation';
inspect 'test/TRR/result-project';
inspect 'test/exhibitions/exhibition2';
inspect 'test/exhibitions/exhibitions-out';
inspect 'test/exhibitions/exhibitions';
inspect 'test/museum-object/acquisition';
inspect 'test/museum-object/bibref';
inspect 'test/museum-object/cast-after';
inspect 'test/museum-object/dimensions';
inspect 'test/museum-object/objects';
inspect 'test/museum-object/painting-support';
inspect 'test/museum-object/provenance';
inspect 'test/museum-object/title';
TODO: {
local $TODO = 'Fails to generate deterministically';
inspect 'test/exhibitions/exhibitions.r2rml';
inspect 'test/museum-object/objects.r2rml';
}
done_testing;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment