Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Segregate Parrot-specific tests.
  • Loading branch information
jnthn committed Apr 14, 2013
1 parent 4c7ee83 commit 9f25f51
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 56 deletions.
File renamed without changes.
File renamed without changes.
67 changes: 67 additions & 0 deletions t/parrot/02-qast.t
@@ -0,0 +1,67 @@
use QAST;

plan(5);

# Following a test infrastructure.
sub compile_qast($qast) {
my $*QAST_BLOCK_NO_CLOSE := 1;
nqp::getcomp('nqp').compile($qast, :from('ast'));
}
sub is_qast($qast, $value, $desc) {
try {
my $code := compile_qast($qast);
ok($code() eq $value, $desc);
CATCH { ok(0, $desc) }
}
}

is_qast(
QAST::Block.new(
QAST::VM.new(
parrot => QAST::IVal.new( :value(42) ),
unknown => QAST::IVal.new( :value(69) )
)
),
42,
'QAST::VM picks parrot alternative and ignores others');

is_qast(
QAST::Block.new(
QAST::VM.new(
pir => ".return ('Leffe')",
),
QAST::SVal.new( :value('Fosters') )
),
'Leffe',
'QAST::VM with pir works');

is_qast(
QAST::Block.new(
QAST::VM.new(
pir => "%r = box 'set'",
)
),
'set',
'QAST::VM with pir and %r works');

is_qast(
QAST::Block.new(
QAST::VM.new(
pirop => 'add__Iii',
QAST::IVal.new( :value(15) ),
QAST::IVal.new( :value(10) )
)
),
25,
'QAST::VM with pirop and signature after __');

is_qast(
QAST::Block.new(
QAST::VM.new(
pirop => 'add Iii',
QAST::IVal.new( :value(15) ),
QAST::IVal.new( :value(100) )
)
),
115,
'QAST::VM with pirop and signature after a space');
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
53 changes: 1 addition & 52 deletions t/qast/qast.t → t/qast/01-qast.t
@@ -1,6 +1,6 @@
use QAST;

plan(73);
plan(68);

# Following a test infrastructure.
sub compile_qast($qast) {
Expand Down Expand Up @@ -919,57 +919,6 @@ test_qast_result(
ok(SCTest.main, 'mainline OK');
});

is_qast(
QAST::Block.new(
QAST::VM.new(
parrot => QAST::IVal.new( :value(42) ),
unknown => QAST::IVal.new( :value(69) )
)
),
42,
'QAST::VM picks parrot alternative and ignores others');

is_qast(
QAST::Block.new(
QAST::VM.new(
pir => ".return ('Leffe')",
),
QAST::SVal.new( :value('Fosters') )
),
'Leffe',
'QAST::VM with pir works');

is_qast(
QAST::Block.new(
QAST::VM.new(
pir => "%r = box 'set'",
)
),
'set',
'QAST::VM with pir and %r works');

is_qast(
QAST::Block.new(
QAST::VM.new(
pirop => 'add__Iii',
QAST::IVal.new( :value(15) ),
QAST::IVal.new( :value(10) )
)
),
25,
'QAST::VM with pirop and signature after __');

is_qast(
QAST::Block.new(
QAST::VM.new(
pirop => 'add Iii',
QAST::IVal.new( :value(15) ),
QAST::IVal.new( :value(100) )
)
),
115,
'QAST::VM with pirop and signature after a space');

is_qast(
QAST::Block.new(
QAST::Stmts.new(
Expand Down
8 changes: 4 additions & 4 deletions tools/build/Makefile.in
Expand Up @@ -1095,16 +1095,16 @@ bootstrap-files: $(STAGE2_PBCS) src/stage2/$(CORE_SETTING_NQP)
## testing

test: all
prove -r --exec ./$(NQP_EXE) t/nqp t/hll t/qregex t/p5regex t/qast t/serialization
prove -r --exec ./$(NQP_EXE) t/nqp t/parrot t/hll t/qregex t/p5regex t/qast t/serialization

test-loud: all
prove -r -v --exec ./$(NQP_EXE) t/nqp t/hll t/qregex t/p5regex t/qast t/serialization
prove -r -v --exec ./$(NQP_EXE) t/nqp t/parrot t/hll t/qregex t/p5regex t/qast t/serialization

core-test: $(NQP_EXE)
prove -r --exec ./$(NQP_EXE) t/nqp
prove -r --exec ./$(NQP_EXE) t/nqp t/parrot

core-test-loud: $(NQP_EXE)
prove -r -v --exec ./$(NQP_EXE) t/nqp
prove -r -v --exec ./$(NQP_EXE) t/nqp t/parrot

qregex-test: $(NQP_EXE)
prove -r --exec ./$(NQP_EXE) t/qregex
Expand Down

0 comments on commit 9f25f51

Please sign in to comment.