oj 3.9.2 → 3.10.18
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/README.md +2 -2
- data/ext/oj/buf.h +2 -30
- data/ext/oj/cache8.h +1 -29
- data/ext/oj/circarray.c +4 -8
- data/ext/oj/circarray.h +1 -4
- data/ext/oj/code.c +3 -6
- data/ext/oj/code.h +1 -4
- data/ext/oj/compat.c +6 -9
- data/ext/oj/custom.c +8 -7
- data/ext/oj/dump.c +33 -26
- data/ext/oj/dump.h +1 -4
- data/ext/oj/dump_compat.c +9 -14
- data/ext/oj/dump_leaf.c +2 -5
- data/ext/oj/dump_object.c +19 -15
- data/ext/oj/dump_strict.c +7 -9
- data/ext/oj/encode.h +1 -29
- data/ext/oj/err.c +1 -4
- data/ext/oj/err.h +1 -29
- data/ext/oj/extconf.rb +5 -0
- data/ext/oj/fast.c +14 -42
- data/ext/oj/hash.c +4 -32
- data/ext/oj/hash.h +1 -29
- data/ext/oj/hash_test.c +1 -29
- data/ext/oj/mimic_json.c +28 -10
- data/ext/oj/object.c +4 -6
- data/ext/oj/odd.c +1 -4
- data/ext/oj/odd.h +1 -4
- data/ext/oj/oj.c +74 -38
- data/ext/oj/oj.h +9 -7
- data/ext/oj/parse.c +127 -52
- data/ext/oj/parse.h +4 -5
- data/ext/oj/rails.c +38 -8
- data/ext/oj/rails.h +1 -4
- data/ext/oj/reader.c +5 -8
- data/ext/oj/reader.h +2 -5
- data/ext/oj/resolve.c +1 -4
- data/ext/oj/resolve.h +1 -4
- data/ext/oj/rxclass.c +3 -6
- data/ext/oj/rxclass.h +1 -4
- data/ext/oj/saj.c +6 -9
- data/ext/oj/scp.c +1 -4
- data/ext/oj/sparse.c +31 -26
- data/ext/oj/stream_writer.c +4 -9
- data/ext/oj/strict.c +3 -6
- data/ext/oj/string_writer.c +1 -4
- data/ext/oj/trace.c +5 -8
- data/ext/oj/trace.h +1 -4
- data/ext/oj/util.c +1 -1
- data/ext/oj/util.h +1 -1
- data/ext/oj/val_stack.c +1 -29
- data/ext/oj/val_stack.h +1 -29
- data/ext/oj/wab.c +10 -13
- data/lib/oj/mimic.rb +45 -1
- data/lib/oj/version.rb +1 -1
- data/lib/oj.rb +0 -8
- data/pages/Modes.md +1 -1
- data/pages/Options.md +15 -11
- data/pages/Rails.md +60 -21
- data/test/activesupport5/abstract_unit.rb +45 -0
- data/test/activesupport5/decoding_test.rb +68 -60
- data/test/activesupport5/encoding_test.rb +111 -96
- data/test/activesupport5/encoding_test_cases.rb +33 -25
- data/test/activesupport5/test_helper.rb +43 -21
- data/test/activesupport5/time_zone_test_helpers.rb +18 -3
- data/test/activesupport6/abstract_unit.rb +44 -0
- data/test/activesupport6/decoding_test.rb +133 -0
- data/test/activesupport6/encoding_test.rb +507 -0
- data/test/activesupport6/encoding_test_cases.rb +98 -0
- data/test/activesupport6/test_common.rb +17 -0
- data/test/activesupport6/test_helper.rb +163 -0
- data/test/activesupport6/time_zone_test_helpers.rb +39 -0
- data/test/bar.rb +21 -11
- data/test/baz.rb +16 -0
- data/test/foo.rb +39 -8
- data/test/json_gem/json_common_interface_test.rb +8 -3
- data/test/prec.rb +23 -0
- data/test/sample_json.rb +1 -1
- data/test/test_compat.rb +14 -8
- data/test/test_custom.rb +36 -6
- data/test/test_integer_range.rb +1 -2
- data/test/test_object.rb +12 -3
- data/test/test_rails.rb +35 -0
- data/test/test_strict.rb +24 -1
- data/test/test_various.rb +42 -64
- data/test/tests.rb +1 -0
- metadata +29 -7
data/test/test_various.rb
CHANGED
@@ -96,70 +96,46 @@ class Juice < Minitest::Test
|
|
96
96
|
Oj.default_options = @default_options
|
97
97
|
end
|
98
98
|
|
99
|
-
=begin
|
100
|
-
# Depending on the order the values may have changed. The set_options sets
|
101
|
-
# should cover the function itself.
|
102
|
-
def test_get_options
|
103
|
-
opts = Oj.default_options()
|
104
|
-
assert_equal({ :indent=>0,
|
105
|
-
:second_precision=>9,
|
106
|
-
:circular=>false,
|
107
|
-
:class_cache=>true,
|
108
|
-
:auto_define=>false,
|
109
|
-
:symbol_keys=>false,
|
110
|
-
:bigdecimal_as_decimal=>true,
|
111
|
-
:use_to_json=>true,
|
112
|
-
:nilnil=>false,
|
113
|
-
:allow_gc=>true,
|
114
|
-
:quirks_mode=>true,
|
115
|
-
:allow_invalid_unicode=>false,
|
116
|
-
:float_precision=>15,
|
117
|
-
:mode=>:object,
|
118
|
-
:escape_mode=>:json,
|
119
|
-
:time_format=>:unix_zone,
|
120
|
-
:bigdecimal_load=>:auto,
|
121
|
-
:create_id=>'json_class'}, opts)
|
122
|
-
end
|
123
|
-
=end
|
124
99
|
def test_set_options
|
125
100
|
orig = Oj.default_options()
|
126
101
|
alt ={
|
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
|
-
:
|
102
|
+
indent: " - ",
|
103
|
+
second_precision: 5,
|
104
|
+
circular: true,
|
105
|
+
class_cache: false,
|
106
|
+
auto_define: true,
|
107
|
+
symbol_keys: true,
|
108
|
+
bigdecimal_as_decimal: false,
|
109
|
+
use_to_json: false,
|
110
|
+
use_to_hash: false,
|
111
|
+
use_as_json: false,
|
112
|
+
use_raw_json: false,
|
113
|
+
nilnil: true,
|
114
|
+
empty_string: true,
|
115
|
+
allow_gc: false,
|
116
|
+
quirks_mode: false,
|
117
|
+
allow_invalid_unicode: true,
|
118
|
+
float_precision: 13,
|
119
|
+
mode: :strict,
|
120
|
+
escape_mode: :ascii,
|
121
|
+
time_format: :unix_zone,
|
122
|
+
bigdecimal_load: :float,
|
123
|
+
create_id: 'classy',
|
124
|
+
create_additions: true,
|
125
|
+
space: 'z',
|
126
|
+
array_nl: 'a',
|
127
|
+
object_nl: 'o',
|
128
|
+
space_before: 'b',
|
129
|
+
nan: :huge,
|
130
|
+
hash_class: Hash,
|
131
|
+
omit_nil: false,
|
132
|
+
allow_nan: true,
|
133
|
+
integer_range: nil,
|
134
|
+
array_class: Array,
|
135
|
+
ignore: nil,
|
136
|
+
ignore_under: true,
|
137
|
+
trace: true,
|
138
|
+
safe: true,
|
163
139
|
}
|
164
140
|
Oj.default_options = alt
|
165
141
|
#keys = alt.keys
|
@@ -209,7 +185,6 @@ class Juice < Minitest::Test
|
|
209
185
|
n = Oj.load('-0.000012345678901234567')
|
210
186
|
assert_equal(BigDecimal, n.class)
|
211
187
|
assert_equal('-0.12345678901234567E-4', n.to_s.upcase)
|
212
|
-
|
213
188
|
end
|
214
189
|
|
215
190
|
=begin
|
@@ -425,8 +400,11 @@ class Juice < Minitest::Test
|
|
425
400
|
def test_time_years
|
426
401
|
(-2020..2020).each { |year|
|
427
402
|
s = "%04d-03-01T15:14:13Z" % [year]
|
428
|
-
json = Oj.dump(Time.parse(s), mode: :custom, time_format: :xmlschema)
|
403
|
+
json = Oj.dump(Time.parse(s), mode: :custom, time_format: :xmlschema, second_precision: -1)
|
429
404
|
assert_equal(s, json[1..-2])
|
405
|
+
|
406
|
+
json = Oj.dump(Time.parse(s), mode: :custom, time_format: :xmlschema, second_precision: 3)
|
407
|
+
assert_equal(s[0..-2] + '.000Z', json[1..-2])
|
430
408
|
}
|
431
409
|
end
|
432
410
|
|
@@ -692,7 +670,7 @@ class Juice < Minitest::Test
|
|
692
670
|
raise e
|
693
671
|
end
|
694
672
|
}
|
695
|
-
assert_equal('first[2].third', msg.split('(')[1].split(')')[0])
|
673
|
+
assert_equal('after first[2].third', msg.split('(')[1].split(')')[0])
|
696
674
|
end
|
697
675
|
|
698
676
|
def test_bad_bignum
|
data/test/tests.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oj
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.10.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Ohler
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-12-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake-compiler
|
@@ -172,12 +172,21 @@ files:
|
|
172
172
|
- test/activesupport4/decoding_test.rb
|
173
173
|
- test/activesupport4/encoding_test.rb
|
174
174
|
- test/activesupport4/test_helper.rb
|
175
|
+
- test/activesupport5/abstract_unit.rb
|
175
176
|
- test/activesupport5/decoding_test.rb
|
176
177
|
- test/activesupport5/encoding_test.rb
|
177
178
|
- test/activesupport5/encoding_test_cases.rb
|
178
179
|
- test/activesupport5/test_helper.rb
|
179
180
|
- test/activesupport5/time_zone_test_helpers.rb
|
181
|
+
- test/activesupport6/abstract_unit.rb
|
182
|
+
- test/activesupport6/decoding_test.rb
|
183
|
+
- test/activesupport6/encoding_test.rb
|
184
|
+
- test/activesupport6/encoding_test_cases.rb
|
185
|
+
- test/activesupport6/test_common.rb
|
186
|
+
- test/activesupport6/test_helper.rb
|
187
|
+
- test/activesupport6/time_zone_test_helpers.rb
|
180
188
|
- test/bar.rb
|
189
|
+
- test/baz.rb
|
181
190
|
- test/files.rb
|
182
191
|
- test/foo.rb
|
183
192
|
- test/helper.rb
|
@@ -210,6 +219,7 @@ files:
|
|
210
219
|
- test/perf_simple.rb
|
211
220
|
- test/perf_strict.rb
|
212
221
|
- test/perf_wab.rb
|
222
|
+
- test/prec.rb
|
213
223
|
- test/sample.rb
|
214
224
|
- test/sample/change.rb
|
215
225
|
- test/sample/dir.rb
|
@@ -234,6 +244,7 @@ files:
|
|
234
244
|
- test/test_integer_range.rb
|
235
245
|
- test/test_null.rb
|
236
246
|
- test/test_object.rb
|
247
|
+
- test/test_rails.rb
|
237
248
|
- test/test_saj.rb
|
238
249
|
- test/test_scp.rb
|
239
250
|
- test/test_strict.rb
|
@@ -254,7 +265,7 @@ metadata:
|
|
254
265
|
homepage_uri: http://www.ohler.com/oj/
|
255
266
|
source_code_uri: https://github.com/ohler55/oj
|
256
267
|
wiki_uri: https://github.com/ohler55/oj/wiki
|
257
|
-
post_install_message:
|
268
|
+
post_install_message:
|
258
269
|
rdoc_options:
|
259
270
|
- "--title"
|
260
271
|
- Oj
|
@@ -266,19 +277,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
266
277
|
requirements:
|
267
278
|
- - ">="
|
268
279
|
- !ruby/object:Gem::Version
|
269
|
-
version: '2.
|
280
|
+
version: '2.4'
|
270
281
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
271
282
|
requirements:
|
272
283
|
- - ">="
|
273
284
|
- !ruby/object:Gem::Version
|
274
285
|
version: '0'
|
275
286
|
requirements: []
|
276
|
-
rubygems_version: 3.
|
277
|
-
signing_key:
|
287
|
+
rubygems_version: 3.1.4
|
288
|
+
signing_key:
|
278
289
|
specification_version: 4
|
279
290
|
summary: A fast JSON parser and serializer.
|
280
291
|
test_files:
|
281
292
|
- test/foo.rb
|
293
|
+
- test/prec.rb
|
282
294
|
- test/test_integer_range.rb
|
283
295
|
- test/test_strict.rb
|
284
296
|
- test/perf_strict.rb
|
@@ -313,6 +325,7 @@ test_files:
|
|
313
325
|
- test/sample_json.rb
|
314
326
|
- test/activesupport5/encoding_test_cases.rb
|
315
327
|
- test/activesupport5/encoding_test.rb
|
328
|
+
- test/activesupport5/abstract_unit.rb
|
316
329
|
- test/activesupport5/time_zone_test_helpers.rb
|
317
330
|
- test/activesupport5/test_helper.rb
|
318
331
|
- test/activesupport5/decoding_test.rb
|
@@ -341,8 +354,10 @@ test_files:
|
|
341
354
|
- test/zoo.rb
|
342
355
|
- test/activerecord/result_test.rb
|
343
356
|
- test/_test_active_mimic.rb
|
357
|
+
- test/baz.rb
|
344
358
|
- test/tests_mimic_addition.rb
|
345
359
|
- test/test_writer.rb
|
360
|
+
- test/test_rails.rb
|
346
361
|
- test/perf.rb
|
347
362
|
- test/isolated/test_mimic_define.rb
|
348
363
|
- test/isolated/test_mimic_after.rb
|
@@ -357,3 +372,10 @@ test_files:
|
|
357
372
|
- test/test_gc.rb
|
358
373
|
- test/files.rb
|
359
374
|
- test/test_various.rb
|
375
|
+
- test/activesupport6/encoding_test_cases.rb
|
376
|
+
- test/activesupport6/encoding_test.rb
|
377
|
+
- test/activesupport6/abstract_unit.rb
|
378
|
+
- test/activesupport6/time_zone_test_helpers.rb
|
379
|
+
- test/activesupport6/test_helper.rb
|
380
|
+
- test/activesupport6/test_common.rb
|
381
|
+
- test/activesupport6/decoding_test.rb
|