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

ruby-changes:18765

From: nobu <ko1@a...>
Date: Sat, 5 Feb 2011 11:30:31 +0900 (JST)
Subject: [ruby-changes:18765] Ruby:r30792 (trunk): * ext/json/parser/parser.h (GET_PARSER): raise TypeError.

nobu	2011-02-05 11:29:18 +0900 (Sat, 05 Feb 2011)

  New Revision: 30792

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

  Log:
    * ext/json/parser/parser.h (GET_PARSER): raise TypeError.
    * ext/json/parser/parser.rl (cParser_initialize): ditto.

  Modified files:
    trunk/ChangeLog
    trunk/ext/json/parser/parser.c
    trunk/ext/json/parser/parser.h
    trunk/ext/json/parser/parser.rl
    trunk/test/json/test_json.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 30791)
+++ ChangeLog	(revision 30792)
@@ -1,5 +1,9 @@
-Sat Feb  5 10:29:52 2011  Nobuyoshi Nakada  <nobu@r...>
+Sat Feb  5 11:29:10 2011  Nobuyoshi Nakada  <nobu@r...>
 
+	* ext/json/parser/parser.h (GET_PARSER): raise TypeError.
+
+	* ext/json/parser/parser.rl (cParser_initialize): ditto.
+
 	* ext/json/parser/parser.h (GET_PARSER): check if initialized.
 	  [ruby-core:35079]
 
Index: ext/json/parser/parser.h
===================================================================
--- ext/json/parser/parser.h	(revision 30791)
+++ ext/json/parser/parser.h	(revision 30792)
@@ -45,7 +45,7 @@
 
 #define GET_PARSER                          \
     GET_PARSER_INIT;                        \
-    if (!json->Vsource) rb_raise(rb_eArgError, "uninitialized instance")
+    if (!json->Vsource) rb_raise(rb_eTypeError, "uninitialized instance")
 #define GET_PARSER_INIT                     \
     JSON_Parser *json;                      \
     Data_Get_Struct(self, JSON_Parser, json)
Index: ext/json/parser/parser.rl
===================================================================
--- ext/json/parser/parser.rl	(revision 30791)
+++ ext/json/parser/parser.rl	(revision 30792)
@@ -611,7 +611,7 @@
     GET_PARSER_INIT;
 
     if (json->Vsource) {
-        rb_raise(rb_eArgError, "already initialized instance");
+        rb_raise(rb_eTypeError, "already initialized instance");
     }
     rb_scan_args(argc, argv, "11", &source, &opts);
     source = convert_encoding(StringValue(source));
Index: ext/json/parser/parser.c
===================================================================
--- ext/json/parser/parser.c	(revision 30791)
+++ ext/json/parser/parser.c	(revision 30792)
@@ -1613,7 +1613,7 @@
     GET_PARSER_INIT;
 
     if (json->Vsource) {
-        rb_raise(rb_eArgError, "already initialized instance");
+        rb_raise(rb_eTypeError, "already initialized instance");
     }
     rb_scan_args(argc, argv, "11", &source, &opts);
     source = convert_encoding(StringValue(source));
Index: test/json/test_json.rb
===================================================================
--- test/json/test_json.rb	(revision 30791)
+++ test/json/test_json.rb	(revision 30792)
@@ -394,8 +394,8 @@
 
   def test_allocate
     json = JSON::Parser.new("{}")
-    assert_raises(ArgumentError, '[ruby-core:35079]') {json.__send__(:initialize, "{}")}
+    assert_raises(TypeError, '[ruby-core:35079]') {json.__send__(:initialize, "{}")}
     json = JSON::Parser.allocate
-    assert_raises(ArgumentError, '[ruby-core:35079]') {json.source}
+    assert_raises(TypeError, '[ruby-core:35079]') {json.source}
   end
 end

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

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