Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 371 lines (305 sloc) 16.415 kb
3d3f9a24 »
2011-12-17 initial tests for typed exceptions; very unstructured for now
1 use v6;
2 use Test;
8380ccfc »
2012-06-05 move throws_like to Test::Util
3 BEGIN { @*INC.push('t/spec/packages/') };
4 use Test::Util;
3d3f9a24 »
2011-12-17 initial tests for typed exceptions; very unstructured for now
5
2002a2fe »
2012-01-30 more typed exceptions
6 #?DOES 1
88dbaa76 »
2012-05-27 X::Buf::Pack
7 throws_like { Buf.new().Str }, X::Buf::AsStr, method => 'Str';;
8 throws_like 'pack("B", 1)', X::Buf::Pack, directive => 'B';
9 throws_like 'Buf.new.unpack("B")', X::Buf::Pack, directive => 'B';
7a26e136 »
2012-06-03 test X::Buf::Pack::NonASCII
10 throws_like 'pack "A1", "mÄ"', X::Buf::Pack::NonASCII, char => 'Ä';
67636640 »
2012-02-11 fix test for X::Attribute::Undeclared
11 throws_like 'my class Foo { method a() { $!bar } }', X::Attribute::Undeclared,
12f1b318 »
2012-08-19 basic tests for sigilless params
12 symbol => '$!bar', package-name => 'Foo', package-kind => 'class',
13 what => 'attribute';
3d3f9a24 »
2011-12-17 initial tests for typed exceptions; very unstructured for now
14 throws_like 'sub f() { $^x }', X::Signature::Placeholder,
bff406d5 »
2012-08-24 update some exception tests
15 line => 1,
16 placeholder => '$^x',
17 ;
3d3f9a24 »
2011-12-17 initial tests for typed exceptions; very unstructured for now
18
4c68d1a5 »
2011-12-18 skipped tests for X::Obsolete
19 #?rakudo skip 'parsing of $& and other p5 variables'
9fb1b22e »
2012-03-27 test for qr obsoletion message
20 throws_like '$&', X::Obsolete, old => '$@ variable', replacement => '$, rx/<<rx>>// or $()';
21 throws_like 'qr/a/', X::Obsolete, old => rx/<<qr>>/, replacement => rx/<<rx>>/;
ba74f5ec »
2012-12-13 test X::Obsolete
22 throws_like '"a" . "b"', X::Obsolete, replacement => '~';
e225c9d8 »
2012-12-29 test X::Obsolete error for s///i
23 throws_like 's/a/b/i', X::Obsolete;
b34a3de0 »
2013-01-12 RT #112470, my ${a}
24 # RT #112470
25 throws_like 'my ${a} = 5', X::Obsolete;
4c68d1a5 »
2011-12-18 skipped tests for X::Obsolete
26
f52c2ed5 »
2012-01-23 test presence of placeholder attribute of X::Placeholder::Block excep…
27 throws_like 'do { $^x }', X::Placeholder::Block, placeholder => '$^x';
28 throws_like 'do { @_ }', X::Placeholder::Block, placeholder => '@_';
29 throws_like 'class { $^x }', X::Placeholder::Block, placeholder => '$^x';
47eec67f »
2012-11-25 RT #76956, linked ticket (placeholder in mainline)
30 # RT #76956
8d41f565 »
2012-01-24 more typed exception tests, better diagnosis
31 throws_like '$^x', X::Placeholder::Mainline, placeholder => '$^x';
d5ac5a66 »
2012-02-03 RT #73502, @_ in the mainline
32 # RT #73502
33 throws_like '@_', X::Placeholder::Mainline, placeholder => '@_';
bea87e2b »
2012-03-04 RT #85942
34 # RT #85942
35 throws_like '"foo".{ say $^a }', X::Placeholder::Mainline;
36
37
12f1b318 »
2012-08-19 basic tests for sigilless params
38 throws_like 'sub f(*@ = 2) { }', X::Parameter::Default, how => 'slurpy', parameter => *.not;
39 throws_like 'sub f($x! = 3) { }', X::Parameter::Default, how => 'required', parameter => '$x';
8d41f565 »
2012-01-24 more typed exception tests, better diagnosis
40 throws_like 'sub f(:$x! = 3) { }', X::Parameter::Default, how => 'required';
41 throws_like 'sub f($:x) { }', X::Parameter::Placeholder,
42 parameter => '$:x',
43 right => ':$x';
44 throws_like 'sub f($?x) { }', X::Parameter::Twigil,
45 parameter => '$?x',
46 twigil => '?';
a97dc2a5 »
2012-01-26 track change of error class names; add some more redeclaration tests
47 throws_like 'sub (Int Str $x) { }', X::Parameter::MultipleTypeConstraints;
8d41f565 »
2012-01-24 more typed exception tests, better diagnosis
48
49
50
a97dc2a5 »
2012-01-26 track change of error class names; add some more redeclaration tests
51 # some of these redeclaration errors take different code
52 # paths in rakudo, so we over-test a bit to catch them all,
53 # even if the tests look rather boring;
0b7d7d24 »
2012-01-23 more typed exception tests
54 throws_like 'sub a { }; sub a { }',X::Redeclaration, symbol => 'a', what => 'routine';
dddf1116 »
2012-05-29 RT #78370, my &a; sub a { } redeclaration error
55 # RT #78370
cf0e3428 »
2012-05-29 oops, meant to test something else
56 #?rakudo skip 'RT 78370'
57 throws_like 'my &a; multi a { }', X::Redeclaration, symbol => 'a', what => 'routine';
63626c2d »
2012-02-08 another redeclaration test
58 throws_like 'sub a { }; multi sub a { }',X::Redeclaration, symbol => 'a', what => 'routine';
a97dc2a5 »
2012-01-26 track change of error class names; add some more redeclaration tests
59 throws_like 'my class A { }; my class A { }', X::Redeclaration, symbol => 'A';
c9e36113 »
2012-04-14 more robust name clash tests
60 throws_like 'my class B { }; my subset B of Any;', X::Redeclaration, symbol => 'B';
a97dc2a5 »
2012-01-26 track change of error class names; add some more redeclaration tests
61 throws_like 'CATCH { }; CATCH { }', X::Phaser::Multiple, block => 'CATCH';
75c081fd »
2012-07-31 tests for multiple return type exceptions
62 # multiple return types
63 throws_like 'sub f(--> List) returns Str { }', X::Redeclaration;
64 throws_like 'my Int sub f(--> Str) { }', X::Redeclaration;
b73c13bd »
2012-10-20 RT #115356, redeclaration of class as a role
65 # RT #115356
66 throws_like 'class F { }; role F { }', X::Redeclaration, symbol => 'F';
fbb78ed5 »
2012-01-23 test for X::Placeholder::Block
67
6467df25 »
2012-02-23 test X::Attribute::Package and X::Attribute::NoPackage
68 throws_like 'my class A { my @a; @a!List::foo() }',
c01e5d67 »
2012-01-24 tests for typed private method call exceptions
69 X::Method::Private::Permission,
70 method => 'foo',
71 calling-package => 'A',
72 source-package => 'List';
73
74 throws_like '1!foo()',
a97dc2a5 »
2012-01-26 track change of error class names; add some more redeclaration tests
75 X::Method::Private::Unqualified,
c01e5d67 »
2012-01-24 tests for typed private method call exceptions
76 method => 'foo';
77
d9262efc »
2012-06-03 [throws_ok] allow subtypes; Liskov applies
78 throws_like 'sub f() { }; f() := 2', X::Bind;
79 throws_like 'OUTER := 5', X::Bind, target => /OUTER/;
bff406d5 »
2012-08-24 update some exception tests
80 throws_like 'my int $x := 2', X::Bind::NativeType, name => '$x';
c6df8c59 »
2012-05-27 update and expand tests for binding to unbindable stuff
81 throws_like 'my @a; @a[] := <foo bar baz>', X::Bind::ZenSlice, type => Array;
82 throws_like 'my %a; %a{} := foo=>1, bar=>2, baz=>3', X::Bind::ZenSlice, type => Hash;
83 throws_like 'my @a; @a[0, 1] := (2, 3)', X::Bind::Slice, type => Array;
84 throws_like 'my %a; %a<a b> := (2, 3)', X::Bind::Slice, type => Hash;
709242e4 »
2012-03-29 tests for X::Bind::ZenSlice.
85
a8246984 »
2012-01-25 typed binding excpetions
86
dc765ebb »
2012-01-25 tests for typed exceptions
87 throws_like 'for (1; 1; 1) { }', X::Obsolete,
88 old => rx/<<for>>/,
89 replacement => rx/<<loop>>/;
90 throws_like 'foreach (1..10) { }', X::Obsolete,
91 old => "'foreach'",
92 replacement => "'for'";
93 throws_like 'undef', X::Obsolete,
94 old => rx/<<undef>>/;
49868a52 »
2012-11-25 RT #77118, test for obsolete use of diamond operator
95 # RT #77118
96 {
97 throws_like ':a<>', X::Obsolete, old => "<>";
98 }
0d9fc5dd »
2013-01-04 RT #92408: detect obsolete use of . as concatenation operator
99 # RT #92408
100 throws_like 'my ($a, $b); $a . $b', X::Obsolete;
dc765ebb »
2012-01-25 tests for typed exceptions
101
a97dc2a5 »
2012-01-26 track change of error class names; add some more redeclaration tests
102 throws_like 'my $a::::b', X::Syntax::Name::Null;
d1f0fd85 »
2012-01-28 tests for typed syntax errors
103 throws_like 'unless 1 { } else { }', X::Syntax::UnlessElse;
104 throws_like 'for my $x (1, 2, 3) { }', X::Syntax::P5;
425b7869 »
2012-08-02 test for extra information in X::Syntax::NegatedPair
105 throws_like ':!foo(3)', X::Syntax::NegatedPair, key => 'foo';
d1f0fd85 »
2012-01-28 tests for typed syntax errors
106 throws_like 'my $0', X::Syntax::Variable::Numeric;
b2914792 »
2012-02-24 test parameter variant of X::Syntax::Variable::Numeric
107 throws_like 'my sub f($0) { }', X::Syntax::Variable::Numeric, what => 'parameter';
d1f0fd85 »
2012-01-28 tests for typed syntax errors
108 throws_like 'my $<a>', X::Syntax::Variable::Match;
33e961e4 »
2012-01-30 RT #69230, my $!foo
109 throws_like 'my class A { my $!foo }', X::Syntax::Variable::Twigil, twigil => '!', scope => 'my';
d9f7caae »
2012-05-03 RT #112724, line numbers from warnings
110 throws_like 'my $?FILE', X::Syntax::Variable::Twigil, twigil => '?', scope => 'my';
277e13dd »
2012-01-28 more tests for typed syntax errors
111 throws_like 'my $::("foo")', X::Syntax::Variable::IndirectDeclaration;
171ad0a8 »
2012-02-07 test X::Undeclared
112 throws_like '@a', X::Undeclared, symbol => '@a';
8b533dd7 »
2013-01-04 RT #115396, undeclared variables in interpolating strings
113 # RT #115396
114 throws_like '"@a[]"', X::Undeclared, symbol => '@a';
277e13dd »
2012-01-28 more tests for typed syntax errors
115 throws_like 'augment class Any { }', X::Syntax::Augment::WithoutMonkeyTyping;
116 throws_like 'use MONKEY_TYPING; augment role Positional { }', X::Syntax::Augment::Role;
fd201d9a »
2012-04-05 RT #82984
117 throws_like 'sub postbla:sym<foo>() { }', X::Syntax::Extension::Category, category => 'postbla';
ab9c613e »
2012-05-29 RT #83992, proper error message for infix in term position
118 # RT #83992
119 throws_like 'my @a = 1, => 2', X::Syntax::InfixInTermPosition, infix => '=>';
840bfdaa »
2012-05-13 test for X::Signature::NameClash
120 throws_like 'sub f(:in(:$in)) { }', X::Signature::NameClash, name => 'in';
a52f2b34 »
2012-12-16 A few minor tweaks for stdier.
121 throws_like '(my $foo) does Int', X::Does::TypeObject;
122 throws_like '(my $foo) does Int, Bool', X::Does::TypeObject;
e87efa19 »
2012-11-25 RT #76742, added test for 'does with type object'
123 # RT #76742
124 throws_like 'Bool does role { method Str() { $.perl } };', X::Does::TypeObject;
2267094d »
2012-10-11 Fix some package/eval related issues.
125 throws_like 'my role R { }; 99 but R("wrong");', X::Role::Initialization;
126 throws_like 'my role R { has $.x; has $.y }; 99 but R("wrong");', X::Role::Initialization;
127 throws_like 'my role R { }; 99 does R("wrong");', X::Role::Initialization;
128 throws_like 'my role R { has $.x; has $.y }; 99 does R("wrong");', X::Role::Initialization;
277e13dd »
2012-01-28 more tests for typed syntax errors
129
130 throws_like 'sub f($a?, $b) { }', X::Parameter::WrongOrder,
131 misplaced => 'required',
132 after => 'optional';
133 throws_like 'sub f(*@a, $b) { }', X::Parameter::WrongOrder,
134 misplaced => 'required',
135 after => 'variadic';
136 throws_like 'sub f(*@a, $b?) { }', X::Parameter::WrongOrder,
137 misplaced => 'optional positional',
138 after => 'variadic';
03faea74 »
2012-01-26 X::Syntax::Name::NotNull
139
2002a2fe »
2012-01-30 more typed exceptions
140 #?rakudo skip 'parsing regression'
141 throws_like '#`', X::Syntax::Comment::Embedded;
1af5f7a9 »
2012-03-02 RT #71814, =begin without identifier
142 # RT #71814
143 throws_like "=begin\n", X::Syntax::Pod::BeginWithoutIdentifier, line => 1, filename => rx/eval/;
2002a2fe »
2012-01-30 more typed exceptions
144
145 throws_like '@', X::Syntax::SigilWithoutName;
146 throws_like '1∞', X::Syntax::Confused;
e4dee679 »
2012-02-23 X::Syntax::Missing
147 throws_like 'for 1, 2', X::Syntax::Missing, what => 'block';
a78af8ce »
2012-02-24 X::Syntax::Reserved
148 throws_like 'my @a()', X::Syntax::Reserved, reserved => /shape/ & /array/;
149 throws_like 'my &a()', X::Syntax::Reserved, instead => /':()'/;
2002a2fe »
2012-01-30 more typed exceptions
150
98bd3469 »
2012-11-28 test for "\u" X::Backslash::UnrecognizedSequence
151 # RT #115922
152 throws_like '"\u"', X::Backslash::UnrecognizedSequence, sequence => 'u';
8d88d570 »
2012-11-28 test for "$" X::Backslash::NonVariableDollar
153 throws_like '"$"', X::Backslash::NonVariableDollar;
154
59f3f35d »
2012-02-08 test exception type for stuff that must be known at compile time
155 throws_like 'm:i(@*ARGS[0])/foo/', X::Value::Dynamic;
156
5c0802db »
2012-02-11 more exception tests
157 throws_like 'self', X::Syntax::Self::WithoutObject;
478ed38d »
2012-02-11 more tests for availabilty-of-self related errors
158 throws_like 'class { has $.x = $.y }', X::Syntax::VirtualCall, call => '$.y';
159 throws_like '$.a', X::Syntax::NoSelf, variable => '$.a';
b3c20067 »
2012-08-07 RT #59118
160 # RT #59118
161 throws_like 'my class B0Rk { $.a }', X::Syntax::NoSelf, variable => '$.a';
5c0802db »
2012-02-11 more exception tests
162
6467df25 »
2012-02-23 test X::Attribute::Package and X::Attribute::NoPackage
163 throws_like 'has $.x', X::Attribute::NoPackage;
12f1b318 »
2012-08-19 basic tests for sigilless params
164 throws_like 'my module A { has $.x }', X::Attribute::Package, package-kind => 'module';
6467df25 »
2012-02-23 test X::Attribute::Package and X::Attribute::NoPackage
165
46f9b17d »
2012-03-08 track exception name change, and add another test
166 throws_like 'has sub a() { }', X::Declaration::Scope, scope => 'has', declaration => 'sub';
167 throws_like 'has package a { }', X::Declaration::Scope, scope => 'has', declaration => 'package';
eb6edd64 »
2012-03-15 test X::Declaration::Scope::Multi
168 throws_like 'our multi a() { }', X::Declaration::Scope::Multi, scope => 'our';
a2b6fc20 »
2012-02-23 more typed exceptions
169 throws_like 'multi sub () { }', X::Anon::Multi, multiness => 'multi';
170 throws_like 'proto sub () { }', X::Anon::Multi, multiness => 'proto';
3b9a6049 »
2012-02-23 more typed exceptions
171 throws_like 'class { multi method () { }}', X::Anon::Multi, routine-type => 'method';
12f1b318 »
2012-08-19 basic tests for sigilless params
172 throws_like 'use MONKEY_TYPING; augment class { }', X::Anon::Augment, package-kind => 'class';
3804629e »
2012-02-23 test X::Augment::NoSuchType
173 throws_like 'use MONKEY_TYPING; augment class NoSuchClass { }', X::Augment::NoSuchType,
12f1b318 »
2012-08-19 basic tests for sigilless params
174 package-kind => 'class',
3804629e »
2012-02-23 test X::Augment::NoSuchType
175 package => 'NoSuchClass';
c9e36113 »
2012-04-14 more robust name clash tests
176 throws_like 'use MONKEY_TYPING; augment class No::Such::Class { }', X::Augment::NoSuchType,
177 package => 'No::Such::Class';
3b9a6049 »
2012-02-23 more typed exceptions
178
179 throws_like ':45<abcd>', X::Syntax::Number::RadixOutOfRange, radix => 45;
3dab5c0c »
2012-03-30 RT #112056
180 throws_like ':0<0>', X::Syntax::Number::RadixOutOfRange, message => rx/0/;
dc3de2d6 »
2012-02-24 X::Syntax::Regex::Adverb
181 throws_like 'rx:g/a/', X::Syntax::Regex::Adverb, adverb => 'g', construct => 'rx';
26f68343 »
2012-02-26 X::Syntax::Signature::InvocantMarker
182 throws_like 'my sub f($x, $y:) { }', X::Syntax::Signature::InvocantMarker;
a2b6fc20 »
2012-02-23 more typed exceptions
183
1bf4f1dc »
2012-02-26 X::OutOfRange
184 throws_like 'Date.new("2012-02-30")', X::OutOfRange,
185 range => Range, message => rx/<<1\.\.29>>/;
c04814dc »
2012-06-03 test leap second exception
186 throws_like 'DateTime.new(year => 2012, month => 5, day => 22, hour => 18, minute => 3, second => 60)',
187 X::OutOfRange, comment => /'leap second'/;
58512ac3 »
2012-04-04 test index out of range exception
188 throws_like 'use fatal; "foo"[2]', X::OutOfRange, what => rx:i/index/, range => 0..0, got => 2;
1bf4f1dc »
2012-02-26 X::OutOfRange
189
52f6db64 »
2012-02-27 test for X::Routine::Unwrap
190 throws_like 'sub f() { }; &f.unwrap("foo")', X::Routine::Unwrap;
2018e14b »
2013-01-25 X::Constructor::Positional's attribute is the type object
191
192 # X::Constructor::Positional
193 {
194 class Foo { };
195 throws_like 'Mu.new(1)', X::Constructor::Positional, type => Mu;
196 throws_like 'Foo.new(1, 2, 3);', X::Constructor::Positional, type => Foo;
197 }
198
39b3eb78 »
2012-02-28 add test for X::Hash::Store::Oddnumber
199 throws_like 'my %h = 1', X::Hash::Store::OddNumber;
52f6db64 »
2012-02-27 test for X::Routine::Unwrap
200
fcd16681 »
2012-03-02 Test for proper error of "sub foo;", RT #68710 and RT #111492
201 # TOOD: might be X::Syntax::Malformed too...
202 throws_like 'sub foo;', X::Syntax::Missing, what => 'block';
db2d40c6 »
2012-08-07 RT #75776, correct syntax error for missing block
203 # RT #75776
204 throws_like 'my $d; my class A {method x { $d }}; for () { sub }', X::Syntax::Missing, what => 'block';
157d7b7c »
2012-03-03 more tests for "constant" parse errors
205 throws_like 'constant foo;', X::Syntax::Missing, what => /initializer/;
206 throws_like 'constant * = 3;', X::Syntax::Missing, what => /constant/;
ee147523 »
2012-12-30 test X::Syntax::NonAssociative
207 throws_like '1 <=> 2 <=> 3', X::Syntax::NonAssociative, left => '<=>', right => '<=>';
fcd16681 »
2012-03-02 Test for proper error of "sub foo;", RT #68710 and RT #111492
208
ddc21bfd »
2012-03-08 test X::Package::Stubbed
209 throws_like 'class A {...}; grammar B { ... }', X::Package::Stubbed, packages => <A B>;
210
98312337 »
2012-03-18 track phaser error changes in rakudo
211 throws_like 'my sub a { PRE 0 }; a()', X::Phaser::PrePost, phaser => 'PRE', condition => /0/;
212 throws_like 'my sub a { POST 0 }; a()', X::Phaser::PrePost, phaser => 'POST', condition => /0/;
efa96102 »
2012-03-18 typed exceptions for PRE/POST failures
213
d720afa0 »
2012-03-25 test that Str numification error message survives through infix:<+>
214 throws_like 'use fatal; my $x = "5 foo" + 8;', X::Str::Numeric, source => '5 foo', pos => 1,
215 reason => /trailing/;
7bac3cad »
2012-07-08 Update a .match failure test.
216 throws_like '"a".match(:x([1, 2, 3]), /a/).Str', X::Str::Match::x, got => Array;
7d371b61 »
2012-06-03 test X::Str::Trans::IllegalKey, sorear++
217 throws_like '"a".trans([Any.new] => [Any.new])', X::Str::Trans::IllegalKey, key => Any;
7b9ba336 »
2012-06-03 test X::Str::Trans::InvalidArg
218 throws_like '"a".trans(rx/a/)', X::Str::Trans::InvalidArg, got => Regex;
d720afa0 »
2012-03-25 test that Str numification error message survives through infix:<+>
219
d701cfa9 »
2012-05-27 text X::Method::NotFound on normal and .+ dispatches
220 throws_like '1.foo', X::Method::NotFound, method => 'foo', typename => 'Int';
221 throws_like '1.+foo', X::Method::NotFound, method => 'foo', typename => 'Int';
16238cd7 »
2012-05-27 test private method not found error
222 throws_like 'my class Priv { method x { self!foo } }; Priv.x',
223 X::Method::NotFound,
224 method => '!foo',
225 typename => 'Priv',
226 private => { $_ === True };
b428149c »
2013-01-03 RT #77582, error message when method is not found on a Hash
227 # RT #77582
228 throws_like 'my %h; %h.nosuchmethods', X::Method::NotFound, typename => 'Hash';
229
eff5942a »
2012-05-27 more typed exception tests (X::ControlFlow, X::Method::InvalidQualifier)
230 throws_like '1.List::join', X::Method::InvalidQualifier,
231 method => 'join',
232 invocant => 1,
233 qualifier-type => List;
d701cfa9 »
2012-05-27 text X::Method::NotFound on normal and .+ dispatches
234
903dffc1 »
2012-03-30 test that stubby exception generators can take an argument
235 # RT #58558
236 throws_like '!!! 42', X::AdHoc, payload => 42;
237 throws_like 'use fatal; ... 42', X::AdHoc, payload => 42;
238 {
239 my $c = 0;
240 try {
241 ??? 42;
242 CONTROL { default { $c++ } }
243 }
244 is $c, 1, '??? with argument warns';
245 }
246
ca3a210c »
2012-03-31 $!.backtrace generates a Backtrace
247 throws_like 'die "foo"', X::AdHoc, backtrace => Backtrace;
2365690f »
2012-04-05 RT #98678, error message for failed sequence deduction
248 throws_like 'use fatal; ~(1, 2, 6 ... 10)', X::Sequence::Deduction;
903dffc1 »
2012-03-30 test that stubby exception generators can take an argument
249
2267094d »
2012-10-11 Fix some package/eval related issues.
250 throws_like 'my class B does Int { }', X::Composition::NotComposable, target-name => 'B', composer => Int;
cb7e9883 »
2012-05-15 test X::TypeCheck::Binding and X::TypeCheck::Return
251 throws_like 'my Str $x := 3', X::TypeCheck::Binding, got => Int, expected => Str;
252 throws_like 'sub f() returns Str { 5 }; f', X::TypeCheck::Return, got => Int, expected => Str;
6625f6f8 »
2012-06-06 test X::TypeCheck::Assignment
253 throws_like 'my Int $x = "foo"', X::TypeCheck::Assignment, got => 'foo',
254 expected => Int, symbol => '$x';
cb7e9883 »
2012-05-15 test X::TypeCheck::Binding and X::TypeCheck::Return
255
61b24d9e »
2012-06-06 test X::Assignment::RO, and add tests for RT #113534
256 throws_like 'sub f() { }; f() = 3', X::Assignment::RO;
257 throws_like '1.0 = 3', X::Assignment::RO;
258 # RT #113534
259 throws_like '120 = 3', X::Assignment::RO;
260 throws_like '1e0 = 3', X::Assignment::RO;
261 throws_like '"a" = 3', X::Assignment::RO;
262
b585e672 »
2012-05-17 test for method not found exception
263 throws_like '1.foo', X::Method::NotFound, method => 'foo', typename => 'Int';
d4fa5e87 »
2012-08-26 follow exception class rename
264 throws_like 'my class NC { }; NC.new does NC', X::Mixin::NotComposable,
5a8433b1 »
2012-05-27 test X::Mixin::NonComposable
265 :target(*.defined), :rolish(*.^name eq 'NC');
d4fa5e87 »
2012-08-26 follow exception class rename
266 throws_like 'my class NC { }; NC.new but NC', X::Mixin::NotComposable,
5a8433b1 »
2012-05-27 test X::Mixin::NonComposable
267 :target(*.defined), :rolish(*.^name eq 'NC');
268
eff5942a »
2012-05-27 more typed exception tests (X::ControlFlow, X::Method::InvalidQualifier)
269 throws_like 'last', X::ControlFlow,
270 illegal => 'last', enclosing => 'loop construct';
271 throws_like 'next', X::ControlFlow,
272 illegal => 'next', enclosing => 'loop construct';
273 throws_like 'redo', X::ControlFlow,
274 illegal => 'redo', enclosing => 'loop construct';
b585e672 »
2012-05-17 test for method not found exception
275
c1474546 »
2012-05-28 test X::Inheritance::Unsupported
276 throws_like 'my package A { }; my class B is A { }', X::Inheritance::Unsupported;
d701cfa9 »
2012-05-27 text X::Method::NotFound on normal and .+ dispatches
277
5eefbf8f »
2012-05-28 test X::Export::NameClash
278 throws_like 'my module Expo { sub f is export { }; { sub f is export { } } }',
279 X::Export::NameClash, symbol => '&f';
280
385370f4 »
2012-06-12 label and unfudge test for RT #113408, and remove nearly identical se…
281 # RT #113408
78d560a7 »
2012-05-28 test for X::HyperOp::NonDWIM
282 throws_like '<a b> »+« <c>', X::HyperOp::NonDWIM,
283 left-elems => 2, right-elems => 1,
284 operator => { .name eq 'infix:<+>' };
285
e708a8cb »
2012-05-29 test X::ControlFlow::Return
286 throws_like 'my sub f() { gather { return } }; ~f()', X::ControlFlow::Return;
287
a1248dbe »
2012-06-03 test X::Temporal::InvalidFormat
288 throws_like 'DateTime.new("2012/04")', X::Temporal::InvalidFormat,
289 invalid-str => '2012/04',
290 target => 'DateTime';
291
292 throws_like 'Date.new("2012/04")', X::Temporal::InvalidFormat,
293 invalid-str => '2012/04',
294 target => 'Date';
295
6aa9f568 »
2012-06-03 test X::Eval::NoSuchLang
296 throws_like 'eval("foo", :lang<no-such-language>)',
297 X::Eval::NoSuchLang,
298 lang => 'no-such-language';
299
7a77b2a8 »
2012-06-04 test X::DateTime::TimezoneClash
300 throws_like 'DateTime.new("1998-12-31T23:59:60+0200", :timezone<Z>)', X::DateTime::TimezoneClash;
7d371b61 »
2012-06-03 test X::Str::Trans::IllegalKey, sorear++
301
85f737a4 »
2012-06-04 test X::Set::Coerce
302 throws_like 'Set(Any.new)', X::Set::Coerce;
303
a47ed9fb »
2012-07-12 test X::Numeric::Real
304 throws_like 'use fatal; (1+2i).Num', X::Numeric::Real, target => Num;
305 throws_like 'use fatal; (1+2i).Real', X::Numeric::Real, target => Real;
306
edf27d46 »
2012-11-15 Added test for #114134
307 #RT #114134
308 {
be541700 »
2012-11-21 fudge test for RT #114134
309 #?rakudo skip 'RT 114134'
a6be9c50 »
2012-11-17 avoid a redeclaration error that shadows the error we actually want t…
310 throws_like 'my class A {}; (-> &c, $m { A.new()(); CATCH { default { $m } } } )(A, "")', X::TypeCheck::Binding;
edf27d46 »
2012-11-15 Added test for #114134
311
312 dies_ok {eval(class A{}; (-> &c, $m { A.new()(); CATCH { default { $m } } } )(A, "")) }, "Should fail type check with unbound variable";
313 }
314
28a82e84 »
2013-01-03 RT #75640
315 # RT #75640
316 # cannot use dies_ok, because it puts the call in the dynamic scope of a
317 # dispatcher
318 try {
319 proto a() { nextsame };
320 a();
321 }
322 ok $! ~~ X::NoDispatcher, 'nextsame in proto';
323
6d4ae896 »
2013-01-04 RT #79162: two terms in a row error message
324 # probably not quite spec, but good enough for now
325 # RT #79162
326 throws_like '["a" "b"]', X::Syntax::Confused, reason => 'Two terms in a row';
327
f71c502b »
2013-01-19 added a few tests for suggestion exceptions
328 # suggestions
329 my $emits_suggestions = False;
330 {
331 try eval('my $foo = 10; say $Foo');
332 $emits_suggestions = True if $!.^can("suggestions");
333 }
334
335 if $emits_suggestions {
336 throws_like 'my $foo = 10; say $Foo;', X::Undeclared, suggestions => '$foo';
337 throws_like 'my @barf = 1, 2, 3; say $barf[2]', X::Undeclared, suggestions => '@barf';
338
339 throws_like 'my $intergalactic-planetary = "planetary intergalactic"; say $IntergalacticPlanetary', X::Undeclared, suggestions => '$intergalactic-planetary';
340
341 throws_like 'class Foo is Junktion {}', X::Inheritance::UnknownParent, suggestions => 'Junction';
342 throws_like 'class Bar is junction {}', X::Inheritance::UnknownParent, suggestions => 'Junction';
343 throws_like 'class Baz is Juntcion {}', X::Inheritance::UnknownParent, suggestions => 'Junction';
344
345 {
346 try eval('say huc("foo")');
347 ok $! ~~ X::Undeclared::Symbols, "huc throws X::Undeclared::Symbols";
348 is $!.routine_suggestion<huc>, ["&uc"], '&uc is a suggestion';
349 }
dce99e09 »
2013-01-19 if no suggestions, then no "did you mean".
350
351 try eval('toolongtomatchanything()');
352 is +($!.routine_suggestion<toolongtomatchanything>), 0, "no suggestions for a strange name";
353 ok $!.message !~~ /Did you mean/, "doesn't show suggestions if there are none.";
354
355 try eval('class TestClassFactoryInterfaceBridgeMock is TooLongOfANameToBeConsideredGoodPerl { }');
356 is +($!.suggestions), 0, "no suggestions for a strange class";
357 ok $!.message !~~ /Did you mean/, "doesn't show suggestions if there are none.";
358
359 try eval('$i-just-made-this-up = "yup"');
360 is +($!.suggestions), 0, "no suggestions for a strange variable";
361 ok $!.message !~~ /Did you mean/, "doesn't suggest if there's no suggestions.";
0acfc00c »
2013-01-20 a test for X::Parameter::InvalidType.
362
363 throws_like 'sub yoink(Junctoin $barf) { }', X::Parameter::InvalidType, suggestions => 'Junction';
73618a57 »
2013-01-25 "my cool $a" -> X::Undeclared + suggestions
364
365 throws_like 'my cool $a', X::Undeclared, suggestions => ["Cool", "Bool"];
f71c502b »
2013-01-19 added a few tests for suggestion exceptions
366 }
367
95a13d77 »
2013-01-19 check for X::Inheritance::SelfInherit.
368 throws_like 'class Foobar is Foobar', X::Inheritance::SelfInherit, name => "Foobar";
369
3d3f9a24 »
2011-12-17 initial tests for typed exceptions; very unstructured for now
370 done;
Something went wrong with that request. Please try again.