Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 95ab59b

Browse files
committedMay 25, 2015
adapted throw specs to use UncaughtThrowError for non catched throw
1 parent 235ee06 commit 95ab59b

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed
 

Diff for: ‎spec/ruby/core/kernel/catch_spec.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@
3030
ScratchPad.recorded.should == :thrown_key
3131
end
3232

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)
3535
end
3636

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)
3939
end
4040

4141
it "catches a Symbol when thrown a matching Symbol" do

Diff for: ‎spec/ruby/language/throw_spec.rb

+6-6
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
end
4545

4646
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)
4848
end
4949

5050
it "unwinds stack from within a method" do
@@ -62,18 +62,18 @@ def throw_method(handler,val)
6262
catch(:foo) { c.call }.should == :msg
6363
end
6464

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)
6868
end
6969

70-
it "raises an ArgumentError if used to exit a thread" do
70+
it "raises an UncaughtThrowError if used to exit a thread" do
7171
lambda {
7272
catch(:what) do
7373
Thread.new do
7474
throw :what
7575
end.join
7676
end
77-
}.should raise_error(ArgumentError)
77+
}.should raise_error(UncaughtThrowError)
7878
end
7979
end

Diff for: ‎spec/ruby/optional/capi/kernel_spec.rb

+8-8
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@
8787
ScratchPad.recorded.should == [:before_throw]
8888
end
8989

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)
9292
end
9393
end
9494

@@ -113,8 +113,8 @@
113113
ScratchPad.recorded.should == [:before_throw]
114114
end
115115

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)
118118
end
119119
end
120120

@@ -296,8 +296,8 @@
296296
ScratchPad.recorded.should == [:before_throw]
297297
end
298298

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)
301301
end
302302
end
303303

@@ -322,8 +322,8 @@
322322
ScratchPad.recorded.should == [:before_throw]
323323
end
324324

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)
327327
end
328328
end
329329

0 commit comments

Comments
 (0)