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

ruby-changes:27166

From: usa <ko1@a...>
Date: Wed, 13 Feb 2013 16:19:10 +0900 (JST)
Subject: [ruby-changes:27166] usa:r39218 (ruby_1_9_3): * ext/json: Import JSON 1.5.5.

usa	2013-02-13 16:18:58 +0900 (Wed, 13 Feb 2013)

  New Revision: 39218

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

  Log:
    * ext/json: Import JSON 1.5.5.

  Modified files:
    branches/ruby_1_9_3/ChangeLog
    branches/ruby_1_9_3/ext/json/lib/json/add/core.rb
    branches/ruby_1_9_3/ext/json/lib/json/common.rb
    branches/ruby_1_9_3/ext/json/lib/json/version.rb
    branches/ruby_1_9_3/ext/json/parser/parser.c
    branches/ruby_1_9_3/ext/json/parser/parser.rl
    branches/ruby_1_9_3/test/json/test_json.rb
    branches/ruby_1_9_3/test/json/test_json_addition.rb
    branches/ruby_1_9_3/test/json/test_json_string_matching.rb
    branches/ruby_1_9_3/version.h

Index: ruby_1_9_3/ChangeLog
===================================================================
--- ruby_1_9_3/ChangeLog	(revision 39217)
+++ ruby_1_9_3/ChangeLog	(revision 39218)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ChangeLog#L1
+Wed Feb 13 16:18:22 2013  NAKAMURA Usaku  <usa@r...>
+
+	* ext/json: Import JSON 1.5.5.
+
 Wed Feb  6 17:39:19 2013  Eric Hodel  <drbrain@s...>
 
 	* lib/rdoc: Import RDoc 3.9.5.
Index: ruby_1_9_3/ext/json/lib/json/version.rb
===================================================================
--- ruby_1_9_3/ext/json/lib/json/version.rb	(revision 39217)
+++ ruby_1_9_3/ext/json/lib/json/version.rb	(revision 39218)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ext/json/lib/json/version.rb#L1
 module JSON
   # JSON version
-  VERSION         = '1.5.4'
+  VERSION         = '1.5.5'
   VERSION_ARRAY   = VERSION.split(/\./).map { |x| x.to_i } # :nodoc:
   VERSION_MAJOR   = VERSION_ARRAY[0] # :nodoc:
   VERSION_MINOR   = VERSION_ARRAY[1] # :nodoc:
Index: ruby_1_9_3/ext/json/lib/json/add/core.rb
===================================================================
--- ruby_1_9_3/ext/json/lib/json/add/core.rb	(revision 39217)
+++ ruby_1_9_3/ext/json/lib/json/add/core.rb	(revision 39218)
@@ -36,8 +36,8 @@ class Time https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ext/json/lib/json/add/core.rb#L36
     if usec = object.delete('u') # used to be tv_usec -> tv_nsec
       object['n'] = usec * 1000
     end
-    if respond_to?(:tv_nsec)
-      at(*object.values_at('s', 'n'))
+    if instance_methods.include?(:tv_nsec)
+      at(object['s'], Rational(object['n'], 1000))
     else
       at(object['s'], object['n'] / 1000)
     end
@@ -46,10 +46,13 @@ class Time https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ext/json/lib/json/add/core.rb#L46
   # Returns a hash, that will be turned into a JSON object and represent this
   # object.
   def as_json(*)
+    nanoseconds = [ tv_usec * 1000 ]
+    respond_to?(:tv_nsec) and nanoseconds << tv_nsec
+    nanoseconds = nanoseconds.max
     {
       JSON.create_id => self.class.name,
       's'            => tv_sec,
-      'n'            => respond_to?(:tv_nsec) ? tv_nsec : tv_usec * 1000
+      'n'            => nanoseconds,
     }
   end
 
Index: ruby_1_9_3/ext/json/lib/json/common.rb
===================================================================
--- ruby_1_9_3/ext/json/lib/json/common.rb	(revision 39217)
+++ ruby_1_9_3/ext/json/lib/json/common.rb	(revision 39218)
@@ -141,7 +141,7 @@ module JSON https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ext/json/lib/json/common.rb#L141
   #   the default.
   # * *create_additions*: If set to false, the Parser doesn't create
   #   additions even if a matching class and create_id was found. This option
-  #   defaults to true.
+  #   defaults to false.
   # * *object_class*: Defaults to Hash
   # * *array_class*: Defaults to Array
   def parse(source, opts = {})
