Skip to content

Commit

Permalink
lexical tests: outer(foo) refers to first precompiled sub 'foo' in co…
Browse files Browse the repository at this point in the history
…mpilation unit

this tests implementation, as the specification is unclear

git-svn-id: https://svn.parrot.org/parrot/trunk@10328 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information
particle committed Dec 3, 2005
1 parent 98b66fe commit a78802e
Showing 1 changed file with 116 additions and 1 deletion.
117 changes: 116 additions & 1 deletion t/op/lexicals.t
Expand Up @@ -469,6 +469,121 @@ main
I messed with your var
OUTPUT
pir_output_is(<<'CODE', <<'OUTPUT', 'get_outer(outer sub name reused) - always uses first sub of same name');
.sub main :main
bar()
.end
.sub foo :anon :outer('main')
.end
.sub foo :anon
.end
.sub foo
.end
.sub bar :outer('foo')
.include 'interpinfo.pasm'
$P1 = interpinfo .INTERPINFO_CURRENT_SUB
$P2 = $P1.'get_outer'()
print $P2
print "\n"
$P3 = $P2.'get_outer'()
print $P3
print "\n"
.end
CODE
foo
main
OUTPUT
pir_output_like(<<'CODE', <<'OUTPUT', 'get_outer(outer sub name reused) - always uses first sub of same name');
.sub main :main
bar()
.end
.sub foo :anon
.end
.sub foo :anon :outer('main')
.end
.sub foo
.end
.sub bar :outer('foo')
.include 'interpinfo.pasm'
$P1 = interpinfo .INTERPINFO_CURRENT_SUB
$P2 = $P1.'get_outer'()
print $P2
print "\n"
$P3 = $P2.'get_outer'()
print $P3
print "\n"
.end
CODE
/foo\nNull PMC access in get_string()/
OUTPUT
pir_output_is(<<'CODE', <<'OUTPUT', 'get_outer(outer sub name reused) - always uses first sub of same name');
.sub main :main
bar()
.end
.sub foo :outer('main')
.end
.sub foo :anon
.end
.sub foo :anon
.end
.sub bar :outer('foo')
.include 'interpinfo.pasm'
$P1 = interpinfo .INTERPINFO_CURRENT_SUB
$P2 = $P1.'get_outer'()
print $P2
print "\n"
$P3 = $P2.'get_outer'()
print $P3
print "\n"
.end
CODE
foo
main
OUTPUT
pir_output_like(<<'CODE', <<'OUTPUT', 'get_outer(outer sub name reused) - always uses first sub of same name');
.sub main :main
bar()
.end
.sub foo
.end
.sub foo :anon :outer('main')
.end
.sub foo :anon
.end
.sub bar :outer('foo')
.include 'interpinfo.pasm'
$P1 = interpinfo .INTERPINFO_CURRENT_SUB
$P2 = $P1.'get_outer'()
print $P2
print "\n"
$P3 = $P2.'get_outer'()
print $P3
print "\n"
.end
CODE
/foo\nNull PMC access in get_string()/
OUTPUT
pir_output_is(<<'CODE', <<'OUTPUT', 'closure 3');
# sub foo {
# my ($n) = @_;
Expand Down Expand Up @@ -876,4 +991,4 @@ OUTPUT
## remember to change the number of tests :-)
BEGIN { plan tests => 36; }
BEGIN { plan tests => 40; }

0 comments on commit a78802e

Please sign in to comment.