fix foreach my combination
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 9 Aug 2009 20:10:21 +0000 (20:10 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 9 Aug 2009 20:10:21 +0000 (20:10 +0000)
git-svn-id: svn+ssh://mjesec/home/dpavlin/svn/webpac2/trunk@1265 07558da8-63fa-0310-ba24-9fe276d99e06

lib/WebPAC/Parser.pm
t/2-parse.t
t/conf/normalize/sub.pl

index bdd79ce..5d2e72f 100644 (file)
@@ -337,6 +337,8 @@ sub _parse_source {
                                # repair demage done by prune of whitespace
                                $Element->insert_after( PPI::Token::Whitespace->new(' ') );
                                return '';
+                       } elsif ( $Element->content eq 'my' ) {
+                               $Element->insert_before( PPI::Token::Whitespace->new(' ') );
                        }
 
                        $Element->content eq 'lookup' or return '';
index 23687c1..34a795b 100755 (executable)
@@ -154,5 +154,5 @@ diag "test = ",dump( @test ) if $debug;
 
 ok(! $@, "eval: $@" );
 
-is_deeply( [ @test ], [ "foo", "foo", "bar >>2<<", "bar >>42<<" ], 'sub executed' );
+is_deeply( [ @test ], [ "foo", "foo", "bar >>2<<", "bar >>42<<", 1,2,3 ], 'source fixed' );
 
index c810355..62dec98 100644 (file)
@@ -1,3 +1,5 @@
+# check all repairs in WebPAC::Parser
+
 sub foo {
        push @test, 'foo';
 }
@@ -9,3 +11,11 @@ sub bar($) {
 foo();
 bar(foo());
 bar(42);
+
+sub test($) {
+       push @test, $_[0];
+}
+
+foreach my $a ( 1,2,3 ) {
+       test($a);       
+}