Add tests for exception rescuing in REPL.

This commit is contained in:
WU Jun 2013-03-26 21:23:13 +08:00
parent dada690bbe
commit 3b36a998c5
1 changed files with 16 additions and 0 deletions

View File

@ -12,6 +12,21 @@ describe "The whole thing" do
end
end
it "should rescue exceptions" do
ReplTester.start do
input 'raise "lorum"'
output /^RuntimeError: lorum/
input 'raise java.lang.Exception.new("foo")'
expected = defined?(java.lang.Exception) ? /Exception: foo/ : /^NameError: /
output expected
input 'raise java.io.IOException.new("bar")'
expected = defined?(java.io.IOException) ? /IOException: bar/ : /^NameError: /
output expected
end
end
describe "eval_string and binding_stack" do
it "shouldn't break if we start a nested REPL" do
ReplTester.start do
@ -83,4 +98,5 @@ describe "The whole thing" do
end
end
end
end