Hello community, here is the log from the commit of package rubygem-json for openSUSE:Factory checked in at 2016-08-25 09:55:37 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-json (Old) and /work/SRC/openSUSE:Factory/.rubygem-json.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-json" Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-json/rubygem-json.changes 2016-07-21 07:58:11.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.rubygem-json.new/rubygem-json.changes 2016-08-25 09:55:39.000000000 +0200 @@ -1,0 +2,10 @@ +Wed Jul 27 04:29:58 UTC 2016 - [email protected] + +- updated to version 2.0.2 + see installed CHANGES.md + + ## 2016-07-26 (2.0.2) + * Specify `required_ruby_version` for json\_pure. + * Fix issue #295 failure when parsing frozen strings. + +------------------------------------------------------------------- Old: ---- json-2.0.1.gem New: ---- json-2.0.2.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-json.spec ++++++ --- /var/tmp/diff_new_pack.wePB9J/_old 2016-08-25 09:55:40.000000000 +0200 +++ /var/tmp/diff_new_pack.wePB9J/_new 2016-08-25 09:55:40.000000000 +0200 @@ -24,7 +24,7 @@ # Name: rubygem-json -Version: 2.0.1 +Version: 2.0.2 Release: 0 %define mod_name json %define mod_full_name %{mod_name}-%{version} ++++++ json-2.0.1.gem -> json-2.0.2.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHANGES.md new/CHANGES.md --- old/CHANGES.md 2016-07-01 17:31:26.000000000 +0200 +++ new/CHANGES.md 2016-07-26 13:11:27.000000000 +0200 @@ -1,5 +1,9 @@ # Changes +## 2016-07-26 (2.0.2) + * Specify `required_ruby_version` for json\_pure. + * Fix issue #295 failure when parsing frozen strings. + ## 2016-07-01 (2.0.1) * Fix problem when requiring json\_pure and Parser constant was defiend top level. @@ -28,7 +32,7 @@ `JSON.dump_default_options`. * More tests by Michael Mac-Vicar <[email protected]> and fixing `space_before` accessor in generator. - * Performance on Jruby improvemed by Ben Browning <[email protected]>. + * Performance on Jruby improved by Ben Browning <[email protected]>. * Some fixes to be compatible with the new Ruby 2.2 by Zachary Scott <[email protected]> and SHIBATA Hiroshi <[email protected]>. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/README.md new/README.md --- old/README.md 2016-07-01 17:31:26.000000000 +0200 +++ new/README.md 2016-07-26 13:11:27.000000000 +0200 @@ -3,8 +3,8 @@ ## Description -This is a implementation of the JSON specification according to RFC 4627 -http://www.ietf.org/rfc/rfc4627.txt . Starting from version 1.0.0 on there +This is a implementation of the JSON specification according to RFC 7159 +http://www.ietf.org/rfc/rfc7159.txt . Starting from version 1.0.0 on there will be two variants available: * A pure ruby variant, that relies on the iconv and the stringscan diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Rakefile new/Rakefile --- old/Rakefile 2016-07-01 17:31:26.000000000 +0200 +++ new/Rakefile 2016-07-26 13:11:27.000000000 +0200 @@ -95,6 +95,7 @@ s.email = "[email protected]" s.homepage = "http://flori.github.com/#{PKG_NAME}" s.license = 'Ruby' + s.required_ruby_version = '~> 2.0' end desc 'Creates a json_pure.gemspec file' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/VERSION new/VERSION --- old/VERSION 2016-07-01 17:31:26.000000000 +0200 +++ new/VERSION 2016-07-26 13:11:27.000000000 +0200 @@ -1 +1 @@ -2.0.1 +2.0.2 Files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ext/json/ext/generator/generator.c new/ext/json/ext/generator/generator.c --- old/ext/json/ext/generator/generator.c 2016-07-01 17:31:26.000000000 +0200 +++ new/ext/json/ext/generator/generator.c 2016-07-26 13:11:27.000000000 +0200 @@ -951,6 +951,7 @@ { VALUE result = cState_partial_generate(self, obj); GET_STATE(self); + (void)state; return result; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ext/json/ext/parser/parser.c new/ext/json/ext/parser/parser.c --- old/ext/json/ext/parser/parser.c 2016-07-01 17:31:26.000000000 +0200 +++ new/ext/json/ext/parser/parser.c 2016-07-26 13:11:27.000000000 +0200 @@ -1670,6 +1670,9 @@ #ifdef HAVE_RUBY_ENCODING_H rb_encoding *enc = rb_enc_get(source); if (enc == rb_ascii8bit_encoding()) { + if (OBJ_FROZEN(source)) { + source = rb_str_dup(source); + } FORCE_UTF8(source); } else { source = rb_str_conv_enc(source, NULL, rb_utf8_encoding()); @@ -1805,7 +1808,7 @@ } -#line 1809 "parser.c" +#line 1812 "parser.c" enum {JSON_start = 1}; enum {JSON_first_final = 10}; enum {JSON_error = 0}; @@ -1813,7 +1816,7 @@ enum {JSON_en_main = 1}; -#line 717 "parser.rl" +#line 720 "parser.rl" /* @@ -1830,16 +1833,16 @@ GET_PARSER; -#line 1834 "parser.c" +#line 1837 "parser.c" { cs = JSON_start; } -#line 733 "parser.rl" +#line 736 "parser.rl" p = json->source; pe = p + json->len; -#line 1843 "parser.c" +#line 1846 "parser.c" { if ( p == pe ) goto _test_eof; @@ -1873,7 +1876,7 @@ cs = 0; goto _out; tr2: -#line 709 "parser.rl" +#line 712 "parser.rl" { char *np = JSON_parse_value(json, p, pe, &result, 0); if (np == NULL) { p--; {p++; cs = 10; goto _out;} } else {p = (( np))-1;} @@ -1883,7 +1886,7 @@ if ( ++p == pe ) goto _test_eof10; case 10: -#line 1887 "parser.c" +#line 1890 "parser.c" switch( (*p) ) { case 13: goto st10; case 32: goto st10; @@ -1972,7 +1975,7 @@ _out: {} } -#line 736 "parser.rl" +#line 739 "parser.rl" if (cs >= JSON_first_final && p == pe) { return result; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ext/json/ext/parser/parser.rl new/ext/json/ext/parser/parser.rl --- old/ext/json/ext/parser/parser.rl 2016-07-01 17:31:26.000000000 +0200 +++ new/ext/json/ext/parser/parser.rl 2016-07-26 13:11:27.000000000 +0200 @@ -565,6 +565,9 @@ #ifdef HAVE_RUBY_ENCODING_H rb_encoding *enc = rb_enc_get(source); if (enc == rb_ascii8bit_encoding()) { + if (OBJ_FROZEN(source)) { + source = rb_str_dup(source); + } FORCE_UTF8(source); } else { source = rb_str_conv_enc(source, NULL, rb_utf8_encoding()); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/java/src/json/ext/Parser.java new/java/src/json/ext/Parser.java --- old/java/src/json/ext/Parser.java 2016-07-01 17:31:26.000000000 +0200 +++ new/java/src/json/ext/Parser.java 2016-07-26 13:11:27.000000000 +0200 @@ -181,6 +181,9 @@ private RubyString convertEncoding(ThreadContext context, RubyString source) { RubyEncoding encoding = (RubyEncoding)source.encoding(context); if (encoding == info.ascii8bit.get()) { + if (source.isFrozen()) { + source = (RubyString) source.dup(); + } source.force_encoding(context, info.utf8.get()); } else { source = (RubyString) source.encode(context, info.utf8.get()); @@ -304,11 +307,11 @@ } -// line 330 "Parser.rl" +// line 333 "Parser.rl" -// line 312 "Parser.java" +// line 315 "Parser.java" private static byte[] init__JSON_value_actions_0() { return new byte [] { @@ -422,7 +425,7 @@ static final int JSON_value_en_main = 1; -// line 436 "Parser.rl" +// line 439 "Parser.rl" void parseValue(ParserResult res, int p, int pe) { @@ -430,14 +433,14 @@ IRubyObject result = null; -// line 434 "Parser.java" +// line 437 "Parser.java" { cs = JSON_value_start; } -// line 443 "Parser.rl" +// line 446 "Parser.rl" -// line 441 "Parser.java" +// line 444 "Parser.java" { int _klen; int _trans = 0; @@ -463,13 +466,13 @@ while ( _nacts-- > 0 ) { switch ( _JSON_value_actions[_acts++] ) { case 9: -// line 421 "Parser.rl" +// line 424 "Parser.rl" { p--; { p += 1; _goto_targ = 5; if (true) continue _goto;} } break; -// line 473 "Parser.java" +// line 476 "Parser.java" } } @@ -532,25 +535,25 @@ switch ( _JSON_value_actions[_acts++] ) { case 0: -// line 338 "Parser.rl" +// line 341 "Parser.rl" { result = getRuntime().getNil(); } break; case 1: -// line 341 "Parser.rl" +// line 344 "Parser.rl" { result = getRuntime().getFalse(); } break; case 2: -// line 344 "Parser.rl" +// line 347 "Parser.rl" { result = getRuntime().getTrue(); } break; case 3: -// line 347 "Parser.rl" +// line 350 "Parser.rl" { if (parser.allowNaN) { result = getConstant(CONST_NAN); @@ -560,7 +563,7 @@ } break; case 4: -// line 354 "Parser.rl" +// line 357 "Parser.rl" { if (parser.allowNaN) { result = getConstant(CONST_INFINITY); @@ -570,7 +573,7 @@ } break; case 5: -// line 361 "Parser.rl" +// line 364 "Parser.rl" { if (pe > p + 8 && absSubSequence(p, p + 9).equals(JSON_MINUS_INFINITY)) { @@ -599,7 +602,7 @@ } break; case 6: -// line 387 "Parser.rl" +// line 390 "Parser.rl" { parseString(res, p, pe); if (res.result == null) { @@ -612,7 +615,7 @@ } break; case 7: -// line 397 "Parser.rl" +// line 400 "Parser.rl" { currentNesting++; parseArray(res, p, pe); @@ -627,7 +630,7 @@ } break; case 8: -// line 409 "Parser.rl" +// line 412 "Parser.rl" { currentNesting++; parseObject(res, p, pe); @@ -641,7 +644,7 @@ } } break; -// line 645 "Parser.java" +// line 648 "Parser.java" } } } @@ -661,7 +664,7 @@ break; } } -// line 444 "Parser.rl" +// line 447 "Parser.rl" if (cs >= JSON_value_first_final && result != null) { res.update(result, p); @@ -671,7 +674,7 @@ } -// line 675 "Parser.java" +// line 678 "Parser.java" private static byte[] init__JSON_integer_actions_0() { return new byte [] { @@ -770,7 +773,7 @@ static final int JSON_integer_en_main = 1; -// line 463 "Parser.rl" +// line 466 "Parser.rl" void parseInteger(ParserResult res, int p, int pe) { @@ -788,15 +791,15 @@ int cs = EVIL; -// line 792 "Parser.java" +// line 795 "Parser.java" { cs = JSON_integer_start; } -// line 480 "Parser.rl" +// line 483 "Parser.rl" int memo = p; -// line 800 "Parser.java" +// line 803 "Parser.java" { int _klen; int _trans = 0; @@ -877,13 +880,13 @@ switch ( _JSON_integer_actions[_acts++] ) { case 0: -// line 457 "Parser.rl" +// line 460 "Parser.rl" { p--; { p += 1; _goto_targ = 5; if (true) continue _goto;} } break; -// line 887 "Parser.java" +// line 890 "Parser.java" } } } @@ -903,7 +906,7 @@ break; } } -// line 482 "Parser.rl" +// line 485 "Parser.rl" if (cs < JSON_integer_first_final) { return -1; @@ -925,7 +928,7 @@ } -// line 929 "Parser.java" +// line 932 "Parser.java" private static byte[] init__JSON_float_actions_0() { return new byte [] { @@ -1027,7 +1030,7 @@ static final int JSON_float_en_main = 1; -// line 517 "Parser.rl" +// line 520 "Parser.rl" void parseFloat(ParserResult res, int p, int pe) { @@ -1045,15 +1048,15 @@ int cs = EVIL; -// line 1049 "Parser.java" +// line 1052 "Parser.java" { cs = JSON_float_start; } -// line 534 "Parser.rl" +// line 537 "Parser.rl" int memo = p; -// line 1057 "Parser.java" +// line 1060 "Parser.java" { int _klen; int _trans = 0; @@ -1134,13 +1137,13 @@ switch ( _JSON_float_actions[_acts++] ) { case 0: -// line 508 "Parser.rl" +// line 511 "Parser.rl" { p--; { p += 1; _goto_targ = 5; if (true) continue _goto;} } break; -// line 1144 "Parser.java" +// line 1147 "Parser.java" } } } @@ -1160,7 +1163,7 @@ break; } } -// line 536 "Parser.rl" +// line 539 "Parser.rl" if (cs < JSON_float_first_final) { return -1; @@ -1176,7 +1179,7 @@ } -// line 1180 "Parser.java" +// line 1183 "Parser.java" private static byte[] init__JSON_string_actions_0() { return new byte [] { @@ -1278,7 +1281,7 @@ static final int JSON_string_en_main = 1; -// line 581 "Parser.rl" +// line 584 "Parser.rl" void parseString(ParserResult res, int p, int pe) { @@ -1286,15 +1289,15 @@ IRubyObject result = null; -// line 1290 "Parser.java" +// line 1293 "Parser.java" { cs = JSON_string_start; } -// line 588 "Parser.rl" +// line 591 "Parser.rl" int memo = p; -// line 1298 "Parser.java" +// line 1301 "Parser.java" { int _klen; int _trans = 0; @@ -1375,7 +1378,7 @@ switch ( _JSON_string_actions[_acts++] ) { case 0: -// line 556 "Parser.rl" +// line 559 "Parser.rl" { int offset = byteList.begin(); ByteList decoded = decoder.decode(byteList, memo + 1 - offset, @@ -1390,13 +1393,13 @@ } break; case 1: -// line 569 "Parser.rl" +// line 572 "Parser.rl" { p--; { p += 1; _goto_targ = 5; if (true) continue _goto;} } break; -// line 1400 "Parser.java" +// line 1403 "Parser.java" } } } @@ -1416,7 +1419,7 @@ break; } } -// line 590 "Parser.rl" +// line 593 "Parser.rl" if (parser.createAdditions) { RubyHash matchString = parser.matchString; @@ -1454,7 +1457,7 @@ } -// line 1458 "Parser.java" +// line 1461 "Parser.java" private static byte[] init__JSON_array_actions_0() { return new byte [] { @@ -1567,7 +1570,7 @@ static final int JSON_array_en_main = 1; -// line 663 "Parser.rl" +// line 666 "Parser.rl" void parseArray(ParserResult res, int p, int pe) { @@ -1587,14 +1590,14 @@ } -// line 1591 "Parser.java" +// line 1594 "Parser.java" { cs = JSON_array_start; } -// line 682 "Parser.rl" +// line 685 "Parser.rl" -// line 1598 "Parser.java" +// line 1601 "Parser.java" { int _klen; int _trans = 0; @@ -1675,7 +1678,7 @@ switch ( _JSON_array_actions[_acts++] ) { case 0: -// line 632 "Parser.rl" +// line 635 "Parser.rl" { parseValue(res, p, pe); if (res.result == null) { @@ -1692,13 +1695,13 @@ } break; case 1: -// line 647 "Parser.rl" +// line 650 "Parser.rl" { p--; { p += 1; _goto_targ = 5; if (true) continue _goto;} } break; -// line 1702 "Parser.java" +// line 1705 "Parser.java" } } } @@ -1718,7 +1721,7 @@ break; } } -// line 683 "Parser.rl" +// line 686 "Parser.rl" if (cs >= JSON_array_first_final) { res.update(result, p + 1); @@ -1728,7 +1731,7 @@ } -// line 1732 "Parser.java" +// line 1735 "Parser.java" private static byte[] init__JSON_object_actions_0() { return new byte [] { @@ -1851,7 +1854,7 @@ static final int JSON_object_en_main = 1; -// line 742 "Parser.rl" +// line 745 "Parser.rl" void parseObject(ParserResult res, int p, int pe) { @@ -1876,14 +1879,14 @@ } -// line 1880 "Parser.java" +// line 1883 "Parser.java" { cs = JSON_object_start; } -// line 766 "Parser.rl" +// line 769 "Parser.rl" -// line 1887 "Parser.java" +// line 1890 "Parser.java" { int _klen; int _trans = 0; @@ -1964,7 +1967,7 @@ switch ( _JSON_object_actions[_acts++] ) { case 0: -// line 697 "Parser.rl" +// line 700 "Parser.rl" { parseValue(res, p, pe); if (res.result == null) { @@ -1981,7 +1984,7 @@ } break; case 1: -// line 712 "Parser.rl" +// line 715 "Parser.rl" { parseString(res, p, pe); if (res.result == null) { @@ -2001,13 +2004,13 @@ } break; case 2: -// line 730 "Parser.rl" +// line 733 "Parser.rl" { p--; { p += 1; _goto_targ = 5; if (true) continue _goto;} } break; -// line 2011 "Parser.java" +// line 2014 "Parser.java" } } } @@ -2027,7 +2030,7 @@ break; } } -// line 767 "Parser.rl" +// line 770 "Parser.rl" if (cs < JSON_object_first_final) { res.update(null, p + 1); @@ -2060,7 +2063,7 @@ } -// line 2064 "Parser.java" +// line 2067 "Parser.java" private static byte[] init__JSON_actions_0() { return new byte [] { @@ -2163,7 +2166,7 @@ static final int JSON_en_main = 1; -// line 818 "Parser.rl" +// line 821 "Parser.rl" public IRubyObject parseImplemetation() { @@ -2173,16 +2176,16 @@ ParserResult res = new ParserResult(); -// line 2177 "Parser.java" +// line 2180 "Parser.java" { cs = JSON_start; } -// line 827 "Parser.rl" +// line 830 "Parser.rl" p = byteList.begin(); pe = p + byteList.length(); -// line 2186 "Parser.java" +// line 2189 "Parser.java" { int _klen; int _trans = 0; @@ -2263,7 +2266,7 @@ switch ( _JSON_actions[_acts++] ) { case 0: -// line 804 "Parser.rl" +// line 807 "Parser.rl" { parseValue(res, p, pe); if (res.result == null) { @@ -2275,7 +2278,7 @@ } } break; -// line 2279 "Parser.java" +// line 2282 "Parser.java" } } } @@ -2295,7 +2298,7 @@ break; } } -// line 830 "Parser.rl" +// line 833 "Parser.rl" if (cs >= JSON_first_final && p == pe) { return result; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/java/src/json/ext/Parser.rl new/java/src/json/ext/Parser.rl --- old/java/src/json/ext/Parser.rl 2016-07-01 17:31:26.000000000 +0200 +++ new/java/src/json/ext/Parser.rl 2016-07-26 13:11:27.000000000 +0200 @@ -179,6 +179,9 @@ private RubyString convertEncoding(ThreadContext context, RubyString source) { RubyEncoding encoding = (RubyEncoding)source.encoding(context); if (encoding == info.ascii8bit.get()) { + if (source.isFrozen()) { + source = (RubyString) source.dup(); + } source.force_encoding(context, info.utf8.get()); } else { source = (RubyString) source.encode(context, info.utf8.get()); Files old/json.gemspec and new/json.gemspec differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/json_pure.gemspec new/json_pure.gemspec --- old/json_pure.gemspec 2016-07-01 17:31:26.000000000 +0200 +++ new/json_pure.gemspec 2016-07-26 13:11:27.000000000 +0200 @@ -1,14 +1,14 @@ # -*- encoding: utf-8 -*- -# stub: json_pure 2.0.1 ruby lib +# stub: json_pure 2.0.2 ruby lib Gem::Specification.new do |s| s.name = "json_pure".freeze - s.version = "2.0.1" + s.version = "2.0.2" s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version= s.require_paths = ["lib".freeze] s.authors = ["Florian Frank".freeze] - s.date = "2016-07-01" + s.date = "2016-07-26" s.description = "This is a JSON implementation in pure Ruby.".freeze s.email = "[email protected]".freeze s.extra_rdoc_files = ["README.md".freeze] @@ -16,6 +16,7 @@ s.homepage = "http://flori.github.com/json".freeze s.licenses = ["Ruby".freeze] s.rdoc_options = ["--title".freeze, "JSON implemention for ruby".freeze, "--main".freeze, "README.md".freeze] + s.required_ruby_version = Gem::Requirement.new("~> 2.0".freeze) s.rubygems_version = "2.6.4".freeze s.summary = "JSON Implementation for Ruby".freeze s.test_files = ["./tests/test_helper.rb".freeze] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/json/version.rb new/lib/json/version.rb --- old/lib/json/version.rb 2016-07-01 17:31:26.000000000 +0200 +++ new/lib/json/version.rb 2016-07-26 13:11:27.000000000 +0200 @@ -1,7 +1,7 @@ # frozen_string_literal: false module JSON # JSON version - VERSION = '2.0.1' + VERSION = '2.0.2' VERSION_ARRAY = VERSION.split(/\./).map { |x| x.to_i } # :nodoc: VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc: VERSION_MINOR = VERSION_ARRAY[1] # :nodoc: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2016-07-01 17:31:26.000000000 +0200 +++ new/metadata 2016-07-26 13:11:27.000000000 +0200 @@ -1,14 +1,14 @@ --- !ruby/object:Gem::Specification name: json version: !ruby/object:Gem::Version - version: 2.0.1 + version: 2.0.2 platform: ruby authors: - Florian Frank autorequire: bindir: bin cert_chain: [] -date: 2016-07-01 00:00:00.000000000 Z +date: 2016-07-26 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: rake diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tests/json_common_interface_test.rb new/tests/json_common_interface_test.rb --- old/tests/json_common_interface_test.rb 2016-07-01 17:31:26.000000000 +0200 +++ new/tests/json_common_interface_test.rb 2016-07-26 13:11:27.000000000 +0200 @@ -47,7 +47,7 @@ end def test_deep_const_get - assert_raises(ArgumentError) { JSON.deep_const_get('Nix::Da') } + assert_raise(ArgumentError) { JSON.deep_const_get('Nix::Da') } assert_equal File::SEPARATOR, JSON.deep_const_get('File::SEPARATOR') end @@ -93,8 +93,8 @@ def test_load_null assert_equal nil, JSON.load(nil, nil, :allow_blank => true) - assert_raises(TypeError) { JSON.load(nil, nil, :allow_blank => false) } - assert_raises(JSON::ParserError) { JSON.load('', nil, :allow_blank => false) } + assert_raise(TypeError) { JSON.load(nil, nil, :allow_blank => false) } + assert_raise(JSON::ParserError) { JSON.load('', nil, :allow_blank => false) } end def test_dump diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tests/json_parser_test.rb new/tests/json_parser_test.rb --- old/tests/json_parser_test.rb 2016-07-01 17:31:26.000000000 +0200 +++ new/tests/json_parser_test.rb 2016-07-26 13:11:27.000000000 +0200 @@ -40,6 +40,18 @@ assert_equal({ 'a' => 'b' }, parser.parse) end + def test_parse_values + assert_equal(nil, parse('null')) + assert_equal(false, parse('false')) + assert_equal(true, parse('true')) + assert_equal(-23, parse('-23')) + assert_equal(23, parse('23')) + assert_in_delta(0.23, parse('0.23'), 1e-2) + assert_in_delta(0.0, parse('0e0'), 1e-2) + assert_equal("", parse('""')) + assert_equal("foobar", parse('"foobar"')) + end + def test_parse_simple_arrays assert_equal([], parse('[]')) assert_equal([], parse(' [ ] ')) @@ -277,7 +289,6 @@ assert_equal data, parse(json) end - class SubArray < Array def <<(v) @shifted = true @@ -438,6 +449,13 @@ assert_equal obj, obj_again end + def test_parsing_frozen_ascii8bit_string + assert_equal( + { 'foo' => 'bar' }, + JSON('{ "foo": "bar" }'.force_encoding(Encoding::ASCII_8BIT).freeze) + ) + end + private def assert_equal_float(expected, actual, delta = 1e-2)
