Skip to content

Commit 19c27b7

Browse files
committed
Expect Exception, not X::AdHoc.
The test suite we ship for 6.christmas should ideally be a subset of the 6.d suite, and later ones. Testing against `Exception` frees us to add further typed exceptions without breaking the promise in the existing tests. Testing againt `X::AdHoc` does not.
1 parent 6d71025 commit 19c27b7

File tree

60 files changed

+164
-164
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+164
-164
lines changed

S02-types/bag.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ sub showkv($x) {
488488
'Make sure we cannot assign on a key';
489489

490490
throws-like { $_ = 666 for $b.values },
491-
X::AdHoc, # X::Assignment::RO ???
491+
Exception, # X::Assignment::RO ???
492492
'Make sure we cannot assign on a .values alias';
493493

494494
throws-like { .value = 999 for $b.pairs },

S02-types/declare.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ plan 70;
114114

115115
#?rakudo.jvm todo "RT #126526"
116116
{
117-
throws-like { my int $namcu; $namcu = 2**100 }, X::AdHoc,
117+
throws-like { my int $namcu; $namcu = 2**100 }, Exception,
118118
message => 'Cannot unbox 101 bit wide bigint into native integer',
119119
"Assign big bigint to native won't overflow silently";
120120
}

S02-types/mix.t

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ sub showkv($x) {
430430
'Make sure we cannot assign on a key';
431431

432432
throws-like { $_ = 666.1 for $m.values },
433-
X::AdHoc, # X::Assignment::RO ???
433+
Exception, # X::Assignment::RO ???
434434
'Make sure we cannot assign on a .values alias';
435435

436436
throws-like { .value = 999.1 for $m.pairs },
@@ -459,7 +459,7 @@ sub showkv($x) {
459459
my %h3;
460460
for $m.antipairs -> \p { %h3{p.value} = p.key }
461461
is %h3.sort, (a=>1.1, b=>2.2, c=>3.3, d=>4.4), 'did we see all the antipairs';
462-
throws-like { for $m.kxxv -> \k { say k } }, X::AdHoc, 'cannot call kxxv';
462+
throws-like { for $m.kxxv -> \k { say k } }, Exception, 'cannot call kxxv';
463463
}
464464

465465
# vim: ft=perl6

S02-types/mixhash.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ sub showkv($x) {
501501
my %h3;
502502
for $m.antipairs -> \p { %h3{p.value} = p.key }
503503
is %h3.sort, (a=>1.1, b=>2.2, c=>3.3, d=>4.4), 'did we see all the antipairs';
504-
throws-like { for $m.kxxv -> \k { say k } }, X::AdHoc, 'cannot call kxxv';
504+
throws-like { for $m.kxxv -> \k { say k } }, Exception, 'cannot call kxxv';
505505
}
506506

507507
# vim: ft=perl6

S02-types/set.t

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,11 +220,11 @@ sub showset($s) { $s.keys.sort.join(' ') }
220220
is showset(-« set(3, 9, -4)), '-9 -3 4', '-« Set';
221221
is showset(set(<b e g k z>)».pred), 'a d f j y', 'Set».pred';
222222

223-
throws-like { set(1, 2) »+« set(3, 4) }, X::AdHoc,'Set »+« Set is illegal';
224-
throws-like { set(1, 2) »+« [3, 4] }, X::AdHoc, 'Set »+« Array is illegal';
225-
throws-like { set(1, 2) «+» [3, 4] }, X::AdHoc, 'Set «+» Array is illegal';
226-
throws-like { [1, 2] »+« set(3, 4) }, X::AdHoc, 'Set »+« Array is illegal';
227-
throws-like { [1, 2] «+» set(3, 4) }, X::AdHoc, 'Set «+» Array is illegal';
223+
throws-like { set(1, 2) »+« set(3, 4) }, Exception,'Set »+« Set is illegal';
224+
throws-like { set(1, 2) »+« [3, 4] }, Exception, 'Set »+« Array is illegal';
225+
throws-like { set(1, 2) «+» [3, 4] }, Exception, 'Set «+» Array is illegal';
226+
throws-like { [1, 2] »+« set(3, 4) }, Exception, 'Set »+« Array is illegal';
227+
throws-like { [1, 2] «+» set(3, 4) }, Exception, 'Set «+» Array is illegal';
228228
}
229229

230230
#?niecza skip "Hypers not yet Set compatible"

S02-types/subset.t

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ throws-like 'my Even $x = 3', X::TypeCheck::Assignment,
2222

2323
# RT # 69518'
2424
#?niecza todo
25-
throws-like 'Even.new', X::AdHoc, 'Cannot instantiate a subtype';
25+
throws-like 'Even.new', Exception, 'Cannot instantiate a subtype';
2626

2727
{
2828
ok 2 ~~ Even, 'Can smartmatch against subsets 1';
@@ -180,7 +180,7 @@ my $a = 1;
180180
}
181181
my &bar := producer();
182182
lives-ok { bar(2) }, 'where-constraint picks up the right lexical (+)';
183-
throws-like 'bar(1)', X::AdHoc, 'where-constraint picks up the right lexical (-)';
183+
throws-like 'bar(1)', Exception, 'where-constraint picks up the right lexical (-)';
184184
}
185185

186186
{

S02-types/type.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ my Str $bar;
4343
#?niecza skip 'native types (noauto)'
4444
{
4545
eval-lives-ok('my int $alpha = 1', 'Has native type int');
46-
throws-like 'my int $alpha = Nil', X::AdHoc, 'native int type cannot be undefined';
46+
throws-like 'my int $alpha = Nil', Exception, 'native int type cannot be undefined';
4747
lives-ok({my Int $beta = Nil}, 'object Int type can be undefined');
4848
eval-lives-ok('my num $alpha = 1e0', 'Has native type num');
4949
#?rakudo.jvm todo "nigh"

S03-operators/autoincrement.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ is(%z{0}, $base, '%z{0}');
192192
}
193193

194194
# RT #63644
195-
throws-like 'my $a; $a++ ++;', X::AdHoc, 'parse error for "$a++ ++"';
195+
throws-like 'my $a; $a++ ++;', Exception, 'parse error for "$a++ ++"';
196196

197197
# RT #99731
198198
{

S03-operators/misc.t

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ is (2 Z 3), @z, 'joining of single items';
127127

128128
# comparison complains if either of its arguments is undefined - RT #93978
129129
{
130-
throws-like {Int < 0}, X::AdHoc;
130+
throws-like {Int < 0}, Exception;
131131
#?rakudo todo "RT #93978"
132-
throws-like {"cat" gt Str}, X::AdHoc;
132+
throws-like {"cat" gt Str}, Exception;
133133
}
134134

135135

S03-operators/subscript-vs-lt.t

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ plan 4;
1616

1717
eval-lives-ok "1 <2", "infix less-than (<) requires whitespace before.";
1818
eval-lives-ok "1 < 2" , "infix less-than (<) requires whitespace before.";
19-
throws-like "1< 2", X::AdHoc, "infix less-than (<) requires whitespace before, so this is a parse error.";
20-
throws-like "1<2", X::AdHoc, "infix less-than (<) requires whitespace before, so this is a parse error.";
19+
throws-like "1< 2", Exception, "infix less-than (<) requires whitespace before, so this is a parse error.";
20+
throws-like "1<2", Exception, "infix less-than (<) requires whitespace before, so this is a parse error.";
2121

2222
# vim: ft=perl6

0 commit comments

Comments
 (0)