Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Test QAST::VarWithFallback.
  • Loading branch information
jnthn committed Jan 24, 2013
1 parent 37b31a7 commit f27702d
Showing 1 changed file with 42 additions and 1 deletion.
43 changes: 42 additions & 1 deletion t/qast_variable.t
@@ -1,6 +1,6 @@
use helper;

plan(8);
plan(9);

qast_test(
-> {
Expand Down Expand Up @@ -271,3 +271,44 @@ qast_test(
},
"Bear + Deer = Beer\n",
"Forward-declaration calls");

qast_test(
-> {
my $block := QAST::Block.new(
QAST::Stmts.new(
QAST::Op.new(
:op('bind'),
QAST::Var.new( :name('a'), :scope('local'), :decl('var') ),
QAST::SVal.new( :value('Zmrzlina') )
),
QAST::Op.new(
:op('bind'),
QAST::Var.new( :name('b'), :scope('local'), :decl('var') ),
QAST::Op.new( :op('null') )
),
QAST::Op.new(
:op('say'),
QAST::Op.new(
:op('unbox_s'),
QAST::VarWithFallback.new(
:name('a'), :scope('local'),
:fallback(QAST::SVal.new( :value('Chcem pivo') ))
))),
QAST::Op.new(
:op('say'),
QAST::Op.new(
:op('unbox_s'),
QAST::VarWithFallback.new(
:name('b'), :scope('local'),
:fallback(QAST::SVal.new( :value('Chcem pivo') ))
)))
));
QAST::CompUnit.new(
$block,
:main(QAST::Op.new(
:op('call'),
QAST::BVal.new( :value($block) )
)))
},
"Zmrzlina\nChcem pivo\n",
"QAST::VarWithFallback works");

0 comments on commit f27702d

Please sign in to comment.