Skip to content

Commit

Permalink
A couple of tests for lexical lookup/binding in an inner block.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed May 12, 2012
1 parent 68f99e6 commit b505a99
Showing 1 changed file with 42 additions and 1 deletion.
43 changes: 42 additions & 1 deletion t/qast/qast.t
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use QRegex;

plan(35);
plan(37);

# Following a test infrastructure.
sub compile_qast($qast) {
Expand Down Expand Up @@ -418,3 +418,44 @@ is_qast(
),
302,
'callmethod with two args, name is computed');

is_qast(
QAST::Block.new(
QAST::Op.new(
:op('bind'),
QAST::Var.new( :name('$x'), :scope('lexical'), :decl('var') ),
QAST::WVal.new( :value(B) )
),
QAST::Block.new(
:blocktype('immediate'),
QAST::Op.new(
:op('callmethod'), :name('m'),
QAST::Var.new( :name('$x'), :scope('lexical') )
)
)
),
'b',
'lexical lookup in a nested block');

is_qast(
QAST::Block.new(
QAST::Op.new(
:op('bind'),
QAST::Var.new( :name('$x'), :scope('lexical'), :decl('var') ),
QAST::WVal.new( :value(B) )
),
QAST::Block.new(
:blocktype('immediate'),
QAST::Op.new(
:op('bind'),
QAST::Var.new( :name('$x'), :scope('lexical') ),
QAST::WVal.new( :value(A) )
)
),
QAST::Op.new(
:op('callmethod'), :name('m'),
QAST::Var.new( :name('$x'), :scope('lexical') )
)
),
'a',
'lexical binding in a nested block');

0 comments on commit b505a99

Please sign in to comment.