Skip to content

Commit 9f25f51

Browse files
committed
Segregate Parrot-specific tests.
1 parent 4c7ee83 commit 9f25f51

File tree

9 files changed

+72
-56
lines changed

9 files changed

+72
-56
lines changed
File renamed without changes.
File renamed without changes.

t/parrot/02-qast.t

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
use QAST;
2+
3+
plan(5);
4+
5+
# Following a test infrastructure.
6+
sub compile_qast($qast) {
7+
my $*QAST_BLOCK_NO_CLOSE := 1;
8+
nqp::getcomp('nqp').compile($qast, :from('ast'));
9+
}
10+
sub is_qast($qast, $value, $desc) {
11+
try {
12+
my $code := compile_qast($qast);
13+
ok($code() eq $value, $desc);
14+
CATCH { ok(0, $desc) }
15+
}
16+
}
17+
18+
is_qast(
19+
QAST::Block.new(
20+
QAST::VM.new(
21+
parrot => QAST::IVal.new( :value(42) ),
22+
unknown => QAST::IVal.new( :value(69) )
23+
)
24+
),
25+
42,
26+
'QAST::VM picks parrot alternative and ignores others');
27+
28+
is_qast(
29+
QAST::Block.new(
30+
QAST::VM.new(
31+
pir => ".return ('Leffe')",
32+
),
33+
QAST::SVal.new( :value('Fosters') )
34+
),
35+
'Leffe',
36+
'QAST::VM with pir works');
37+
38+
is_qast(
39+
QAST::Block.new(
40+
QAST::VM.new(
41+
pir => "%r = box 'set'",
42+
)
43+
),
44+
'set',
45+
'QAST::VM with pir and %r works');
46+
47+
is_qast(
48+
QAST::Block.new(
49+
QAST::VM.new(
50+
pirop => 'add__Iii',
51+
QAST::IVal.new( :value(15) ),
52+
QAST::IVal.new( :value(10) )
53+
)
54+
),
55+
25,
56+
'QAST::VM with pirop and signature after __');
57+
58+
is_qast(
59+
QAST::Block.new(
60+
QAST::VM.new(
61+
pirop => 'add Iii',
62+
QAST::IVal.new( :value(15) ),
63+
QAST::IVal.new( :value(100) )
64+
)
65+
),
66+
115,
67+
'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.

t/qast/qast.t renamed to t/qast/01-qast.t

Lines changed: 1 addition & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use QAST;
22

3-
plan(73);
3+
plan(68);
44

55
# Following a test infrastructure.
66
sub compile_qast($qast) {
@@ -919,57 +919,6 @@ test_qast_result(
919919
ok(SCTest.main, 'mainline OK');
920920
});
921921

922-
is_qast(
923-
QAST::Block.new(
924-
QAST::VM.new(
925-
parrot => QAST::IVal.new( :value(42) ),
926-
unknown => QAST::IVal.new( :value(69) )
927-
)
928-
),
929-
42,
930-
'QAST::VM picks parrot alternative and ignores others');
931-
932-
is_qast(
933-
QAST::Block.new(
934-
QAST::VM.new(
935-
pir => ".return ('Leffe')",
936-
),
937-
QAST::SVal.new( :value('Fosters') )
938-
),
939-
'Leffe',
940-
'QAST::VM with pir works');
941-
942-
is_qast(
943-
QAST::Block.new(
944-
QAST::VM.new(
945-
pir => "%r = box 'set'",
946-
)
947-
),
948-
'set',
949-
'QAST::VM with pir and %r works');
950-
951-
is_qast(
952-
QAST::Block.new(
953-
QAST::VM.new(
954-
pirop => 'add__Iii',
955-
QAST::IVal.new( :value(15) ),
956-
QAST::IVal.new( :value(10) )
957-
)
958-
),
959-
25,
960-
'QAST::VM with pirop and signature after __');
961-
962-
is_qast(
963-
QAST::Block.new(
964-
QAST::VM.new(
965-
pirop => 'add Iii',
966-
QAST::IVal.new( :value(15) ),
967-
QAST::IVal.new( :value(100) )
968-
)
969-
),
970-
115,
971-
'QAST::VM with pirop and signature after a space');
972-
973922
is_qast(
974923
QAST::Block.new(
975924
QAST::Stmts.new(

tools/build/Makefile.in

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,16 +1095,16 @@ bootstrap-files: $(STAGE2_PBCS) src/stage2/$(CORE_SETTING_NQP)
10951095
## testing
10961096

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

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

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

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

11091109
qregex-test: $(NQP_EXE)
11101110
prove -r --exec ./$(NQP_EXE) t/qregex

0 commit comments

Comments
 (0)