From 6868ff36d128678b751068a9617971617ed8646f Mon Sep 17 00:00:00 2001 From: Timo Paulssen Date: Mon, 27 Jul 2015 01:22:19 +0200 Subject: [PATCH] fix the tests about localref access --- t/moar/02-qast-references.t | 99 +++++++++++++++++++++++++------------ 1 file changed, 68 insertions(+), 31 deletions(-) diff --git a/t/moar/02-qast-references.t b/t/moar/02-qast-references.t index eedae95da2..b63ca51253 100644 --- a/t/moar/02-qast-references.t +++ b/t/moar/02-qast-references.t @@ -106,52 +106,89 @@ is_qast( 'localref of type str with a value assigned to it' ); -#is_qast( - #QAST::CompUnit.new( :hll, - #QAST::Block.new( - #QAST::Var.new( :name, :scope, :decl, :returns(int) ), - #QAST::Var.new( :name, :scope, :decl ), - #QAST::Op.new( :op, - #QAST::Var.new( :name, :scope ), - #QAST::Var.new( :name, :scope ) - #), - #QAST::Op.new( - #:op, - #QAST::Var.new( :name, :scope ), - #QAST::IVal.new( :value(123) ) - #), - #QAST::Op.new( - #:op, - #QAST::Var.new( :name, :scope ), - #QAST::Var.new( :name, :scope ) - #) - #) - #), - #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, QAST::Block.new( QAST::Var.new( :name, :scope, :decl, :returns(str) ), - QAST::Var.new( :name, :scope, :decl, :returns(str) ), + QAST::Var.new( :name, :scope, :decl ), QAST::Op.new( :op, QAST::Var.new( :name, :scope ), QAST::Var.new( :name, :scope ) ), QAST::Op.new( :op, - QAST::Var.new( :name, :scope ), + QAST::Var.new( :name, :scope ), QAST::SVal.new( :value("hooray") ) ), QAST::Op.new( - :op, - QAST::Var.new( :name, :scope ), - QAST::Var.new( :name, :scope ) + :op, + QAST::SVal.new( :value(', ') ), + QAST::Op.new( + :op, + QAST::Var.new( :name, :scope ), + QAST::Var.new( :name, :scope ) + ) ) ) ), - 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, + QAST::Block.new( + QAST::Var.new( :name, :scope, :decl, :returns(int) ), + QAST::Var.new( :name, :scope, :decl ), + QAST::Op.new( :op, + QAST::Var.new( :name, :scope ), + QAST::Var.new( :name, :scope ) + ), + QAST::Op.new( + :op, + QAST::Var.new( :name, :scope ), + QAST::IVal.new( :value(42) ) + ), + QAST::Op.new( + :op, + QAST::SVal.new( :value(', ') ), + QAST::Op.new( + :op, + QAST::Op.new( :op, QAST::Var.new( :name, :scope ) ), + QAST::Op.new( :op, QAST::Var.new( :name, :scope ) ), + ) + ) + ) + ), + "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, + QAST::Block.new( + QAST::Var.new( :name, :scope, :decl, :returns(num) ), + QAST::Var.new( :name, :scope, :decl ), + QAST::Op.new( :op, + QAST::Var.new( :name, :scope ), + QAST::Var.new( :name, :scope ) + ), + QAST::Op.new( + :op, + QAST::Var.new( :name, :scope ), + QAST::NVal.new( :value(99.9) ) + ), + QAST::Op.new( + :op, + QAST::SVal.new( :value(', ') ), + QAST::Op.new( + :op, + QAST::Op.new( :op, QAST::Var.new( :name, :scope ) ), + QAST::Op.new( :op, QAST::Var.new( :name, :scope ) ), + ) + ) + ) + ), + "99.9, 99.9", + "a localref'd var can have a local ref'd thing bound to it and accessed (num)" +);