mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
update doc and add test for SystemExit.new.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d9d841e353
commit
63fe8b697c
2 changed files with 21 additions and 2 deletions
8
error.c
8
error.c
|
@ -743,9 +743,13 @@ exc_equal(VALUE exc, VALUE obj)
|
|||
|
||||
/*
|
||||
* call-seq:
|
||||
* SystemExit.new(status=0) -> system_exit
|
||||
* SystemExit.new -> system_exit
|
||||
* SystemExit.new(status) -> system_exit
|
||||
* SystemExit.new(status, msg) -> system_exit
|
||||
* SystemExit.new(msg) -> system_exit
|
||||
*
|
||||
* Create a new +SystemExit+ exception with the given status.
|
||||
* Create a new +SystemExit+ exception with the given status and message.
|
||||
* If status is not given, EXIT_SUCCESS is used.
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
|
|
|
@ -334,4 +334,19 @@ end.join
|
|||
arg_string = (0...140000).to_a.join(", ")
|
||||
assert_raise(SystemStackError, bug5720) {eval "raise(#{arg_string})"}
|
||||
end
|
||||
|
||||
def test_systemexit_new
|
||||
e0 = SystemExit.new
|
||||
assert_equal(0, e0.status)
|
||||
assert_equal("SystemExit", e0.message)
|
||||
ei = SystemExit.new(3)
|
||||
assert_equal(3, ei.status)
|
||||
assert_equal("SystemExit", ei.message)
|
||||
es = SystemExit.new("msg")
|
||||
assert_equal(0, es.status)
|
||||
assert_equal("msg", es.message)
|
||||
eis = SystemExit.new(7, "msg")
|
||||
assert_equal(7, eis.status)
|
||||
assert_equal("msg", eis.message)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue