File tree 3 files changed +18
-18
lines changed
3 files changed +18
-18
lines changed Original file line number Diff line number Diff line change 30
30
ScratchPad . recorded . should == :thrown_key
31
31
end
32
32
33
- it "raises an ArgumentError if a Symbol is thrown for a String catch value" do
34
- lambda { catch ( "exit" ) { throw :exit } } . should raise_error ( ArgumentError )
33
+ it "raises an UncaughtThrowError if a Symbol is thrown for a String catch value" do
34
+ lambda { catch ( "exit" ) { throw :exit } } . should raise_error ( UncaughtThrowError )
35
35
end
36
36
37
- it "raises an ArgumentError if a String with different identity is thrown" do
38
- lambda { catch ( "exit" ) { throw "exit" } } . should raise_error ( ArgumentError )
37
+ it "raises an UncaughtThrowError if a String with different identity is thrown" do
38
+ lambda { catch ( "exit" ) { throw "exit" } } . should raise_error ( UncaughtThrowError )
39
39
end
40
40
41
41
it "catches a Symbol when thrown a matching Symbol" do
Original file line number Diff line number Diff line change 44
44
end
45
45
46
46
it "does not convert strings to a symbol" do
47
- lambda { catch ( :exit ) { throw "exit" } } . should raise_error ( ArgumentError )
47
+ lambda { catch ( :exit ) { throw "exit" } } . should raise_error ( UncaughtThrowError )
48
48
end
49
49
50
50
it "unwinds stack from within a method" do
@@ -62,18 +62,18 @@ def throw_method(handler,val)
62
62
catch ( :foo ) { c . call } . should == :msg
63
63
end
64
64
65
- it "raises an ArgumentError if outside of scope of a matching catch" do
66
- lambda { throw :test , 5 } . should raise_error ( ArgumentError )
67
- lambda { catch ( :different ) { throw :test , 5 } } . should raise_error ( ArgumentError )
65
+ it "raises an UncaughtThrowError if outside of scope of a matching catch" do
66
+ lambda { throw :test , 5 } . should raise_error ( UncaughtThrowError )
67
+ lambda { catch ( :different ) { throw :test , 5 } } . should raise_error ( UncaughtThrowError )
68
68
end
69
69
70
- it "raises an ArgumentError if used to exit a thread" do
70
+ it "raises an UncaughtThrowError if used to exit a thread" do
71
71
lambda {
72
72
catch ( :what ) do
73
73
Thread . new do
74
74
throw :what
75
75
end . join
76
76
end
77
- } . should raise_error ( ArgumentError )
77
+ } . should raise_error ( UncaughtThrowError )
78
78
end
79
79
end
Original file line number Diff line number Diff line change 87
87
ScratchPad . recorded . should == [ :before_throw ]
88
88
end
89
89
90
- it "raises an ArgumentError if there is no catch block for the symbol" do
91
- lambda { @s . rb_throw ( nil ) } . should raise_error ( ArgumentError )
90
+ it "raises an UncaughtThrowError if there is no catch block for the symbol" do
91
+ lambda { @s . rb_throw ( nil ) } . should raise_error ( UncaughtThrowError )
92
92
end
93
93
end
94
94
113
113
ScratchPad . recorded . should == [ :before_throw ]
114
114
end
115
115
116
- it "raises an ArgumentError if there is no catch block for the symbol" do
117
- lambda { @s . rb_throw ( nil ) } . should raise_error ( ArgumentError )
116
+ it "raises an UncaughtThrowError if there is no catch block for the symbol" do
117
+ lambda { @s . rb_throw ( nil ) } . should raise_error ( UncaughtThrowError )
118
118
end
119
119
end
120
120
296
296
ScratchPad . recorded . should == [ :before_throw ]
297
297
end
298
298
299
- it "raises an ArgumentError if the throw symbol isn't caught" do
300
- lambda { @s . rb_catch ( "foo" , lambda { throw :bar } ) } . should raise_error ( ArgumentError )
299
+ it "raises an UncaughtThrowError if the throw symbol isn't caught" do
300
+ lambda { @s . rb_catch ( "foo" , lambda { throw :bar } ) } . should raise_error ( UncaughtThrowError )
301
301
end
302
302
end
303
303
322
322
ScratchPad . recorded . should == [ :before_throw ]
323
323
end
324
324
325
- it "raises an ArgumentError if the throw symbol isn't caught" do
326
- lambda { @s . rb_catch ( "foo" , lambda { throw :bar } ) } . should raise_error ( ArgumentError )
325
+ it "raises an UncaughtThrowError if the throw symbol isn't caught" do
326
+ lambda { @s . rb_catch ( "foo" , lambda { throw :bar } ) } . should raise_error ( UncaughtThrowError )
327
327
end
328
328
end
329
329
You can’t perform that action at this time.
0 commit comments