Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add test for argument auto-boxing.
  • Loading branch information
jnthn committed Jan 12, 2013
1 parent 2b621fe commit 2a9abb3
Showing 1 changed file with 43 additions and 1 deletion.
44 changes: 43 additions & 1 deletion t/qast_arguments.t
@@ -1,6 +1,6 @@
use helper;

plan(11);
plan(12);

qast_test(
-> {
Expand Down Expand Up @@ -423,3 +423,45 @@ qast_test(
},
"42\n4.2\nByriani\n",
"Flattening named arguments within other args");

qast_test(
-> {
my $block := QAST::Block.new(
QAST::Stmts.new(
QAST::Op.new(
:op('bind'),
QAST::Var.new( :name('&boxer'), :scope('lexical'), :decl('var') ),
QAST::Block.new(
QAST::Op.new(
:op('say'),
QAST::Op.new(
:op('unbox_i'),
QAST::Var.new( :name('a'), :scope('local'), :decl('param') )
)),
QAST::Op.new(
:op('say'),
QAST::Op.new(
:op('unbox_n'),
QAST::Var.new( :name('b'), :scope('local'), :decl('param') )
)),
QAST::Op.new(
:op('say'),
QAST::Op.new(
:op('unbox_s'),
QAST::Var.new( :name('c'), :scope('local'), :decl('param') )
)))),
QAST::Op.new(
:op('call'), :name('&boxer'),
QAST::IVal.new( :value(101) ),
QAST::NVal.new( :value(2.7) ),
QAST::SVal.new( :value('Pathia') )
)));
QAST::CompUnit.new(
$block,
:main(QAST::Op.new(
:op('call'),
QAST::BVal.new( :value($block) )
)))
},
"101\n2.7\nPathia\n",
"Auto-boxing of arguments");

0 comments on commit 2a9abb3

Please sign in to comment.