Text-MacroScript
view release on metacpan or search on metacpan
t/expand_file.t view on Meta::CPAN
use strict;
use warnings;
use Capture::Tiny 'capture';
use Path::Tiny;
use Test::More;
use_ok 'Text::MacroScript';
push @INC, path($0)->dirname;
require_ok 'mytests.pl';
sub void(&) { $_[0]->(); () }
my $ms;
my $fh;
my($out,$err,@res);
my $file = "test~";
#------------------------------------------------------------------------------
# create object
$ms = new_ok('Text::MacroScript');
use Test::More;
use Path::Tiny;
my $ms;
my($out,$err,@res);
use_ok 'Text::MacroScript';
push @INC, path($0)->dirname;
require_ok 'mytests.pl';
sub void(&) { $_[0]->(); () }
#------------------------------------------------------------------------------
# define
$ms = new_ok('Text::MacroScript' => [
-macro => [
[ "hello" => "Hallo" ],
[ "world" => "Welt" ],
]]);
$ms->define(-macro => "N1" => "25");
$ms->define_macro("N2", 26);
t/new_embedded.t view on Meta::CPAN
use Test::More;
use Path::Tiny;
my $ms;
my($out,$err,@res);
my $test1 = "test1~";
use_ok 'Text::MacroScript';
push @INC, path($0)->dirname;
require_ok 'mytests.pl';
sub void(&) { $_[0]->(); () }
# variable expansion
$ms = new_ok('Text::MacroScript', [-embedded => 1]);
is $ms->expand("abc<:%DEFINE_VARIABLE*HELLO*[1+]:>def"), "abcdef";
is $ms->expand("<:#*HELLO*:>"), "1+";
is $ms->expand("<:#*HELL:><:O*:>"), "#*HELLO*";
# multiple line value and counting of []
$ms = new_ok('Text::MacroScript', [-embedded => 1]);
is $ms->expand("a<:%DEFINE_VARIABLE X [:>b"), "ab";
t/new_expand_file.t view on Meta::CPAN
use strict;
use warnings;
use Capture::Tiny 'capture';
use Test::More;
use Path::Tiny;
use_ok 'Text::MacroScript';
push @INC, path($0)->dirname;
require_ok 'mytests.pl';
sub void(&) { $_[0]->(); () }
my $ms;
my($out,$err,@res);
my $test1 = "test1~";
my $test2 = "test2~";
# open file failed
$ms = new_ok('Text::MacroScript');
unlink $test1;
eval { $ms->expand_file; };
t/new_list_macro.t view on Meta::CPAN
use Test::Differences;
use Test::More;
use Path::Tiny;
my $ms;
my($out,$err,@res);
use_ok 'Text::MacroScript';
push @INC, path($0)->dirname;
require_ok 'mytests.pl';
sub void(&) { $_[0]->(); () }
# syntax errors
$ms = new_ok('Text::MacroScript');
eval {$ms->list()};
check_error(__LINE__-1, $@, " method not supported __LOC__.\n");
# list...
$ms = new_ok('Text::MacroScript' => [
-variable => [
[ V1 => 1 ],
t/new_list_script.t view on Meta::CPAN
use Test::Differences;
use Test::More;
use Path::Tiny;
my $ms;
my($out,$err,@res);
use_ok 'Text::MacroScript';
push @INC, path($0)->dirname;
require_ok 'mytests.pl';
sub void(&) { $_[0]->(); () }
# syntax errors
$ms = new_ok('Text::MacroScript');
eval {$ms->list()};
check_error(__LINE__-1, $@, " method not supported __LOC__.\n");
# list...
$ms = new_ok('Text::MacroScript' => [
-variable => [
[ V1 => 1 ],
t/new_list_variable.t view on Meta::CPAN
use Test::Differences;
use Test::More;
use Path::Tiny;
my $ms;
my($out,$err,@res);
use_ok 'Text::MacroScript';
push @INC, path($0)->dirname;
require_ok 'mytests.pl';
sub void(&) { $_[0]->(); () }
# syntax errors
$ms = new_ok('Text::MacroScript');
eval {$ms->list()};
check_error(__LINE__-1, $@, " method not supported __LOC__.\n");
# list...
$ms = new_ok('Text::MacroScript' => [
-variable => [
[ V1 => 1 ],
t/new_require.t view on Meta::CPAN
my $ms;
my $test1 = "test1~";
my $test2 = "test2~";
my $test3 = "test3~";
use_ok 'Text::MacroScript';
push @INC, "t", ".";
require_ok 'mytests.pl';
sub void(&) { $_[0]->(); () }
# OK
t_spew($test1, norm_nl(<<'END'));
sub add {
my($a, $b) = @_;
return $a+$b;
}
1;
END
t/scripts.t view on Meta::CPAN
use Test::More;
use Path::Tiny;
my $ms;
my($out,$err,@res);
use_ok 'Text::MacroScript';
push @INC, path($0)->dirname;
require_ok 'mytests.pl';
sub void(&) { $_[0]->(); () }
#------------------------------------------------------------------------------
# define
$ms = new_ok('Text::MacroScript' => [
-variable => [
[ N1 => 1 ],
[ N2 => 2 ],
],
-script => [
[ ADD => '#0+#1' ],
t/variables.t view on Meta::CPAN
use Test::More;
use Path::Tiny;
use_ok 'Text::MacroScript';
push @INC, path($0)->dirname;
require_ok 'mytests.pl';
my $ms;
my($out,$err,@res);
sub void(&) { $_[0]->(); () }
#------------------------------------------------------------------------------
# script to SHOW variables
my @show;
for (1..5) {
push @show, "\"N$_=\".(defined(\$Var{N$_}) ? \"\$Var{N$_}=\$Var{N$_}\" : '')";
}
my $show = join(".', '.", @show).".'.'";
#------------------------------------------------------------------------------
( run in 0.455 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )