oj 3.14.2 → 3.14.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (135) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -1
  3. data/README.md +0 -1
  4. data/ext/oj/buf.h +2 -2
  5. data/ext/oj/cache.c +16 -16
  6. data/ext/oj/cache8.c +7 -7
  7. data/ext/oj/circarray.c +2 -1
  8. data/ext/oj/circarray.h +2 -2
  9. data/ext/oj/code.c +2 -2
  10. data/ext/oj/code.h +2 -2
  11. data/ext/oj/compat.c +6 -14
  12. data/ext/oj/custom.c +1 -1
  13. data/ext/oj/debug.c +3 -9
  14. data/ext/oj/dump.c +16 -16
  15. data/ext/oj/dump_compat.c +551 -576
  16. data/ext/oj/dump_leaf.c +3 -5
  17. data/ext/oj/dump_object.c +35 -36
  18. data/ext/oj/dump_strict.c +2 -4
  19. data/ext/oj/encoder.c +1 -1
  20. data/ext/oj/err.c +2 -13
  21. data/ext/oj/err.h +9 -12
  22. data/ext/oj/extconf.rb +1 -1
  23. data/ext/oj/fast.c +24 -38
  24. data/ext/oj/intern.c +38 -42
  25. data/ext/oj/intern.h +3 -7
  26. data/ext/oj/mem.c +211 -217
  27. data/ext/oj/mem.h +10 -10
  28. data/ext/oj/mimic_json.c +18 -24
  29. data/ext/oj/object.c +5 -5
  30. data/ext/oj/odd.c +2 -1
  31. data/ext/oj/odd.h +4 -4
  32. data/ext/oj/oj.c +60 -81
  33. data/ext/oj/oj.h +53 -54
  34. data/ext/oj/parse.c +55 -118
  35. data/ext/oj/parse.h +5 -10
  36. data/ext/oj/parser.c +7 -8
  37. data/ext/oj/parser.h +7 -8
  38. data/ext/oj/rails.c +28 -59
  39. data/ext/oj/reader.c +5 -9
  40. data/ext/oj/reader.h +1 -1
  41. data/ext/oj/resolve.c +3 -4
  42. data/ext/oj/rxclass.c +1 -1
  43. data/ext/oj/rxclass.h +1 -1
  44. data/ext/oj/saj.c +4 -4
  45. data/ext/oj/saj2.c +32 -49
  46. data/ext/oj/saj2.h +1 -1
  47. data/ext/oj/scp.c +3 -14
  48. data/ext/oj/sparse.c +18 -67
  49. data/ext/oj/stream_writer.c +5 -18
  50. data/ext/oj/strict.c +7 -13
  51. data/ext/oj/string_writer.c +6 -14
  52. data/ext/oj/trace.h +27 -16
  53. data/ext/oj/usual.c +62 -61
  54. data/ext/oj/usual.h +6 -6
  55. data/ext/oj/util.h +1 -1
  56. data/ext/oj/val_stack.h +4 -4
  57. data/ext/oj/wab.c +7 -9
  58. data/lib/oj/active_support_helper.rb +0 -1
  59. data/lib/oj/bag.rb +7 -1
  60. data/lib/oj/easy_hash.rb +4 -5
  61. data/lib/oj/error.rb +0 -1
  62. data/lib/oj/json.rb +4 -2
  63. data/lib/oj/mimic.rb +4 -2
  64. data/lib/oj/state.rb +8 -5
  65. data/lib/oj/version.rb +1 -2
  66. data/lib/oj.rb +0 -1
  67. data/test/_test_active.rb +0 -1
  68. data/test/_test_active_mimic.rb +0 -1
  69. data/test/_test_mimic_rails.rb +0 -1
  70. data/test/activerecord/result_test.rb +5 -6
  71. data/test/bar.rb +3 -3
  72. data/test/files.rb +1 -1
  73. data/test/foo.rb +5 -48
  74. data/test/helper.rb +1 -4
  75. data/test/isolated/shared.rb +3 -2
  76. data/test/json_gem/json_addition_test.rb +2 -2
  77. data/test/json_gem/json_common_interface_test.rb +4 -4
  78. data/test/json_gem/json_encoding_test.rb +0 -0
  79. data/test/json_gem/json_ext_parser_test.rb +1 -0
  80. data/test/json_gem/json_fixtures_test.rb +3 -2
  81. data/test/json_gem/json_generator_test.rb +43 -32
  82. data/test/json_gem/json_generic_object_test.rb +11 -11
  83. data/test/json_gem/json_parser_test.rb +46 -46
  84. data/test/json_gem/json_string_matching_test.rb +9 -9
  85. data/test/mem.rb +7 -7
  86. data/test/perf.rb +2 -2
  87. data/test/perf_compat.rb +1 -1
  88. data/test/perf_fast.rb +1 -1
  89. data/test/perf_file.rb +2 -2
  90. data/test/perf_object.rb +1 -2
  91. data/test/perf_once.rb +4 -4
  92. data/test/perf_parser.rb +1 -2
  93. data/test/perf_saj.rb +1 -2
  94. data/test/perf_scp.rb +1 -1
  95. data/test/perf_simple.rb +3 -3
  96. data/test/perf_strict.rb +1 -1
  97. data/test/perf_wab.rb +1 -1
  98. data/test/sample/change.rb +0 -1
  99. data/test/sample/dir.rb +0 -1
  100. data/test/sample/doc.rb +0 -1
  101. data/test/sample/file.rb +0 -1
  102. data/test/sample/group.rb +0 -1
  103. data/test/sample/hasprops.rb +0 -1
  104. data/test/sample/layer.rb +0 -1
  105. data/test/sample/rect.rb +0 -1
  106. data/test/sample/shape.rb +0 -1
  107. data/test/sample/text.rb +0 -1
  108. data/test/sample.rb +2 -3
  109. data/test/sample_json.rb +0 -1
  110. data/test/test_compat.rb +11 -9
  111. data/test/test_custom.rb +5 -9
  112. data/test/test_debian.rb +1 -1
  113. data/test/test_fast.rb +10 -20
  114. data/test/test_file.rb +8 -8
  115. data/test/test_integer_range.rb +2 -2
  116. data/test/test_null.rb +5 -3
  117. data/test/test_object.rb +6 -5
  118. data/test/test_parser_saj.rb +23 -21
  119. data/test/test_parser_usual.rb +3 -3
  120. data/test/test_saj.rb +2 -0
  121. data/test/test_scp.rb +6 -6
  122. data/test/test_strict.rb +6 -4
  123. data/test/test_various.rb +21 -24
  124. data/test/test_wab.rb +6 -5
  125. data/test/test_writer.rb +1 -1
  126. metadata +17 -26
  127. data/test/activesupport4/decoding_test.rb +0 -108
  128. data/test/activesupport4/encoding_test.rb +0 -531
  129. data/test/activesupport4/test_helper.rb +0 -41
  130. data/test/activesupport5/abstract_unit.rb +0 -45
  131. data/test/activesupport5/decoding_test.rb +0 -133
  132. data/test/activesupport5/encoding_test.rb +0 -500
  133. data/test/activesupport5/encoding_test_cases.rb +0 -98
  134. data/test/activesupport5/test_helper.rb +0 -72
  135. data/test/activesupport5/time_zone_test_helpers.rb +0 -39
