Text-MacroScript
view release on metacpan or search on metacpan
t/macropp.t view on Meta::CPAN
usage: macropp [options] infile(s) > outfile
options: (use the short or long name followed by the parameter where req'd)
-C --comment add the %%[] comment macro
-f --file s macro/script file to read (repeat for multiple files)
-m --macro just list macros [0]
-n --name just list the names of macros/scripts [0]
(if no -m or -s or v are specified this sets them all)
-s --script just list scripts [0]
-v --variable just list variables [0]
-e --emacro operate as embedded perl processor [0]
-o --opendelim s closing delimiter for embedded processor []
-c --closedelim s closing delimiter for embedded processor []
b = boolean 1 = true, 0 = false; i = integer; s = string e.g. filename
See macrodir for a different approach.
END
is $res, 0;
}
#------------------------------------------------------------------------------
# check error reporting
path($test1)->spew(norm_nl(<<END));
include
%DEFINE
END
$test2 = "test2~";
path($test2)->spew(norm_nl(<<END));
%INCLUDE[$test1]xxHello Worldxx
%DEFINE
END
$cmd = "$macropp $test1";
ok 1, " - $cmd";
($out,$err,$res) = capture { system $cmd; };
diag 'Issue #23: macropp: report errors on syntax error';
#is $out, "";
#is $err, "";
#is $res, 0;
$cmd = "$macropp $test2";
ok 1, " - $cmd";
($out,$err,$res) = capture { system $cmd; };
diag 'Issue #23: macropp: report errors on syntax error';
#is $out, "";
#is $err, "";
#is $res, 0;
is unlink($macros, $test1, $test2), 3;
done_testing;
#------------------------------------------------------------------------------
sub t_macro {
my($args, $output) = @_;
my $cmd = "$macropp $args";
ok 1, "line ".(caller)[2]." - $cmd";
my($out,$err,$res) = capture { system $cmd; };
is $out, $output;
is $err, "";
is $res, 0;
}
( run in 0.844 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )