Skip to content

Commit

Permalink
fix the tests about localref access
Browse files Browse the repository at this point in the history
  • Loading branch information
timo committed Jul 26, 2015
1 parent 8d75d7e commit 6868ff3
Showing 1 changed file with 68 additions and 31 deletions.
99 changes: 68 additions & 31 deletions t/moar/02-qast-references.t
Expand Up @@ -106,52 +106,89 @@ is_qast(
'localref of type str with a value assigned to it'
);

#is_qast(
#QAST::CompUnit.new( :hll<nqp>,
#QAST::Block.new(
#QAST::Var.new( :name<intloc>, :scope<local>, :decl<var>, :returns(int) ),
#QAST::Var.new( :name<intref>, :scope<localref>, :decl<var> ),
#QAST::Op.new( :op<bind>,
#QAST::Var.new( :name<intref>, :scope<localref> ),
#QAST::Var.new( :name<intloc>, :scope<localref> )
#),
#QAST::Op.new(
#:op<assign_i>,
#QAST::Var.new( :name<intref>, :scope<local> ),
#QAST::IVal.new( :value(123) )
#),
#QAST::Op.new(
#:op<list_i>,
#QAST::Var.new( :name<intloc>, :scope<local> ),
#QAST::Var.new( :name<intref>, :scope<local> )
#)
#)
#),
#nqp::list_i(23, 23),
#"a localref'd var can have a local ref'd thing bound to it and accessed (int)"
#);

is_qast(
QAST::CompUnit.new( :hll<nqp>,
QAST::Block.new(
QAST::Var.new( :name<strloc>, :scope<local>, :decl<var>, :returns(str) ),
QAST::Var.new( :name<strref>, :scope<localref>, :decl<var>, :returns(str) ),
QAST::Var.new( :name<strref>, :scope<localref>, :decl<var> ),
QAST::Op.new( :op<bind>,
QAST::Var.new( :name<strref>, :scope<localref> ),
QAST::Var.new( :name<strloc>, :scope<localref> )
),
QAST::Op.new(
:op<assign_s>,
QAST::Var.new( :name<strref>, :scope<local> ),
QAST::Var.new( :name<strref>, :scope<localref> ),
QAST::SVal.new( :value("hooray") )
),
QAST::Op.new(
:op<list_s>,
QAST::Var.new( :name<strloc>, :scope<local> ),
QAST::Var.new( :name<strref>, :scope<local> )
:op<join>,
QAST::SVal.new( :value(', ') ),
QAST::Op.new(
:op<list_s>,
QAST::Var.new( :name<strloc>, :scope<local> ),
QAST::Var.new( :name<strref>, :scope<local> )
)
)
)
),
nqp::list_s("hooray", "hooray"),
"hooray, hooray",
"a localref'd var can have a local ref'd thing bound to it and accessed (str)"
);

is_qast(
QAST::CompUnit.new( :hll<nqp>,
QAST::Block.new(
QAST::Var.new( :name<intloc>, :scope<local>, :decl<var>, :returns(int) ),
QAST::Var.new( :name<intref>, :scope<localref>, :decl<var> ),
QAST::Op.new( :op<bind>,
QAST::Var.new( :name<intref>, :scope<localref> ),
QAST::Var.new( :name<intloc>, :scope<localref> )
),
QAST::Op.new(
:op<assign_i>,
QAST::Var.new( :name<intref>, :scope<localref> ),
QAST::IVal.new( :value(42) )
),
QAST::Op.new(
:op<join>,
QAST::SVal.new( :value(', ') ),
QAST::Op.new(
:op<list>,
QAST::Op.new( :op<stringify>, QAST::Var.new( :name<intloc>, :scope<local> ) ),
QAST::Op.new( :op<stringify>, QAST::Var.new( :name<intref>, :scope<local> ) ),
)
)
)
),
"42, 42",
"a localref'd var can have a local ref'd thing bound to it and accessed (int)"
);

is_qast(
QAST::CompUnit.new( :hll<nqp>,
QAST::Block.new(
QAST::Var.new( :name<intloc>, :scope<local>, :decl<var>, :returns(num) ),
QAST::Var.new( :name<intref>, :scope<localref>, :decl<var> ),
QAST::Op.new( :op<bind>,
QAST::Var.new( :name<intref>, :scope<localref> ),
QAST::Var.new( :name<intloc>, :scope<localref> )
),
QAST::Op.new(
:op<assign_n>,
QAST::Var.new( :name<intref>, :scope<localref> ),
QAST::NVal.new( :value(99.9) )
),
QAST::Op.new(
:op<join>,
QAST::SVal.new( :value(', ') ),
QAST::Op.new(
:op<list>,
QAST::Op.new( :op<stringify>, QAST::Var.new( :name<intloc>, :scope<local> ) ),
QAST::Op.new( :op<stringify>, QAST::Var.new( :name<intref>, :scope<local> ) ),
)
)
)
),
"99.9, 99.9",
"a localref'd var can have a local ref'd thing bound to it and accessed (num)"
);

0 comments on commit 6868ff3

Please sign in to comment.