Minilisp.pm/tool/test-runner.pl

36 lines
529 B
Perl
Raw Normal View History

2021-04-02 16:06:26 +02:00
#!/usr/bin/env perl
use strict;
use warnings;
use FindBin;
use lib "$FindBin::Bin/../lib";
use Minilisp;
my $scriptfile = shift;
die "No script file provided." unless defined $scriptfile && -f $scriptfile;
2021-04-04 01:17:18 +02:00
my $parsed = Minilisp::compile_file($scriptfile);
2021-04-02 16:06:26 +02:00
my $plan = 0;
my $ctx = {
'expect' => sub {
my ($desc, $success) = @_;
print "not " unless $success;
print "ok - $desc\n";
$plan++;
}
};
print "TAP Version 13\n";
$parsed->($ctx);
2021-04-02 19:02:00 +02:00
die "No tests" unless $plan > 0;
2021-04-02 16:06:26 +02:00
print "1..$plan\n";
exit 0;