[前][次][番号順一覧][スレッド一覧]

ruby-changes:21936

From: akr <ko1@a...>
Date: Thu, 8 Dec 2011 22:50:20 +0900 (JST)
Subject: [ruby-changes:21936] akr:r33985 (trunk): update doc and add test for SystemExit.new.

akr	2011-12-08 22:50:10 +0900 (Thu, 08 Dec 2011)

  New Revision: 33985

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=33985

  Log:
    update doc and add test for SystemExit.new.

  Modified files:
    trunk/error.c
    trunk/test/ruby/test_exception.rb

Index: error.c
===================================================================
--- error.c	(revision 33984)
+++ error.c	(revision 33985)
@@ -743,9 +743,13 @@
 
 /*
  * 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
Index: test/ruby/test_exception.rb
===================================================================
--- test/ruby/test_exception.rb	(revision 33984)
+++ test/ruby/test_exception.rb	(revision 33985)
@@ -334,4 +334,19 @@
     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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]