Skip to content

Commit

Permalink
Fix #41: Macro/script arguments do not nest
Browse files Browse the repository at this point in the history
  • Loading branch information
pauloscustodio committed Jul 23, 2015
1 parent d37c93b commit 7308638
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
24 changes: 24 additions & 0 deletions t/fix_041.t
@@ -0,0 +1,24 @@
#!/usr/bin/perl

# Copyright (c) 2015 Paulo Custodio. All Rights Reserved.
# May be used/distributed under the GPL.

use strict;
use warnings;
use Test::More;

my $ms;
use_ok 'Text::MacroScript';

$ms = new_ok('Text::MacroScript' => [
-macro => [
[ ADD1 => '#0+#1' ],
],
-script => [
[ ADD2 => '#0+#1' ],
]]);

is $ms->expand("ADD1[ ADD1[1|2] | ADD1[3|4] ]"), " 1+2 + 3+4 ";
is $ms->expand("ADD2[ ADD2[1|2] | ADD2[3|4] ]"), "10";

done_testing;
3 changes: 1 addition & 2 deletions t/scripts.t
Expand Up @@ -32,8 +32,7 @@ $ms->define(-script => "ADD1" => "#0+1");
$ms->define_script("ADD2", "#0+2");
is $ms->expand('%DEFINE_SCRIPT ADD3[#0+3]'), "";

diag 'Issue #41: Macro/script arguments do not nest';
#is $ms->expand("ADD[ADD1[ADD2[ADD3[4]]] | 10])"), "20";
is $ms->expand("ADD[ADD1[ADD2[ADD3[4]]] | 10]"), "20";

is $ms->expand("ADD[1|2] ADD1[3] ADD2[4] ADD3[5]"), "3 4 6 8";

Expand Down

0 comments on commit 7308638

Please sign in to comment.