@@ -1,98 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "bigdecimal"
4
- require "date"
5
- require "time"
6
- require "pathname"
7
- require "uri"
8
-
9
- module JSONTest
10
- class Foo
11
- def initialize(a, b)
12
- @a, @b = a, b
13
- end
14
- end
15
-
16
- class Hashlike
17
- def to_hash
18
- { foo: "hello", bar: "world" }
19
- end
20
- end
21
-
22
- class Custom
23
- def initialize(serialized)
24
- @serialized = serialized
25
- end
26
-
27
- def as_json(options = nil)
28
- @serialized
29
- end
30
- end
31
-
32
- MyStruct = Struct.new(:name, :value) do
33
- def initialize(*)
34
- @unused = "unused instance variable"
35
- super
36
- end
37
- end
38
-
39
- module EncodingTestCases
40
- TrueTests = [[ true, %(true) ]]
41
- FalseTests = [[ false, %(false) ]]
42
- NilTests = [[ nil, %(null) ]]
43
- NumericTests = [[ 1, %(1) ],
44
- [ 2.5, %(2.5) ],
45
- [ 0.0 / 0.0, %(null) ],
46
- [ 1.0 / 0.0, %(null) ],
47
- [ -1.0 / 0.0, %(null) ],
48
- [ BigDecimal("0.0") / BigDecimal("0.0"), %(null) ],
49
- [ BigDecimal("2.5"), %("#{BigDecimal('2.5')}") ]]
50
-
51
- StringTests = [[ "this is the <string>", %("this is the \\u003cstring\\u003e")],
52
- [ 'a "string" with quotes & an ampersand', %("a \\"string\\" with quotes \\u0026 an ampersand") ],
53
- [ "http://test.host/posts/1", %("http://test.host/posts/1")],
54
- [ "Control characters: \x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\u2028\u2029",
55
- %("Control characters: \\u0000\\u0001\\u0002\\u0003\\u0004\\u0005\\u0006\\u0007\\b\\t\\n\\u000b\\f\\r\\u000e\\u000f\\u0010\\u0011\\u0012\\u0013\\u0014\\u0015\\u0016\\u0017\\u0018\\u0019\\u001a\\u001b\\u001c\\u001d\\u001e\\u001f\\u2028\\u2029") ]]
56
-
57
- ArrayTests = [[ ["a", "b", "c"], %([\"a\",\"b\",\"c\"]) ],
58
- [ [1, "a", :b, nil, false], %([1,\"a\",\"b\",null,false]) ]]
59
-
60
- HashTests = [[ { foo: "bar" }, %({\"foo\":\"bar\"}) ],
61
- [ { 1 => 1, 2 => "a", 3 => :b, 4 => nil, 5 => false }, %({\"1\":1,\"2\":\"a\",\"3\":\"b\",\"4\":null,\"5\":false}) ]]
62
-
63
- RangeTests = [[ 1..2, %("1..2")],
64
- [ 1...2, %("1...2")],
65
- [ 1.5..2.5, %("1.5..2.5")]]
66
-
67
- SymbolTests = [[ :a, %("a") ],
68
- [ :this, %("this") ],
69
- [ :"a b", %("a b") ]]
70
-
71
- ObjectTests = [[ Foo.new(1, 2), %({\"a\":1,\"b\":2}) ]]
72
- HashlikeTests = [[ Hashlike.new, %({\"bar\":\"world\",\"foo\":\"hello\"}) ]]
73
- StructTests = [[ MyStruct.new(:foo, "bar"), %({\"name\":\"foo\",\"value\":\"bar\"}) ],
74
- [ MyStruct.new(nil, nil), %({\"name\":null,\"value\":null}) ]]
75
- CustomTests = [[ Custom.new("custom"), '"custom"' ],
76
- [ Custom.new(nil), "null" ],
77
- [ Custom.new(:a), '"a"' ],
78
- [ Custom.new([ :foo, "bar" ]), '["foo","bar"]' ],
79
- [ Custom.new(foo: "hello", bar: "world"), '{"bar":"world","foo":"hello"}' ],
80
- [ Custom.new(Hashlike.new), '{"bar":"world","foo":"hello"}' ],
81
- [ Custom.new(Custom.new(Custom.new(:a))), '"a"' ]]
82
-
83
- RegexpTests = [[ /^a/, '"(?-mix:^a)"' ], [/^\w{1,2}[a-z]+/ix, '"(?ix-m:^\\\\w{1,2}[a-z]+)"']]
84
-
85
- URITests = [[ URI.parse("http://example.com"), %("http://example.com") ]]
86
-
87
- PathnameTests = [[ Pathname.new("lib/index.rb"), %("lib/index.rb") ]]
88
-
89
- DateTests = [[ Date.new(2005, 2, 1), %("2005/02/01") ]]
90
- TimeTests = [[ Time.utc(2005, 2, 1, 15, 15, 10), %("2005/02/01 15:15:10 +0000") ]]
91
- DateTimeTests = [[ DateTime.civil(2005, 2, 1, 15, 15, 10), %("2005/02/01 15:15:10 +0000") ]]
92
-
93
- StandardDateTests = [[ Date.new(2005, 2, 1), %("2005-02-01") ]]
94
- StandardTimeTests = [[ Time.utc(2005, 2, 1, 15, 15, 10), %("2005-02-01T15:15:10.000Z") ]]
95
- StandardDateTimeTests = [[ DateTime.civil(2005, 2, 1, 15, 15, 10), %("2005-02-01T15:15:10.000+00:00") ]]
96
- StandardStringTests = [[ "this is the <string>", %("this is the <string>")]]
97
- end
98
- end
@@ -1,72 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- gem "minitest" # make sure we get the gem, not stdlib
4
- require "minitest"
5
- require "active_support/testing/tagged_logging"
6
- require "active_support/testing/setup_and_teardown"
7
- require "active_support/testing/assertions"
8
- require "active_support/testing/deprecation"
9
- require "active_support/testing/declarative"
10
- require "active_support/testing/isolation"
11
- require "active_support/testing/constant_lookup"
12
- require "active_support/testing/time_helpers"
13
- require "active_support/testing/file_fixtures"
14
-
15
- module ActiveSupport
16
- class TestCase < ::Minitest::Test
17
- Assertion = Minitest::Assertion
18
-
19
- class << self
20
- # Sets the order in which test cases are run.
21
- #
22
- # ActiveSupport::TestCase.test_order = :random # => :random
23
- #
24
- # Valid values are:
25
- # * +:random+ (to run tests in random order)
26
- # * +:parallel+ (to run tests in parallel)
27
- # * +:sorted+ (to run tests alphabetically by method name)
28
- # * +:alpha+ (equivalent to +:sorted+)
29
- def test_order=(new_order)
30
- ActiveSupport.test_order = new_order
31
- end
32
-
33
- # Returns the order in which test cases are run.
34
- #
35
- # ActiveSupport::TestCase.test_order # => :random
36
- #
37
- # Possible values are +:random+, +:parallel+, +:alpha+, +:sorted+.
38
- # Defaults to +:random+.
39
- def test_order
40
- ActiveSupport.test_order ||= :random
41
- end
42
- end
43
-
44
- alias_method :method_name, :name
45
-
46
- include ActiveSupport::Testing::TaggedLogging
47
- prepend ActiveSupport::Testing::SetupAndTeardown
48
- include ActiveSupport::Testing::Assertions
49
- include ActiveSupport::Testing::Deprecation
50
- include ActiveSupport::Testing::TimeHelpers
51
- include ActiveSupport::Testing::FileFixtures
52
- extend ActiveSupport::Testing::Declarative
53
-
54
- # test/unit backwards compatibility methods
55
- alias :assert_raise :assert_raises
56
- alias :assert_not_empty :refute_empty
57
- alias :assert_not_equal :refute_equal
58
- alias :assert_not_in_delta :refute_in_delta
59
- alias :assert_not_in_epsilon :refute_in_epsilon
60
- alias :assert_not_includes :refute_includes
61
- alias :assert_not_instance_of :refute_instance_of
62
- alias :assert_not_kind_of :refute_kind_of
63
- alias :assert_no_match :refute_match
64
- alias :assert_not_nil :refute_nil
65
- alias :assert_not_operator :refute_operator
66
- alias :assert_not_predicate :refute_predicate
67
- alias :assert_not_respond_to :refute_respond_to
68
- alias :assert_not_same :refute_same
69
-
70
- ActiveSupport.run_load_hooks(:active_support_test_case, self)
71
- end
72
- end
@@ -1,39 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module TimeZoneTestHelpers
4
- def with_tz_default(tz = nil)
5
- old_tz = Time.zone
6
- Time.zone = tz
7
- yield
8
- ensure
9
- Time.zone = old_tz
10
- end
11
-
12
- def with_env_tz(new_tz = "US/Eastern")
13
- old_tz, ENV["TZ"] = ENV["TZ"], new_tz
14
- yield
15
- ensure
16
- old_tz ? ENV["TZ"] = old_tz : ENV.delete("TZ")
17
- end
18
-
19
- def with_preserve_timezone(value)
20
- old_preserve_tz = ActiveSupport.to_time_preserves_timezone
21
- ActiveSupport.to_time_preserves_timezone = value
22
- yield
23
- ensure
24
- ActiveSupport.to_time_preserves_timezone = old_preserve_tz
25
- end
26
-
27
- def with_tz_mappings(mappings)
28
- old_mappings = ActiveSupport::TimeZone::MAPPING.dup
29
- ActiveSupport::TimeZone.clear
30
- ActiveSupport::TimeZone::MAPPING.clear
31
- ActiveSupport::TimeZone::MAPPING.merge!(mappings)
32
-
33
- yield
34
- ensure
35
- ActiveSupport::TimeZone.clear
36
- ActiveSupport::TimeZone::MAPPING.clear
37
- ActiveSupport::TimeZone::MAPPING.merge!(old_mappings)
38
- end
39
- end