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
|
|
|
|
2021-04-09 00:01:27 +02:00
|
|
|
my $expected_plan;
|
2021-04-02 16:06:26 +02:00
|
|
|
|
|
|
|
my $ctx = {
|
|
|
|
'expect' => sub {
|
|
|
|
my ($desc, $success) = @_;
|
|
|
|
print "not " unless $success;
|
|
|
|
print "ok - $desc\n";
|
2021-04-05 00:25:53 +02:00
|
|
|
},
|
|
|
|
comment => sub {
|
|
|
|
my ($v) = @_;
|
|
|
|
print "# " . Minilisp::lisp_format($v) . "\n";
|
|
|
|
},
|
2021-04-09 00:01:27 +02:00
|
|
|
plan => sub {
|
|
|
|
die "Multiple plans" if defined $expected_plan;
|
|
|
|
$expected_plan = shift;
|
|
|
|
}
|
2021-04-02 16:06:26 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
print "TAP Version 13\n";
|
|
|
|
$parsed->($ctx);
|
|
|
|
|
2021-04-09 00:01:27 +02:00
|
|
|
die "No plan" unless defined $expected_plan;
|
|
|
|
|
|
|
|
print "1..$expected_plan\n";
|
2021-04-02 16:06:26 +02:00
|
|
|
|
|
|
|
exit 0;
|