oj 3.13.19 → 3.13.20
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 +4 -0
- data/ext/oj/extconf.rb +2 -14
- data/ext/oj/parse.c +18 -54
- data/lib/oj/version.rb +1 -1
- data/test/json_gem/json_parser_test.rb +2 -0
- data/test/test_custom.rb +12 -0
- data/test/test_file.rb +7 -2
- data/test/test_gc.rb +13 -0
- data/test/test_integer_range.rb +6 -0
- data/test/test_object.rb +38 -0
- data/test/test_scp.rb +4 -4
- data/test/test_strict.rb +2 -0
- data/test/test_wab.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 958a558e09c25d5de9548af67dff6586686def4a9073b3cee6ba8403930eda48
|
4
|
+
data.tar.gz: 2f928e9e849ca695d03ad9a396ec7f2df3508b99d10baa11a8cb538a7b3a0e52
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 758bb300ed853d161750d100a8fbdd755e37ae8e15ae94f1e7a4cbd613c787002758d4fc5834fd47a7ef8fb78446208f896afee31c0bc023bcdeb381aba1f98c
|
7
|
+
data.tar.gz: 54127873544ca146a61d7ca4012ff9d2eb4b83bdcbb3f06eea092d4e4ad517c453196a59edc2743b42736ab276e0eb96889045e0d3f2200dcbaf4a2b79353db3
|
data/CHANGELOG.md
CHANGED
data/ext/oj/extconf.rb
CHANGED
@@ -34,21 +34,9 @@ have_func('rb_hash_bulk_insert', 'ruby.h') unless '2' == version[0] && '6' == ve
|
|
34
34
|
|
35
35
|
dflags['OJ_DEBUG'] = true unless ENV['OJ_DEBUG'].nil?
|
36
36
|
|
37
|
-
|
38
|
-
#include <string.h>
|
39
|
-
#include <nmmintrin.h>
|
40
|
-
int main(int argc, char **argv) {
|
41
|
-
const char *str = "hello ";
|
42
|
-
const char chars[16] = "\x00\\\"";
|
43
|
-
const __m128i terminate = _mm_loadu_si128((const __m128i *)&chars[0]);
|
44
|
-
const __m128i string = _mm_loadu_si128((const __m128i *)str);
|
45
|
-
int r = _mm_cmpestri(terminate, 3, string, 16, _SIDD_UBYTE_OPS | _SIDD_CMP_EQUAL_ANY | _SIDD_LEAST_SIGNIFICANT);
|
46
|
-
return r == 16 ? 0 : 1;
|
47
|
-
}
|
48
|
-
SRC
|
49
|
-
|
50
|
-
if try_run(src, '-msse4.2')
|
37
|
+
if with_config('--with-sse42')
|
51
38
|
$CPPFLAGS += ' -msse4.2'
|
39
|
+
dflags['OJ_USE_SSE4_2'] = 1
|
52
40
|
end
|
53
41
|
|
54
42
|
dflags.each do |k,v|
|
data/ext/oj/parse.c
CHANGED
@@ -192,32 +192,7 @@ static inline const char *scan_string_noSIMD(const char *str, const char *end) {
|
|
192
192
|
return str;
|
193
193
|
}
|
194
194
|
|
195
|
-
|
196
|
-
// https://github.com/tensorflow/tensorflow/blob/5dcfc51118817f27fad5246812d83e5dccdc5f72/tensorflow/core/lib/hash/crc32c_accelerate.cc#L21-L38
|
197
|
-
#ifdef __SSE4_2__
|
198
|
-
#if defined(__x86_64__) && defined(__GNUC__) && \
|
199
|
-
(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8))
|
200
|
-
#define USE_SSE_DETECT 1
|
201
|
-
#elif defined(__x86_64__) && defined(__clang__)
|
202
|
-
#if __has_builtin(__builtin_cpu_supports)
|
203
|
-
#define USE_SSE_DETECT 1
|
204
|
-
#endif
|
205
|
-
#endif
|
206
|
-
#endif /* __SSE4_2__ */
|
207
|
-
|
208
|
-
// This version of Apple clang has a bug:
|
209
|
-
// https://llvm.org/bugs/show_bug.cgi?id=25510
|
210
|
-
#if defined(__APPLE__) && (__clang_major__ <= 8)
|
211
|
-
#undef USE_SSE_DETECT
|
212
|
-
#endif
|
213
|
-
|
214
|
-
#if defined(TRUFFLERUBY)
|
215
|
-
#undef USE_SSE_DETECT
|
216
|
-
#endif
|
217
|
-
|
218
|
-
#ifdef USE_SSE_DETECT
|
219
|
-
#include <nmmintrin.h>
|
220
|
-
|
195
|
+
#ifdef OJ_USE_SSE4_2
|
221
196
|
static inline const char *scan_string_SIMD(const char *str, const char *end) {
|
222
197
|
static const char chars[16] = "\x00\\\"";
|
223
198
|
const __m128i terminate = _mm_loadu_si128((const __m128i *)&chars[0]);
|
@@ -236,23 +211,12 @@ static inline const char *scan_string_SIMD(const char *str, const char *end) {
|
|
236
211
|
}
|
237
212
|
#endif
|
238
213
|
|
239
|
-
static bool cpu_supports_sse42(void) {
|
240
|
-
#if USE_SSE_DETECT
|
241
|
-
__builtin_cpu_init();
|
242
|
-
return (__builtin_cpu_supports("sse4.2"));
|
243
|
-
#else
|
244
|
-
return false;
|
245
|
-
#endif
|
246
|
-
}
|
247
|
-
|
248
214
|
static const char *(*scan_func) (const char *str, const char *end) = scan_string_noSIMD;
|
249
215
|
|
250
216
|
void oj_scanner_init(void) {
|
251
|
-
|
252
|
-
|
253
|
-
scan_func = scan_string_SIMD;
|
217
|
+
#ifdef OJ_USE_SSE4_2
|
218
|
+
scan_func = scan_string_SIMD;
|
254
219
|
#endif
|
255
|
-
}
|
256
220
|
}
|
257
221
|
|
258
222
|
// entered at /
|
@@ -667,7 +631,7 @@ static void read_num(ParseInfo pi) {
|
|
667
631
|
}
|
668
632
|
|
669
633
|
static void array_start(ParseInfo pi) {
|
670
|
-
|
634
|
+
VALUE v = pi->start_array(pi);
|
671
635
|
|
672
636
|
stack_push(&pi->stack, v, NEXT_ARRAY_NEW);
|
673
637
|
}
|
@@ -691,13 +655,13 @@ static void array_end(ParseInfo pi) {
|
|
691
655
|
}
|
692
656
|
|
693
657
|
static void hash_start(ParseInfo pi) {
|
694
|
-
|
658
|
+
VALUE v = pi->start_hash(pi);
|
695
659
|
|
696
660
|
stack_push(&pi->stack, v, NEXT_HASH_NEW);
|
697
661
|
}
|
698
662
|
|
699
663
|
static void hash_end(ParseInfo pi) {
|
700
|
-
|
664
|
+
Val hash = stack_peek(&pi->stack);
|
701
665
|
|
702
666
|
// leave hash on stack until just before
|
703
667
|
if (0 == hash) {
|
@@ -884,7 +848,7 @@ static long double exp_plus[] = {
|
|
884
848
|
|
885
849
|
VALUE
|
886
850
|
oj_num_as_value(NumInfo ni) {
|
887
|
-
|
851
|
+
VALUE rnum = Qnil;
|
888
852
|
|
889
853
|
if (ni->infinity) {
|
890
854
|
if (ni->neg) {
|
@@ -919,7 +883,7 @@ oj_num_as_value(NumInfo ni) {
|
|
919
883
|
}
|
920
884
|
} else { // decimal
|
921
885
|
if (ni->big) {
|
922
|
-
|
886
|
+
VALUE bd = rb_str_new(ni->str, ni->len);
|
923
887
|
|
924
888
|
rnum = rb_rescue2(parse_big_decimal, bd, rescue_big_decimal, bd, rb_eException, 0);
|
925
889
|
if (ni->no_big) {
|
@@ -947,7 +911,7 @@ oj_num_as_value(NumInfo ni) {
|
|
947
911
|
}
|
948
912
|
rnum = rb_float_new((double)ld);
|
949
913
|
} else if (RubyDec == ni->bigdec_load) {
|
950
|
-
|
914
|
+
VALUE sv = rb_str_new(ni->str, ni->len);
|
951
915
|
|
952
916
|
rnum = rb_funcall(sv, rb_intern("to_f"), 0);
|
953
917
|
} else {
|
@@ -1042,7 +1006,7 @@ static VALUE protect_parse(VALUE pip) {
|
|
1042
1006
|
|
1043
1007
|
extern int oj_utf8_index;
|
1044
1008
|
|
1045
|
-
static void oj_pi_set_input_str(ParseInfo pi,
|
1009
|
+
static void oj_pi_set_input_str(ParseInfo pi, VALUE *inputp) {
|
1046
1010
|
int idx = RB_ENCODING_GET(*inputp);
|
1047
1011
|
|
1048
1012
|
if (oj_utf8_encoding_index != idx) {
|
@@ -1055,12 +1019,12 @@ static void oj_pi_set_input_str(ParseInfo pi, volatile VALUE *inputp) {
|
|
1055
1019
|
|
1056
1020
|
VALUE
|
1057
1021
|
oj_pi_parse(int argc, VALUE *argv, ParseInfo pi, char *json, size_t len, int yieldOk) {
|
1058
|
-
char *
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
int
|
1063
|
-
int
|
1022
|
+
char * buf = 0;
|
1023
|
+
VALUE input;
|
1024
|
+
VALUE wrapped_stack;
|
1025
|
+
VALUE result = Qnil;
|
1026
|
+
int line = 0;
|
1027
|
+
int free_json = 0;
|
1064
1028
|
|
1065
1029
|
if (argc < 1) {
|
1066
1030
|
rb_raise(rb_eArgError, "Wrong number of arguments to parse.");
|
@@ -1096,8 +1060,8 @@ oj_pi_parse(int argc, VALUE *argv, ParseInfo pi, char *json, size_t len, int yie
|
|
1096
1060
|
rb_raise(rb_eTypeError, "Nil is not a valid JSON source.");
|
1097
1061
|
}
|
1098
1062
|
} else {
|
1099
|
-
VALUE
|
1100
|
-
|
1063
|
+
VALUE clas = rb_obj_class(input);
|
1064
|
+
VALUE s;
|
1101
1065
|
|
1102
1066
|
if (oj_stringio_class == clas) {
|
1103
1067
|
s = rb_funcall2(input, oj_string_id, 0, 0);
|
data/lib/oj/version.rb
CHANGED
@@ -24,6 +24,8 @@ class JSONParserTest < Test::Unit::TestCase
|
|
24
24
|
end if defined?(Encoding::UTF_16)
|
25
25
|
|
26
26
|
def test_error_message_encoding
|
27
|
+
omit 'TruffleRuby causes NameError(<uninitialized constant JSON::Ext>)' if RUBY_ENGINE == 'truffleruby'
|
28
|
+
|
27
29
|
bug10705 = '[ruby-core:67386] [Bug #10705]'
|
28
30
|
json = ".\"\xE2\x88\x9A\"".force_encoding(Encoding::UTF_8)
|
29
31
|
e = assert_raise(JSON::ParserError) {
|
data/test/test_custom.rb
CHANGED
@@ -200,6 +200,8 @@ class CustomJuice < Minitest::Test
|
|
200
200
|
end
|
201
201
|
|
202
202
|
def test_deep_nest
|
203
|
+
skip 'TruffleRuby causes SEGV' if RUBY_ENGINE == 'truffleruby'
|
204
|
+
|
203
205
|
begin
|
204
206
|
n = 10000
|
205
207
|
Oj.strict_load('[' * n + ']' * n)
|
@@ -258,6 +260,8 @@ class CustomJuice < Minitest::Test
|
|
258
260
|
end
|
259
261
|
|
260
262
|
def test_object
|
263
|
+
skip 'TruffleRuby fails this spec with `RuntimeError: rb_ivar_foreach not implemented`' if RUBY_ENGINE == 'truffleruby'
|
264
|
+
|
261
265
|
obj = Jeez.new(true, 58)
|
262
266
|
json = Oj.dump(obj, create_id: "^o", use_to_json: false, use_as_json: false, use_to_hash: false)
|
263
267
|
assert_equal(%|{"x":true,"y":58,"_z":"true"}|, json)
|
@@ -403,11 +407,15 @@ class CustomJuice < Minitest::Test
|
|
403
407
|
end
|
404
408
|
|
405
409
|
def test_range
|
410
|
+
skip 'TruffleRuby fails this spec' if RUBY_ENGINE == 'truffleruby'
|
411
|
+
|
406
412
|
obj = 3..8
|
407
413
|
dump_and_load(obj, false, :create_id => "^o", :create_additions => true)
|
408
414
|
end
|
409
415
|
|
410
416
|
def test_date
|
417
|
+
skip 'TruffleRuby causes SEGV' if RUBY_ENGINE == 'truffleruby'
|
418
|
+
|
411
419
|
obj = Date.new(2017, 1, 5)
|
412
420
|
dump_and_load(obj, false, :create_id => "^o", :create_additions => true)
|
413
421
|
end
|
@@ -437,6 +445,8 @@ class CustomJuice < Minitest::Test
|
|
437
445
|
end
|
438
446
|
|
439
447
|
def test_datetime
|
448
|
+
skip 'TruffleRuby causes SEGV' if RUBY_ENGINE == 'truffleruby'
|
449
|
+
|
440
450
|
obj = DateTime.new(2017, 1, 5, 10, 20, 30)
|
441
451
|
dump_and_load(obj, false, :create_id => "^o", :create_additions => true)
|
442
452
|
end
|
@@ -480,6 +490,8 @@ class CustomJuice < Minitest::Test
|
|
480
490
|
end
|
481
491
|
|
482
492
|
def test_time
|
493
|
+
skip 'TruffleRuby fails this spec' if RUBY_ENGINE == 'truffleruby'
|
494
|
+
|
483
495
|
obj = Time.now()
|
484
496
|
dump_load_dump(obj, false, :time_format => :unix, :create_id => "^o", :create_additions => true)
|
485
497
|
dump_load_dump(obj, false, :time_format => :unix_zone, :create_id => "^o", :create_additions => true)
|
data/test/test_file.rb
CHANGED
@@ -125,13 +125,16 @@ class FileJuice < Minitest::Test
|
|
125
125
|
|
126
126
|
# Time
|
127
127
|
def test_time_object
|
128
|
+
skip 'TruffleRuby fails this spec' if RUBY_ENGINE == 'truffleruby'
|
129
|
+
|
128
130
|
t = Time.now()
|
129
131
|
Oj.default_options = { :mode => :object, :time_format => :unix_zone }
|
130
132
|
dump_and_load(t, false)
|
131
133
|
end
|
132
134
|
def test_time_object_early
|
133
|
-
|
134
|
-
|
135
|
+
skip 'Windows does not support dates before 1970.' if RbConfig::CONFIG['host_os'] =~ /(mingw|mswin)/
|
136
|
+
skip 'TruffleRuby fails this spec' if RUBY_ENGINE == 'truffleruby'
|
137
|
+
|
135
138
|
t = Time.xmlschema("1954-01-05T00:00:00.123456")
|
136
139
|
Oj.default_options = { :mode => :object, :time_format => :unix_zone }
|
137
140
|
dump_and_load(t, false)
|
@@ -166,6 +169,8 @@ class FileJuice < Minitest::Test
|
|
166
169
|
assert(%{{"^O":"Range","begin":1,"end":7,"exclude_end?":false}} == json)
|
167
170
|
elsif 'jruby' == $ruby
|
168
171
|
assert(%{{"^O":"Range","begin":1,"end":7,"exclude_end?":false}} == json)
|
172
|
+
elsif 'truffleruby' == $ruby
|
173
|
+
assert(%{{"^O":"Range","begin":1,"end":7,"exclude_end?":false}} == json)
|
169
174
|
else
|
170
175
|
assert_equal(%{{"^u":["Range",1,7,false]}}, json)
|
171
176
|
end
|
data/test/test_gc.rb
CHANGED
@@ -26,10 +26,12 @@ class GCTest < Minitest::Test
|
|
26
26
|
|
27
27
|
def setup
|
28
28
|
@default_options = Oj.default_options
|
29
|
+
GC.stress = true
|
29
30
|
end
|
30
31
|
|
31
32
|
def teardown
|
32
33
|
Oj.default_options = @default_options
|
34
|
+
GC.stress = false
|
33
35
|
end
|
34
36
|
|
35
37
|
# if no crash then the GC marking is working
|
@@ -41,9 +43,20 @@ class GCTest < Minitest::Test
|
|
41
43
|
end
|
42
44
|
|
43
45
|
def test_parse_object_gc
|
46
|
+
skip 'TruffleRuby fails this spec with `RuntimeError: rb_ivar_foreach not implemented`' if RUBY_ENGINE == 'truffleruby'
|
47
|
+
|
44
48
|
g = Goo.new(0, nil)
|
45
49
|
100.times { |i| g = Goo.new(i, g) }
|
46
50
|
json = Oj.dump(g, :mode => :object)
|
47
51
|
Oj.object_load(json)
|
48
52
|
end
|
53
|
+
|
54
|
+
def test_parse_gc
|
55
|
+
json = '{"a":"Alpha","b":true,"c":12345,"d":[true,[false,[-123456789,null],3.9676,["Something else.",false],null]],"e":{"zero":null,"one":1,"two":2,"three":[3],"four":[0,1,2,3,4]},"f":null,"h":{"a":{"b":{"c":{"d":{"e":{"f":{"g":null}}}}}}},"i":[[[[[[[null]]]]]]]}'
|
56
|
+
|
57
|
+
50.times do
|
58
|
+
data = Oj.load(json)
|
59
|
+
assert_equal(json, Oj.dump(data))
|
60
|
+
end
|
61
|
+
end
|
49
62
|
end
|
data/test/test_integer_range.rb
CHANGED
@@ -23,18 +23,24 @@ class IntegerRangeTest < Minitest::Test
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def test_range
|
26
|
+
skip 'TruffleRuby fails this spec with `ArgumentError: :integer_range must be a range of Fixnum.`' if RUBY_ENGINE == 'truffleruby'
|
27
|
+
|
26
28
|
test = {s: 0, s2: -1, s3: 1, u: -2, u2: 2, u3: 9007199254740993}
|
27
29
|
exp = '{"s":0,"s2":-1,"s3":1,"u":"-2","u2":"2","u3":"9007199254740993"}'
|
28
30
|
assert_equal(exp, Oj.dump(test, integer_range: (-1..1)))
|
29
31
|
end
|
30
32
|
|
31
33
|
def test_bignum
|
34
|
+
skip 'TruffleRuby fails this spec with `ArgumentError: :integer_range must be a range of Fixnum.`' if RUBY_ENGINE == 'truffleruby'
|
35
|
+
|
32
36
|
test = {u: -10000000000000000000, u2: 10000000000000000000}
|
33
37
|
exp = '{"u":"-10000000000000000000","u2":"10000000000000000000"}'
|
34
38
|
assert_equal(exp, Oj.dump(test, integer_range: (-1..1)))
|
35
39
|
end
|
36
40
|
|
37
41
|
def test_valid_modes
|
42
|
+
skip 'TruffleRuby fails this spec with `ArgumentError: :integer_range must be a range of Fixnum.`' if RUBY_ENGINE == 'truffleruby'
|
43
|
+
|
38
44
|
test = {safe: 0, unsafe: 9007199254740993}
|
39
45
|
exp = '{"safe":0,"unsafe":"9007199254740993"}'
|
40
46
|
|
data/test/test_object.rb
CHANGED
@@ -461,6 +461,8 @@ class ObjectJuice < Minitest::Test
|
|
461
461
|
end
|
462
462
|
|
463
463
|
def test_json_module_object
|
464
|
+
skip 'TruffleRuby fails this spec with `RuntimeError: rb_ivar_foreach not implemented`' if RUBY_ENGINE == 'truffleruby'
|
465
|
+
|
464
466
|
obj = One::Two::Three::Deep.new()
|
465
467
|
dump_and_load(obj, false)
|
466
468
|
end
|
@@ -631,11 +633,15 @@ class ObjectJuice < Minitest::Test
|
|
631
633
|
end
|
632
634
|
|
633
635
|
def test_json_object
|
636
|
+
skip 'TruffleRuby fails this spec with `RuntimeError: rb_ivar_foreach not implemented`' if RUBY_ENGINE == 'truffleruby'
|
637
|
+
|
634
638
|
obj = Jeez.new(true, 58)
|
635
639
|
dump_and_load(obj, false)
|
636
640
|
end
|
637
641
|
|
638
642
|
def test_json_object_create_deep
|
643
|
+
skip 'TruffleRuby fails this spec with `RuntimeError: rb_ivar_foreach not implemented`' if RUBY_ENGINE == 'truffleruby'
|
644
|
+
|
639
645
|
obj = One::Two::Three::Deep.new()
|
640
646
|
dump_and_load(obj, false)
|
641
647
|
end
|
@@ -672,6 +678,8 @@ class ObjectJuice < Minitest::Test
|
|
672
678
|
end
|
673
679
|
|
674
680
|
def test_json_anonymous_struct
|
681
|
+
skip 'TruffleRuby fails this spec with `TypeError: allocator undefined for Class`' if RUBY_ENGINE == 'truffleruby'
|
682
|
+
|
675
683
|
s = Struct.new(:x, :y)
|
676
684
|
obj = s.new(1, 2)
|
677
685
|
json = Oj.dump(obj, :indent => 2, :mode => :object)
|
@@ -694,6 +702,8 @@ class ObjectJuice < Minitest::Test
|
|
694
702
|
end
|
695
703
|
|
696
704
|
def test_json_object_object
|
705
|
+
skip 'TruffleRuby fails this spec with `RuntimeError: rb_ivar_foreach not implemented`' if RUBY_ENGINE == 'truffleruby'
|
706
|
+
|
697
707
|
obj = Jeez.new(true, 58)
|
698
708
|
json = Oj.dump(obj, mode: :object, indent: 2, ignore_under: true)
|
699
709
|
assert(%{{
|
@@ -713,6 +723,8 @@ class ObjectJuice < Minitest::Test
|
|
713
723
|
end
|
714
724
|
|
715
725
|
def test_to_hash_object_object
|
726
|
+
skip 'TruffleRuby fails this spec with `RuntimeError: rb_ivar_foreach not implemented`' if RUBY_ENGINE == 'truffleruby'
|
727
|
+
|
716
728
|
obj = Jazz.new(true, 58)
|
717
729
|
json = Oj.dump(obj, :mode => :object, :indent => 2)
|
718
730
|
assert(%{{
|
@@ -732,6 +744,8 @@ class ObjectJuice < Minitest::Test
|
|
732
744
|
end
|
733
745
|
|
734
746
|
def test_as_json_object_object
|
747
|
+
skip 'TruffleRuby fails this spec with `RuntimeError: rb_ivar_foreach not implemented`' if RUBY_ENGINE == 'truffleruby'
|
748
|
+
|
735
749
|
obj = Orange.new(true, 58)
|
736
750
|
json = Oj.dump(obj, :mode => :object, :indent => 2)
|
737
751
|
assert(%{{
|
@@ -751,6 +765,8 @@ class ObjectJuice < Minitest::Test
|
|
751
765
|
end
|
752
766
|
|
753
767
|
def test_object_object_no_cache
|
768
|
+
skip 'TruffleRuby fails this spec with `RuntimeError: rb_ivar_foreach not implemented`' if RUBY_ENGINE == 'truffleruby'
|
769
|
+
|
754
770
|
obj = Jam.new(true, 58)
|
755
771
|
json = Oj.dump(obj, :mode => :object, :indent => 2)
|
756
772
|
assert(%{{
|
@@ -779,6 +795,8 @@ class ObjectJuice < Minitest::Test
|
|
779
795
|
end
|
780
796
|
|
781
797
|
def test_exception
|
798
|
+
skip 'TruffleRuby fails this spec with `RuntimeError: rb_ivar_foreach not implemented`' if RUBY_ENGINE == 'truffleruby'
|
799
|
+
|
782
800
|
err = nil
|
783
801
|
begin
|
784
802
|
raise StandardError.new('A Message')
|
@@ -809,6 +827,8 @@ class ObjectJuice < Minitest::Test
|
|
809
827
|
end
|
810
828
|
|
811
829
|
def test_exception_subclass
|
830
|
+
skip 'TruffleRuby fails this spec with `RuntimeError: rb_ivar_foreach not implemented`' if RUBY_ENGINE == 'truffleruby'
|
831
|
+
|
812
832
|
err = nil
|
813
833
|
begin
|
814
834
|
raise SubX.new
|
@@ -830,6 +850,8 @@ class ObjectJuice < Minitest::Test
|
|
830
850
|
json = Oj.dump(1..7, :mode => :object, :indent => 0)
|
831
851
|
if 'rubinius' == $ruby
|
832
852
|
assert(%{{"^O":"Range","begin":1,"end":7,"exclude_end?":false}} == json)
|
853
|
+
elsif 'truffleruby' == $ruby
|
854
|
+
assert(%{{"^O":"Range","begin":1,"end":7,"exclude_end?":false}} == json)
|
833
855
|
else
|
834
856
|
assert_equal(%{{"^u":["Range",1,7,false]}}, json)
|
835
857
|
end
|
@@ -895,6 +917,8 @@ class ObjectJuice < Minitest::Test
|
|
895
917
|
end
|
896
918
|
|
897
919
|
def test_circular_object
|
920
|
+
skip 'TruffleRuby fails this spec with `RuntimeError: rb_ivar_foreach not implemented`' if RUBY_ENGINE == 'truffleruby'
|
921
|
+
|
898
922
|
obj = Jeez.new(nil, 58)
|
899
923
|
obj.x = obj
|
900
924
|
json = Oj.dump(obj, :mode => :object, :indent => 2, :circular => true)
|
@@ -903,6 +927,8 @@ class ObjectJuice < Minitest::Test
|
|
903
927
|
end
|
904
928
|
|
905
929
|
def test_circular_object2
|
930
|
+
skip 'TruffleRuby fails this spec with `RuntimeError: rb_ivar_foreach not implemented`' if RUBY_ENGINE == 'truffleruby'
|
931
|
+
|
906
932
|
obj = Jam.new(nil, 58)
|
907
933
|
obj.x = obj
|
908
934
|
json = Oj.dump(obj, :mode => :object, :indent => 2, :circular => true)
|
@@ -925,6 +951,8 @@ class ObjectJuice < Minitest::Test
|
|
925
951
|
end
|
926
952
|
|
927
953
|
def test_circular
|
954
|
+
skip 'TruffleRuby fails this spec with `RuntimeError: rb_ivar_foreach not implemented`' if RUBY_ENGINE == 'truffleruby'
|
955
|
+
|
928
956
|
h = { 'a' => 7 }
|
929
957
|
obj = Jeez.new(h, 58)
|
930
958
|
obj.x['b'] = obj
|
@@ -935,6 +963,8 @@ class ObjectJuice < Minitest::Test
|
|
935
963
|
end
|
936
964
|
|
937
965
|
def test_circular2
|
966
|
+
skip 'TruffleRuby fails this spec with `RuntimeError: rb_ivar_foreach not implemented`' if RUBY_ENGINE == 'truffleruby'
|
967
|
+
|
938
968
|
h = { 'a' => 7 }
|
939
969
|
obj = Jam.new(h, 58)
|
940
970
|
obj.x['b'] = obj
|
@@ -947,6 +977,8 @@ class ObjectJuice < Minitest::Test
|
|
947
977
|
end
|
948
978
|
|
949
979
|
def test_omit_nil
|
980
|
+
skip 'TruffleRuby fails this spec with `RuntimeError: rb_ivar_foreach not implemented`' if RUBY_ENGINE == 'truffleruby'
|
981
|
+
|
950
982
|
jam = Jam.new({'a' => 1, 'b' => nil }, nil)
|
951
983
|
|
952
984
|
json = Oj.dump(jam, :omit_nil => true, :mode => :object)
|
@@ -1001,16 +1033,22 @@ class ObjectJuice < Minitest::Test
|
|
1001
1033
|
end
|
1002
1034
|
|
1003
1035
|
def test_auto_string
|
1036
|
+
skip 'TruffleRuby fails this spec with `RuntimeError: rb_ivar_foreach not implemented`' if RUBY_ENGINE == 'truffleruby'
|
1037
|
+
|
1004
1038
|
s = AutoStrung.new("Pete", true)
|
1005
1039
|
dump_and_load(s, false)
|
1006
1040
|
end
|
1007
1041
|
|
1008
1042
|
def test_auto_array
|
1043
|
+
skip 'TruffleRuby fails this spec with `RuntimeError: rb_ivar_foreach not implemented`' if RUBY_ENGINE == 'truffleruby'
|
1044
|
+
|
1009
1045
|
a = AutoArray.new([1, 'abc', nil], true)
|
1010
1046
|
dump_and_load(a, false)
|
1011
1047
|
end
|
1012
1048
|
|
1013
1049
|
def test_auto_hash
|
1050
|
+
skip 'TruffleRuby fails this spec with `RuntimeError: rb_ivar_foreach not implemented`' if RUBY_ENGINE == 'truffleruby'
|
1051
|
+
|
1014
1052
|
h = AutoHash.new(nil, true)
|
1015
1053
|
h['a'] = 1
|
1016
1054
|
h['b'] = 2
|
data/test/test_scp.rb
CHANGED
@@ -320,8 +320,8 @@ class ScpTest < Minitest::Test
|
|
320
320
|
end
|
321
321
|
|
322
322
|
def test_pipe
|
323
|
-
|
324
|
-
|
323
|
+
skip ' Windows does not support fork' if RbConfig::CONFIG['host_os'] =~ /(mingw|mswin)/
|
324
|
+
skip 'TruffleRuby fails this spec with `NotImplementedError: fork is not available`' if RUBY_ENGINE == 'truffleruby'
|
325
325
|
|
326
326
|
handler = AllHandler.new()
|
327
327
|
json = %{{"one":true,"two":false}}
|
@@ -357,8 +357,8 @@ class ScpTest < Minitest::Test
|
|
357
357
|
end
|
358
358
|
|
359
359
|
def test_pipe_close
|
360
|
-
|
361
|
-
|
360
|
+
skip 'Windows does not support fork' if RbConfig::CONFIG['host_os'] =~ /(mingw|mswin)/
|
361
|
+
skip 'TruffleRuby fails this spec with `NotImplementedError: fork is not available`' if RUBY_ENGINE == 'truffleruby'
|
362
362
|
|
363
363
|
json = %{{"one":true,"two":false}}
|
364
364
|
IO.pipe do |read_io, write_io|
|
data/test/test_strict.rb
CHANGED
data/test/test_wab.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.13.
|
4
|
+
version: 3.13.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Ohler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-07
|
11
|
+
date: 2022-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake-compiler
|