oj 3.13.17 → 3.16.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +77 -0
- data/README.md +4 -2
- data/ext/oj/buf.h +7 -6
- data/ext/oj/cache.c +29 -26
- data/ext/oj/cache.h +3 -2
- data/ext/oj/cache8.c +10 -9
- data/ext/oj/circarray.c +7 -5
- data/ext/oj/circarray.h +2 -2
- data/ext/oj/code.c +5 -12
- data/ext/oj/code.h +2 -2
- data/ext/oj/compat.c +20 -60
- data/ext/oj/custom.c +44 -96
- data/ext/oj/debug.c +3 -9
- data/ext/oj/dump.c +69 -39
- data/ext/oj/dump.h +1 -4
- data/ext/oj/dump_compat.c +557 -592
- data/ext/oj/dump_leaf.c +3 -5
- data/ext/oj/dump_object.c +42 -48
- data/ext/oj/dump_strict.c +10 -22
- data/ext/oj/encoder.c +1 -1
- data/ext/oj/err.c +2 -13
- data/ext/oj/err.h +9 -12
- data/ext/oj/extconf.rb +16 -6
- data/ext/oj/fast.c +76 -106
- data/ext/oj/intern.c +63 -51
- data/ext/oj/intern.h +3 -7
- data/ext/oj/mem.c +318 -0
- data/ext/oj/mem.h +53 -0
- data/ext/oj/mimic_json.c +43 -30
- data/ext/oj/object.c +61 -70
- data/ext/oj/odd.c +8 -6
- data/ext/oj/odd.h +4 -4
- data/ext/oj/oj.c +243 -205
- data/ext/oj/oj.h +82 -78
- data/ext/oj/parse.c +123 -188
- data/ext/oj/parse.h +23 -24
- data/ext/oj/parser.c +103 -63
- data/ext/oj/parser.h +19 -9
- data/ext/oj/rails.c +68 -92
- data/ext/oj/reader.c +10 -15
- data/ext/oj/reader.h +4 -2
- data/ext/oj/resolve.c +3 -4
- data/ext/oj/rxclass.c +6 -5
- data/ext/oj/rxclass.h +1 -1
- data/ext/oj/saj.c +10 -9
- data/ext/oj/saj2.c +74 -92
- data/ext/oj/saj2.h +23 -0
- data/ext/oj/scp.c +3 -14
- data/ext/oj/sparse.c +22 -70
- data/ext/oj/stream_writer.c +43 -35
- data/ext/oj/strict.c +20 -52
- data/ext/oj/string_writer.c +60 -34
- data/ext/oj/trace.h +31 -4
- data/ext/oj/usual.c +125 -150
- data/ext/oj/usual.h +69 -0
- data/ext/oj/util.h +1 -1
- data/ext/oj/val_stack.c +14 -3
- data/ext/oj/val_stack.h +8 -7
- data/ext/oj/wab.c +25 -57
- data/lib/oj/active_support_helper.rb +1 -3
- data/lib/oj/bag.rb +7 -1
- data/lib/oj/easy_hash.rb +4 -5
- data/lib/oj/error.rb +0 -1
- data/lib/oj/json.rb +162 -150
- data/lib/oj/mimic.rb +6 -2
- data/lib/oj/state.rb +9 -6
- data/lib/oj/version.rb +1 -2
- data/lib/oj.rb +2 -0
- data/pages/Compatibility.md +1 -1
- data/pages/InstallOptions.md +20 -0
- data/pages/Options.md +10 -0
- data/test/_test_active.rb +8 -9
- data/test/_test_active_mimic.rb +7 -8
- data/test/_test_mimic_rails.rb +17 -20
- data/test/activerecord/result_test.rb +5 -6
- data/test/files.rb +15 -15
- data/test/foo.rb +9 -72
- data/test/helper.rb +11 -8
- data/test/isolated/shared.rb +3 -2
- data/test/json_gem/json_addition_test.rb +2 -2
- data/test/json_gem/json_common_interface_test.rb +8 -6
- data/test/json_gem/json_encoding_test.rb +0 -0
- data/test/json_gem/json_ext_parser_test.rb +1 -0
- data/test/json_gem/json_fixtures_test.rb +3 -2
- data/test/json_gem/json_generator_test.rb +53 -37
- data/test/json_gem/json_generic_object_test.rb +11 -11
- data/test/json_gem/json_parser_test.rb +47 -47
- data/test/json_gem/json_string_matching_test.rb +9 -9
- data/test/json_gem/test_helper.rb +7 -3
- data/test/mem.rb +13 -12
- data/test/perf.rb +21 -26
- data/test/perf_compat.rb +31 -33
- data/test/perf_dump.rb +28 -28
- data/test/perf_fast.rb +80 -82
- data/test/perf_file.rb +27 -29
- data/test/perf_object.rb +65 -69
- data/test/perf_once.rb +12 -11
- data/test/perf_parser.rb +42 -48
- data/test/perf_saj.rb +46 -54
- data/test/perf_scp.rb +57 -69
- data/test/perf_simple.rb +41 -39
- data/test/perf_strict.rb +68 -70
- data/test/perf_wab.rb +67 -69
- data/test/prec.rb +5 -5
- data/test/sample/change.rb +0 -1
- data/test/sample/dir.rb +0 -1
- data/test/sample/doc.rb +0 -1
- data/test/sample/file.rb +0 -1
- data/test/sample/group.rb +0 -1
- data/test/sample/hasprops.rb +0 -1
- data/test/sample/layer.rb +0 -1
- data/test/sample/rect.rb +0 -1
- data/test/sample/shape.rb +0 -1
- data/test/sample/text.rb +0 -1
- data/test/sample.rb +16 -16
- data/test/sample_json.rb +8 -8
- data/test/test_compat.rb +80 -53
- data/test/test_custom.rb +73 -51
- data/test/test_debian.rb +7 -10
- data/test/test_fast.rb +86 -90
- data/test/test_file.rb +28 -35
- data/test/test_gc.rb +16 -5
- data/test/test_generate.rb +5 -5
- data/test/test_hash.rb +4 -4
- data/test/test_integer_range.rb +9 -9
- data/test/test_null.rb +20 -20
- data/test/test_object.rb +94 -96
- data/test/test_parser.rb +6 -22
- data/test/test_parser_debug.rb +27 -0
- data/test/test_parser_saj.rb +61 -22
- data/test/test_parser_usual.rb +16 -6
- data/test/test_rails.rb +2 -2
- data/test/test_saj.rb +10 -8
- data/test/test_scp.rb +37 -39
- data/test/test_strict.rb +40 -32
- data/test/test_various.rb +148 -100
- data/test/test_wab.rb +48 -44
- data/test/test_writer.rb +47 -47
- data/test/tests.rb +13 -4
- data/test/tests_mimic.rb +12 -3
- data/test/tests_mimic_addition.rb +12 -3
- metadata +36 -27
- data/test/activesupport4/decoding_test.rb +0 -108
- data/test/activesupport4/encoding_test.rb +0 -531
- data/test/activesupport4/test_helper.rb +0 -41
- data/test/activesupport5/abstract_unit.rb +0 -45
- data/test/activesupport5/decoding_test.rb +0 -133
- data/test/activesupport5/encoding_test.rb +0 -500
- data/test/activesupport5/encoding_test_cases.rb +0 -98
- data/test/activesupport5/test_helper.rb +0 -72
- data/test/activesupport5/time_zone_test_helpers.rb +0 -39
- data/test/bar.rb +0 -11
- data/test/baz.rb +0 -16
- data/test/bug.rb +0 -16
- data/test/zoo.rb +0 -13
metadata
CHANGED
@@ -1,35 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oj
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.16.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Ohler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: bigdecimal
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0
|
20
|
-
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: '2.0'
|
23
|
-
type: :development
|
19
|
+
version: '3.0'
|
20
|
+
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
24
|
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: '0
|
30
|
-
- - "<"
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: '2.0'
|
26
|
+
version: '3.0'
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
28
|
name: minitest
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,6 +38,26 @@ dependencies:
|
|
44
38
|
- - "~>"
|
45
39
|
- !ruby/object:Gem::Version
|
46
40
|
version: '5'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake-compiler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.9'
|
48
|
+
- - "<"
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '2.0'
|
51
|
+
type: :development
|
52
|
+
prerelease: false
|
53
|
+
version_requirements: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '0.9'
|
58
|
+
- - "<"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '2.0'
|
47
61
|
- !ruby/object:Gem::Dependency
|
48
62
|
name: test-unit
|
49
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,6 +86,7 @@ extra_rdoc_files:
|
|
72
86
|
- pages/Compatibility.md
|
73
87
|
- pages/Custom.md
|
74
88
|
- pages/Encoding.md
|
89
|
+
- pages/InstallOptions.md
|
75
90
|
- pages/JsonGem.md
|
76
91
|
- pages/Modes.md
|
77
92
|
- pages/Options.md
|
@@ -110,6 +125,8 @@ files:
|
|
110
125
|
- ext/oj/fast.c
|
111
126
|
- ext/oj/intern.c
|
112
127
|
- ext/oj/intern.h
|
128
|
+
- ext/oj/mem.c
|
129
|
+
- ext/oj/mem.h
|
113
130
|
- ext/oj/mimic_json.c
|
114
131
|
- ext/oj/object.c
|
115
132
|
- ext/oj/odd.c
|
@@ -130,6 +147,7 @@ files:
|
|
130
147
|
- ext/oj/rxclass.h
|
131
148
|
- ext/oj/saj.c
|
132
149
|
- ext/oj/saj2.c
|
150
|
+
- ext/oj/saj2.h
|
133
151
|
- ext/oj/scp.c
|
134
152
|
- ext/oj/sparse.c
|
135
153
|
- ext/oj/stream_writer.c
|
@@ -138,6 +156,7 @@ files:
|
|
138
156
|
- ext/oj/trace.c
|
139
157
|
- ext/oj/trace.h
|
140
158
|
- ext/oj/usual.c
|
159
|
+
- ext/oj/usual.h
|
141
160
|
- ext/oj/util.c
|
142
161
|
- ext/oj/util.h
|
143
162
|
- ext/oj/val_stack.c
|
@@ -159,6 +178,7 @@ files:
|
|
159
178
|
- pages/Compatibility.md
|
160
179
|
- pages/Custom.md
|
161
180
|
- pages/Encoding.md
|
181
|
+
- pages/InstallOptions.md
|
162
182
|
- pages/JsonGem.md
|
163
183
|
- pages/Modes.md
|
164
184
|
- pages/Options.md
|
@@ -170,15 +190,6 @@ files:
|
|
170
190
|
- test/_test_active_mimic.rb
|
171
191
|
- test/_test_mimic_rails.rb
|
172
192
|
- test/activerecord/result_test.rb
|
173
|
-
- test/activesupport4/decoding_test.rb
|
174
|
-
- test/activesupport4/encoding_test.rb
|
175
|
-
- test/activesupport4/test_helper.rb
|
176
|
-
- test/activesupport5/abstract_unit.rb
|
177
|
-
- test/activesupport5/decoding_test.rb
|
178
|
-
- test/activesupport5/encoding_test.rb
|
179
|
-
- test/activesupport5/encoding_test_cases.rb
|
180
|
-
- test/activesupport5/test_helper.rb
|
181
|
-
- test/activesupport5/time_zone_test_helpers.rb
|
182
193
|
- test/activesupport6/abstract_unit.rb
|
183
194
|
- test/activesupport6/decoding_test.rb
|
184
195
|
- test/activesupport6/encoding_test.rb
|
@@ -191,9 +202,6 @@ files:
|
|
191
202
|
- test/activesupport7/encoding_test.rb
|
192
203
|
- test/activesupport7/encoding_test_cases.rb
|
193
204
|
- test/activesupport7/time_zone_test_helpers.rb
|
194
|
-
- test/bar.rb
|
195
|
-
- test/baz.rb
|
196
|
-
- test/bug.rb
|
197
205
|
- test/files.rb
|
198
206
|
- test/foo.rb
|
199
207
|
- test/helper.rb
|
@@ -257,6 +265,7 @@ files:
|
|
257
265
|
- test/test_null.rb
|
258
266
|
- test/test_object.rb
|
259
267
|
- test/test_parser.rb
|
268
|
+
- test/test_parser_debug.rb
|
260
269
|
- test/test_parser_saj.rb
|
261
270
|
- test/test_parser_usual.rb
|
262
271
|
- test/test_rails.rb
|
@@ -269,7 +278,6 @@ files:
|
|
269
278
|
- test/tests.rb
|
270
279
|
- test/tests_mimic.rb
|
271
280
|
- test/tests_mimic_addition.rb
|
272
|
-
- test/zoo.rb
|
273
281
|
homepage: http://www.ohler.com/oj
|
274
282
|
licenses:
|
275
283
|
- MIT
|
@@ -280,6 +288,7 @@ metadata:
|
|
280
288
|
homepage_uri: http://www.ohler.com/oj/
|
281
289
|
source_code_uri: https://github.com/ohler55/oj
|
282
290
|
wiki_uri: https://github.com/ohler55/oj/wiki
|
291
|
+
rubygems_mfa_required: 'true'
|
283
292
|
post_install_message:
|
284
293
|
rdoc_options:
|
285
294
|
- "--title"
|
@@ -292,14 +301,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
292
301
|
requirements:
|
293
302
|
- - ">="
|
294
303
|
- !ruby/object:Gem::Version
|
295
|
-
version: '2.
|
304
|
+
version: '2.7'
|
296
305
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
297
306
|
requirements:
|
298
307
|
- - ">="
|
299
308
|
- !ruby/object:Gem::Version
|
300
309
|
version: '0'
|
301
310
|
requirements: []
|
302
|
-
rubygems_version: 3.
|
311
|
+
rubygems_version: 3.4.10
|
303
312
|
signing_key:
|
304
313
|
specification_version: 4
|
305
314
|
summary: A fast JSON parser and serializer.
|
@@ -1,108 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'activesupport4/test_helper'
|
3
|
-
require 'active_support/json'
|
4
|
-
require 'active_support/time'
|
5
|
-
|
6
|
-
class TestJSONDecoding < ActiveSupport::TestCase
|
7
|
-
class Foo
|
8
|
-
def self.json_create(object)
|
9
|
-
"Foo"
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
TESTS = {
|
14
|
-
%q({"returnTo":{"\/categories":"\/"}}) => {"returnTo" => {"/categories" => "/"}},
|
15
|
-
%q({"return\\"To\\":":{"\/categories":"\/"}}) => {"return\"To\":" => {"/categories" => "/"}},
|
16
|
-
%q({"returnTo":{"\/categories":1}}) => {"returnTo" => {"/categories" => 1}},
|
17
|
-
%({"returnTo":[1,"a"]}) => {"returnTo" => [1, "a"]},
|
18
|
-
%({"returnTo":[1,"\\"a\\",", "b"]}) => {"returnTo" => [1, "\"a\",", "b"]},
|
19
|
-
%({"a": "'", "b": "5,000"}) => {"a" => "'", "b" => "5,000"},
|
20
|
-
%({"a": "a's, b's and c's", "b": "5,000"}) => {"a" => "a's, b's and c's", "b" => "5,000"},
|
21
|
-
# multibyte
|
22
|
-
%({"matzue": "松江", "asakusa": "浅草"}) => {"matzue" => "松江", "asakusa" => "浅草"},
|
23
|
-
%({"a": "2007-01-01"}) => {'a' => Date.new(2007, 1, 1)},
|
24
|
-
%({"a": "2007-01-01 01:12:34 Z"}) => {'a' => Time.utc(2007, 1, 1, 1, 12, 34)},
|
25
|
-
%(["2007-01-01 01:12:34 Z"]) => [Time.utc(2007, 1, 1, 1, 12, 34)],
|
26
|
-
%(["2007-01-01 01:12:34 Z", "2007-01-01 01:12:35 Z"]) => [Time.utc(2007, 1, 1, 1, 12, 34), Time.utc(2007, 1, 1, 1, 12, 35)],
|
27
|
-
# no time zone
|
28
|
-
%({"a": "2007-01-01 01:12:34"}) => {'a' => "2007-01-01 01:12:34"},
|
29
|
-
# invalid date
|
30
|
-
%({"a": "1089-10-40"}) => {'a' => "1089-10-40"},
|
31
|
-
# xmlschema date notation
|
32
|
-
%({"a": "2009-08-10T19:01:02Z"}) => {'a' => Time.utc(2009, 8, 10, 19, 1, 2)},
|
33
|
-
%({"a": "2009-08-10T19:01:02+02:00"}) => {'a' => Time.utc(2009, 8, 10, 17, 1, 2)},
|
34
|
-
%({"a": "2009-08-10T19:01:02-05:00"}) => {'a' => Time.utc(2009, 8, 11, 00, 1, 2)},
|
35
|
-
# needs to be *exact*
|
36
|
-
%({"a": " 2007-01-01 01:12:34 Z "}) => {'a' => " 2007-01-01 01:12:34 Z "},
|
37
|
-
%({"a": "2007-01-01 : it's your birthday"}) => {'a' => "2007-01-01 : it's your birthday"},
|
38
|
-
%([]) => [],
|
39
|
-
%({}) => {},
|
40
|
-
%({"a":1}) => {"a" => 1},
|
41
|
-
%({"a": ""}) => {"a" => ""},
|
42
|
-
%({"a":"\\""}) => {"a" => "\""},
|
43
|
-
%({"a": null}) => {"a" => nil},
|
44
|
-
%({"a": true}) => {"a" => true},
|
45
|
-
%({"a": false}) => {"a" => false},
|
46
|
-
%q({"bad":"\\\\","trailing":""}) => {"bad" => "\\", "trailing" => ""},
|
47
|
-
%q({"a": "http:\/\/test.host\/posts\/1"}) => {"a" => "http://test.host/posts/1"},
|
48
|
-
%q({"a": "\u003cunicode\u0020escape\u003e"}) => {"a" => "<unicode escape>"},
|
49
|
-
%q({"a": "\\\\u0020skip double backslashes"}) => {"a" => "\\u0020skip double backslashes"},
|
50
|
-
%q({"a": "\u003cbr /\u003e"}) => {'a' => "<br />"},
|
51
|
-
%q({"b":["\u003ci\u003e","\u003cb\u003e","\u003cu\u003e"]}) => {'b' => ["<i>","<b>","<u>"]},
|
52
|
-
# test combination of dates and escaped or unicode encoded data in arrays
|
53
|
-
%q([{"d":"1970-01-01", "s":"\u0020escape"},{"d":"1970-01-01", "s":"\u0020escape"}]) =>
|
54
|
-
[{'d' => Date.new(1970, 1, 1), 's' => ' escape'},{'d' => Date.new(1970, 1, 1), 's' => ' escape'}],
|
55
|
-
%q([{"d":"1970-01-01","s":"http:\/\/example.com"},{"d":"1970-01-01","s":"http:\/\/example.com"}]) =>
|
56
|
-
[{'d' => Date.new(1970, 1, 1), 's' => 'http://example.com'},
|
57
|
-
{'d' => Date.new(1970, 1, 1), 's' => 'http://example.com'}],
|
58
|
-
# tests escaping of "\n" char with Yaml backend
|
59
|
-
%q({"a":"\n"}) => {"a"=>"\n"},
|
60
|
-
%q({"a":"\u000a"}) => {"a"=>"\n"},
|
61
|
-
%q({"a":"Line1\u000aLine2"}) => {"a"=>"Line1\nLine2"},
|
62
|
-
# prevent json unmarshalling
|
63
|
-
%q({"json_class":"TestJSONDecoding::Foo"}) => {"json_class"=>"TestJSONDecoding::Foo"},
|
64
|
-
# json "fragments" - these are invalid JSON, but ActionPack relies on this
|
65
|
-
%q("a string") => "a string",
|
66
|
-
%q(1.1) => 1.1,
|
67
|
-
%q(1) => 1,
|
68
|
-
%q(-1) => -1,
|
69
|
-
%q(true) => true,
|
70
|
-
%q(false) => false,
|
71
|
-
%q(null) => nil
|
72
|
-
}
|
73
|
-
|
74
|
-
TESTS.each_with_index do |(json, expected), index|
|
75
|
-
test "json decodes #{index}" do
|
76
|
-
prev = ActiveSupport.parse_json_times
|
77
|
-
ActiveSupport.parse_json_times = true
|
78
|
-
silence_warnings do
|
79
|
-
if expected.nil?
|
80
|
-
assert_nil ActiveSupport::JSON.decode(json), "JSON decoding failed for #{json}"
|
81
|
-
else
|
82
|
-
assert_equal expected, ActiveSupport::JSON.decode(json), "JSON decoding failed for #{json}"
|
83
|
-
end
|
84
|
-
end
|
85
|
-
ActiveSupport.parse_json_times = prev
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
test "json decodes time json with time parsing disabled" do
|
90
|
-
prev = ActiveSupport.parse_json_times
|
91
|
-
ActiveSupport.parse_json_times = false
|
92
|
-
expected = {"a" => "2007-01-01 01:12:34 Z"}
|
93
|
-
assert_equal expected, ActiveSupport::JSON.decode(%({"a": "2007-01-01 01:12:34 Z"}))
|
94
|
-
ActiveSupport.parse_json_times = prev
|
95
|
-
end
|
96
|
-
|
97
|
-
def test_failed_json_decoding
|
98
|
-
assert_raise(ActiveSupport::JSON.parse_error) { ActiveSupport::JSON.decode(%(undefined)) }
|
99
|
-
assert_raise(ActiveSupport::JSON.parse_error) { ActiveSupport::JSON.decode(%({a: 1})) }
|
100
|
-
assert_raise(ActiveSupport::JSON.parse_error) { ActiveSupport::JSON.decode(%({: 1})) }
|
101
|
-
assert_raise(ActiveSupport::JSON.parse_error) { ActiveSupport::JSON.decode(%()) }
|
102
|
-
end
|
103
|
-
|
104
|
-
def test_cannot_pass_unsupported_options
|
105
|
-
assert_raise(ArgumentError) { ActiveSupport::JSON.decode("", create_additions: true) }
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|