@@ -162,7 +162,7 @@ module JSON https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ext/json/lib/json/common.rb#L162
   #   to true.
   # * *create_additions*: If set to false, the Parser doesn't create
   #   additions even if a matching class and create_id was found. This option
-  #   defaults to true.
+  #   defaults to false.
   def parse!(source, opts = {})
     opts = {
       :max_nesting  => false,
@@ -287,11 +287,18 @@ module JSON https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ext/json/lib/json/common.rb#L287
   # Load a ruby data structure from a JSON _source_ and return it. A source can
   # either be a string-like object, an IO-like object, or an object responding
   # to the read method. If _proc_ was given, it will be called with any nested
-  # Ruby object as an argument recursively in depth first order.
+  # Ruby object as an argument recursively in depth first order. To modify the
+  # default options pass in the optional _options_ argument as well.
   #
   # This method is part of the implementation of the load/dump interface of
   # Marshal and YAML.
-  def load(source, proc = nil)
+  def load(source, proc = nil, options = {})
+    load_default_options = {
+      :max_nesting      => false,
+      :allow_nan        => true,
+      :create_additions => false
+    }
+    opts = load_default_options.merge options
     if source.respond_to? :to_str
       source = source.to_str
     elsif source.respond_to? :to_io
@@ -299,7 +306,7 @@ module JSON https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ext/json/lib/json/common.rb#L306
     else
       source = source.read
     end
-    result = parse(source, :max_nesting => false, :allow_nan => true)
+    result = parse(source, opts)
     recurse_proc(result, &proc) if proc
     result
   end
Index: ruby_1_9_3/ext/json/parser/parser.rl
===================================================================
--- ruby_1_9_3/ext/json/parser/parser.rl	(revision 39217)
+++ ruby_1_9_3/ext/json/parser/parser.rl	(revision 39218)
@@ -607,6 +607,9 @@ static VALUE convert_encoding(VALUE sour https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ext/json/parser/parser.rl#L607
  *   defaults to true.
  * * *object_class*: Defaults to Hash
  * * *array_class*: Defaults to Array
+ * * *quirks_mode*: Enables quirks_mode for parser, that is for example
+ *   parsing single JSON values instead of documents is possible.
+ *
  */
 static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
 {
@@ -657,7 +660,7 @@ static VALUE cParser_initialize(int argc https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ext/json/parser/parser.rl#L660
             if (option_given_p(opts, tmp)) {
                 json->create_additions = RTEST(rb_hash_aref(opts, tmp));
             } else {
-                json->create_additions = 1;
+                json->create_additions = 0;
             }
             tmp = ID2SYM(i_create_id);
             if (option_given_p(opts, tmp)) {
Index: ruby_1_9_3/ext/json/parser/parser.c
===================================================================
--- ruby_1_9_3/ext/json/parser/parser.c	(revision 39217)
+++ ruby_1_9_3/ext/json/parser/parser.c	(revision 39218)
@@ -1676,7 +1676,7 @@ static VALUE cParser_initialize(int argc https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ext/json/parser/parser.c#L1676
             if (option_given_p(opts, tmp)) {
                 json->create_additions = RTEST(rb_hash_aref(opts, tmp));
             } else {
-                json->create_additions = 1;
+                json->create_additions = 0;
             }
             tmp = ID2SYM(i_create_id);
             if (option_given_p(opts, tmp)) {
@@ -1723,7 +1723,7 @@ static VALUE cParser_initialize(int argc https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ext/json/parser/parser.c#L1723
 }
 
 
-#line 1719 "parser.c"
+#line 1722 "parser.c"
 static const int JSON_start = 1;
 static const int JSON_first_final = 10;
 static const int JSON_error = 0;
@@ -1731,7 +1731,7 @@ static const int JSON_error = 0; https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ext/json/parser/parser.c#L1731
 static const int JSON_en_main = 1;
 
 
-#line 726 "parser.rl"
+#line 729 "parser.rl"
 
 
 static VALUE cParser_parse_strict(VALUE self)
@@ -1742,16 +1742,16 @@ static VALUE cParser_parse_strict(VALUE https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ext/json/parser/parser.c#L1742
     GET_PARSER;
 
 
-#line 1738 "parser.c"
+#line 1741 "parser.c"
 	{
 	cs = JSON_start;
 	}
 
-#line 736 "parser.rl"
+#line 739 "parser.rl"
     p = json->source;
     pe = p + json->len;
 
-#line 1747 "parser.c"
+#line 1750 "parser.c"
 	{
 	if ( p == pe )
 		goto _test_eof;
@@ -1807,7 +1807,7 @@ case 5: https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ext/json/parser/parser.c#L1807
 		goto st1;
 	goto st5;
 tr3:
-#line 715 "parser.rl"
+#line 718 "parser.rl"
 	{
         char *np;
         json->current_nesting = 1;
@@ -1816,7 +1816,7 @@ tr3: https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ext/json/parser/parser.c#L1816
     }
 	goto st10;
 tr4:
-#line 708 "parser.rl"
+#line 711 "parser.rl"
 	{
         char *np;
         json->current_nesting = 1;
@@ -1828,7 +1828,7 @@ st10: https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ext/json/parser/parser.c#L1828
 	if ( ++p == pe )
 		goto _test_eof10;
 case 10:
-#line 1824 "parser.c"
+#line 1827 "parser.c"
 	switch( (*p) ) {
 		case 13: goto st10;
 		case 32: goto st10;
@@ -1885,7 +1885,7 @@ case 9: https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ext/json/parser/parser.c#L1885
 	_out: {}
 	}
 
-#line 739 "parser.rl"
+#line 742 "parser.rl"
 
     if (cs >= JSON_first_final && p == pe) {
         return result;
@@ -1897,7 +1897,7 @@ case 9: https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ext/json/parser/parser.c#L1897
 
 
 
-#line 1893 "parser.c"
+#line 1896 "parser.c"
 static const int JSON_quirks_mode_start = 1;
 static const int JSON_quirks_mode_first_final = 10;
 static const int JSON_quirks_mode_error = 0;
@@ -1905,7 +1905,7 @@ static const int JSON_quirks_mode_error https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ext/json/parser/parser.c#L1905
 static const int JSON_quirks_mode_en_main = 1;
 
 
-#line 764 "parser.rl"
+#line 767 "parser.rl"
 
 
 static VALUE cParser_parse_quirks_mode(VALUE self)
@@ -1916,16 +1916,16 @@ static VALUE cParser_parse_quirks_mode(V https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ext/json/parser/parser.c#L1916
     GET_PARSER;
 
 
-#line 1912 "parser.c"
+#line 1915 "parser.c"
 	{
 	cs = JSON_quirks_mode_start;
 	}
 
-#line 774 "parser.rl"
+#line 777 "parser.rl"
     p = json->source;
     pe = p + json->len;
 
-#line 1921 "parser.c"
+#line 1924 "parser.c"
 	{
 	if ( p == pe )
 		goto _test_eof;
@@ -1959,7 +1959,7 @@ st0: https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ext/json/parser/parser.c#L1959
 cs = 0;
 	goto _out;
 tr2:
-#line 756 "parser.rl"
+#line 759 "parser.rl"
 	{
         char *np = JSON_parse_value(json, p, pe, &result);
         if (np == NULL) { p--; {p++; cs = 10; goto _out;} } else {p = (( np))-1;}
@@ -1969,7 +1969,7 @@ st10: https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ext/json/parser/parser.c#L1969
 	if ( ++p == pe )
 		goto _test_eof10;
 case 10:
-#line 1965 "parser.c"
+#line 1968 "parser.c"
 	switch( (*p) ) {
 		case 13: goto st10;
 		case 32: goto st10;
@@ -2058,7 +2058,7 @@ case 9: https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ext/json/parser/parser.c#L2058
 	_out: {}
 	}
 
-#line 777 "parser.rl"
+#line 780 "parser.rl"
 
     if (cs >= JSON_quirks_mode_first_final && p == pe) {
         return result;
Index: ruby_1_9_3/version.h
===================================================================
--- ruby_1_9_3/version.h	(revision 39217)
+++ ruby_1_9_3/version.h	(revision 39218)
@@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/version.h#L1
 #define RUBY_VERSION "1.9.3"
-#define RUBY_PATCHLEVEL 385
+#define RUBY_PATCHLEVEL 386
 
-#define RUBY_RELEASE_DATE "2013-02-06"
+#define RUBY_RELEASE_DATE "2013-02-13"
 #define RUBY_RELEASE_YEAR 2013
 #define RUBY_RELEASE_MONTH 2
-#define RUBY_RELEASE_DAY 6
+#define RUBY_RELEASE_DAY 13
 
 #include "ruby/version.h"
 
Index: ruby_1_9_3/test/json/test_json_addition.rb
===================================================================
--- ruby_1_9_3/test/json/test_json_addition.rb	(revision 39217)
+++ ruby_1_9_3/test/json/test_json_addition.rb	(revision 39218)
@@ -69,11 +69,19 @@ class TC_JSONAddition < Test::Unit::Test https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/test/json/test_json_addition.rb#L69
     a = A.new(666)
     assert A.json_creatable?
     json = generate(a)
-    a_again = JSON.parse(json)
+    a_again = JSON.parse(json, :create_additions => true)
     assert_kind_of a.class, a_again
     assert_equal a, a_again
   end
 
+  def test_extended_json_default
+    a = A.new(666)
+    assert A.json_creatable?
+    json = generate(a)
+    a_hash = JSON.parse(json)
+    assert_kind_of Hash, a_hash
+  end
+
   def test_extended_json_disabled
     a = A.new(666)
     assert A.json_creatable?
@@ -100,7 +108,7 @@ class TC_JSONAddition < Test::Unit::Test https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/test/json/test_json_addition.rb#L108
     c = C.new
     assert !C.json_creatable?
     json = generate(c)
-    assert_raises(ArgumentError, NameError) { JSON.parse(json) }
+    assert_raises(ArgumentError, NameError) { JSON.parse(json, :create_additions => true) }
   end
 
   def test_raw_strings
@@ -118,7 +126,7 @@ class TC_JSONAddition < Test::Unit::Test https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/test/json/test_json_addition.rb#L126
     assert_match(/\A\{.*\}\Z/, json)
     assert_match(/"json_class":"String"/, json)
     assert_match(/"raw":\[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255\]/, json)
-    raw_again = JSON.parse(json)
+    raw_again = JSON.parse(json, :create_additions => true)
     assert_equal raw, raw_again
   end
 
@@ -126,17 +134,17 @@ class TC_JSONAddition < Test::Unit::Test https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/test/json/test_json_addition.rb#L134
 
   def test_core
     t = Time.now
-    assert_equal t.inspect, JSON(JSON(t)).inspect
+    assert_equal t, JSON(JSON(t), :create_additions => true)
     d = Date.today
-    assert_equal d, JSON(JSON(d))
+    assert_equal d, JSON(JSON(d), :create_additions => true)
     d = DateTime.civil(2007, 6, 14, 14, 57, 10, Rational(1, 12), 2299161)
-    assert_equal d, JSON(JSON(d))
-    assert_equal 1..10, JSON(JSON(1..10))
-    assert_equal 1...10, JSON(JSON(1...10))
-    assert_equal "a".."c", JSON(JSON("a".."c"))
-    assert_equal "a"..."c", JSON(JSON("a"..."c"))
+    assert_equal d, JSON(JSON(d), :create_additions => true)
+    assert_equal 1..10, JSON(JSON(1..10), :create_additions => true)
+    assert_equal 1...10, JSON(JSON(1...10), :create_additions => true)
+    assert_equal "a".."c", JSON(JSON("a".."c"), :create_additions => true)
+    assert_equal "a"..."c", JSON(JSON("a"..."c"), :create_additions => true)
     s = MyJsonStruct.new 4711, 'foot'
-    assert_equal s, JSON(JSON(s))
+    assert_equal s, JSON(JSON(s), :create_additions => true)
     struct = Struct.new :foo, :bar
     s = struct.new 4711, 'foot'
     assert_raises(JSONError) { JSON(s) }
@@ -144,24 +152,24 @@ class TC_JSONAddition < Test::Unit::Test https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/test/json/test_json_addition.rb#L152
       raise TypeError, "test me"
     rescue TypeError => e
       e_json = JSON.generate e
-      e_again = JSON e_json
+      e_again = JSON e_json, :create_additions => true
       assert_kind_of TypeError, e_again
       assert_equal e.message, e_again.message
       assert_equal e.backtrace, e_again.backtrace
     end
-    assert_equal(/foo/, JSON(JSON(/foo/)))
-    assert_equal(/foo/i, JSON(JSON(/foo/i)))
+    assert_equal(/foo/, JSON(JSON(/foo/), :create_additions => true))
+    assert_equal(/foo/i, JSON(JSON(/foo/i), :create_additions => true))
   end
 
   def test_utc_datetime
     now = Time.now
-    d = DateTime.parse(now.to_s)                    # usual case
-    assert_equal d, JSON.parse(d.to_json)
+    d = DateTime.parse(now.to_s, :create_additions => true)                    # usual case
+    assert_equal d, JSON.parse(d.to_json, :create_additions => true)
     d = DateTime.parse(now.utc.to_s)                # of = 0
-    assert_equal d, JSON.parse(d.to_json)
+    assert_equal d, JSON.parse(d.to_json, :create_additions => true)
     d = DateTime.civil(2008, 6, 17, 11, 48, 32, Rational(1,24))
-    assert_equal d, JSON.parse(d.to_json)
+    assert_equal d, JSON.parse(d.to_json, :create_additions => true)
     d = DateTime.civil(2008, 6, 17, 11, 48, 32, Rational(12,24))
-    assert_equal d, JSON.parse(d.to_json)
+    assert_equal d, JSON.parse(d.to_json, :create_additions => true)
   end
 end
Index: ruby_1_9_3/test/json/test_json.rb
===================================================================
--- ruby_1_9_3/test/json/test_json.rb	(revision 39217)
+++ ruby_1_9_3/test/json/test_json.rb	(revision 39218)
@@ -4,6 +4,7 @@ https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/test/json/test_json.rb#L4
 require 'test/unit'
 require File.join(File.dirname(__FILE__), 'setup_variant')
 require 'stringio'
+require 'tempfile'
 
 unless Array.method_defined?(:permutation)
   begin
@@ -263,12 +264,12 @@ class TC_JSON < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/test/json/test_json.rb#L264
   def test_generation_of_core_subclasses_with_new_to_json
     obj = SubHash2["foo" => SubHash2["bar" => true]]
     obj_json = JSON(obj)
-    obj_again = JSON(obj_json)
+    obj_again = JSON.parse(obj_json, :create_additions => true)
     assert_kind_of SubHash2, obj_again
     assert_kind_of SubHash2, obj_again['foo']
     assert obj_again['foo']['bar']
     assert_equal obj, obj_again
-    assert_equal ["foo"], JSON(JSON(SubArray2["foo"]))
+    assert_equal ["foo"], JSON(JSON(SubArray2["foo"]), :create_additions => true)
   end
 
   def test_generation_of_core_subclasses_with_default_to_json
@@ -414,6 +415,25 @@ EOT https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/test/json/test_json.rb#L415
       JSON.parse('{"foo":"bar", "baz":"quux"}', :symbolize_names => true))
   end
 
+  def test_load
+    assert_equal @hash, JSON.load(@json)
+    tempfile = Tempfile.open('json')
+    tempfile.write @json
+    tempfile.rewind
+    assert_equal @hash, JSON.load(tempfile)
+    stringio = StringIO.new(@json)
+    stringio.rewind
+    assert_equal @hash, JSON.load(stringio)
+    assert_raise(NoMethodError) { JSON.load(nil) }
+    assert_raise(JSON::ParserError) {JSON.load('') }
+  end
+
+  def test_load_with_options
+    small_hash  = JSON("foo" => 'bar')
+    symbol_hash = { :foo => 'bar' }
+    assert_equal symbol_hash, JSON.load(small_hash, nil, :symbolize_names => true)
+  end
+
   def test_load_dump
     too_deep = '[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]'
     assert_equal too_deep, JSON.dump(eval(too_deep))
Index: ruby_1_9_3/test/json/test_json_string_matching.rb
===================================================================
--- ruby_1_9_3/test/json/test_json_string_matching.rb	(revision 39217)
+++ ruby_1_9_3/test/json/test_json_string_matching.rb	(revision 39218)
@@ -27,14 +27,13 @@ class TestJsonStringMatching < Test::Uni https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/test/json/test_json_string_matching.rb#L27
     t = TestTime.new
     t_json = [ t ].to_json
     assert_equal [ t ],
-      JSON.parse(t_json,
-        :match_string => { /\A\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}[+-]\d{4}\Z/ => TestTime })
+      JSON.parse(t_json, :create_additions => true,
+        :match_string => { /\A\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}[+-]\d{4}\z/ => TestTime })
     assert_equal [ t.strftime('%FT%T%z') ],
-      JSON.parse(t_json,
-        :match_string => { /\A\d{3}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}[+-]\d{4}\Z/ => TestTime })
+      JSON.parse(t_json, :create_additions => true,
+        :match_string => { /\A\d{3}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}[+-]\d{4}\z/ => TestTime })
     assert_equal [ t.strftime('%FT%T%z') ],
       JSON.parse(t_json,
-        :match_strin (... truncated)

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

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