cap2site/t/script.pl

24 lines
497 B
Perl
Raw Normal View History

2023-03-18 00:35:37 +00:00
#!/usr/bin/env perl
use v5.10;
use strict;
use warnings;
sub test($$$) {
my ($cmd,$file,$expected) = @_;
my $res = readpipe($cmd . " < t/" . $file);
2023-03-21 19:28:49 +00:00
my $exp = do {
local $/ = undef;
open my $fh, "<", "t/" . $expected
or die "error opening file: $!";
<$fh>
};
2023-03-18 00:35:37 +00:00
2023-03-21 19:28:49 +00:00
$res eq $exp or die "FAIL: $cmd\nEXPECTED:\n$exp\nACTUAL:\n$res";
}
2023-03-20 20:31:15 +00:00
2023-03-21 19:28:49 +00:00
test("./cap2site.pod", "hello.gmi", "hello_exp.html");
test("./cap2site.pod -s", "hello.gmi", "hello_standalone_exp.html");
2023-03-20 20:31:15 +00:00
2023-03-18 00:35:37 +00:00
say "DONE!";