1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
diff --git a/lib/json.rb b/lib/json.rb
index 61bb8fae0e..8132cd571c 100644
--- a/lib/json.rb
+++ b/lib/json.rb
@@ -55,9 +55,5 @@ require 'json/common'
module JSON
require 'json/version'
- begin
- require 'json/ext'
- rescue LoadError
- require 'json/pure'
- end
+ require 'json/pure'
end
diff --git a/tests/setup_variant.rb b/tests/setup_variant.rb
index f7fb2a1d56..5e9e050a26 100644
--- a/tests/setup_variant.rb
+++ b/tests/setup_variant.rb
@@ -1,12 +1,3 @@
# frozen_string_literal: false
-case ENV['JSON']
-when 'pure'
- $:.unshift 'lib'
- require 'json/pure'
-when 'ext'
- $:.unshift 'ext', 'lib'
- require 'json/ext'
-else
- $:.unshift 'ext', 'lib'
- require 'json'
-end
+$:.unshift 'lib'
+require 'json'
diff --git a/tests/test_json.rb b/tests/test_json.rb
index 8fe9459978..b81ee506af 100755
--- a/tests/test_json.rb
+++ b/tests/test_json.rb
@@ -537,15 +537,6 @@ EOT
assert_equal orig, JSON[json5][0]
end
- if defined?(JSON::Ext::Parser)
- def test_allocate
- parser = JSON::Ext::Parser.new("{}")
- assert_raise(TypeError, '[ruby-core:35079]') {parser.__send__(:initialize, "{}")}
- parser = JSON::Ext::Parser.allocate
- assert_raise(TypeError, '[ruby-core:35079]') {parser.source}
- end
- end
-
def test_argument_encoding
source = "{}".force_encoding("ascii-8bit")
JSON::Parser.new(source)
@@ -565,13 +556,13 @@ EOT
if EnvUtil.gc_stress_to_class?
def assert_no_memory_leak(code, *rest, **opt)
code = "8.times {20_000.times {begin #{code}; rescue NoMemoryError; end}; GC.start}"
- super(["-rjson/ext/parser"],
- "GC.add_stress_to_class(JSON::Ext::Parser); "\
+ super(["-rjson/pure/parser"],
+ "GC.add_stress_to_class(JSON::Pure::Parser); "\
"#{code}", code, *rest, rss: true, limit: 1.1, **opt)
end
def test_no_memory_leak_allocate
- assert_no_memory_leak("JSON::Ext::Parser.allocate")
+ assert_no_memory_leak("JSON::Pure::Parser.allocate")
end
end
end
diff --git a/tests/test_json_generate.rb b/tests/test_json_generate.rb
index 50895f6247..f85dd3a81c 100755
--- a/tests/test_json_generate.rb
+++ b/tests/test_json_generate.rb
@@ -283,28 +283,6 @@ EOT
assert_equal '2', state.indent
end
- if defined?(JSON::Ext::Generator)
- def test_broken_bignum # [ruby-core:38867]
- pid = fork do
- Bignum.class_eval do
- def to_s
- end
- end
- begin
- JSON::Ext::Generator::State.new.generate(1<<64)
- exit 1
- rescue TypeError
- exit 0
- end
- end
- _, status = Process.waitpid2(pid)
- assert status.success?
- rescue NotImplementedError
- # forking to avoid modifying core class of a parent process and
- # introducing race conditions of tests are run in parallel
- end
- end
-
def test_hash_likeness_set_symbol
state = JSON.state.new
assert_equal nil, state[:foo]
@@ -349,13 +327,13 @@ EOT
if EnvUtil.gc_stress_to_class?
def assert_no_memory_leak(code, *rest, **opt)
code = "8.times {20_000.times {begin #{code}; rescue NoMemoryError; end}; GC.start}"
- super(["-rjson/ext/generator"],
- "GC.add_stress_to_class(JSON::Ext::Generator::State); "\
+ super(["-rjson/pure/generator"],
+ "GC.add_stress_to_class(JSON::Pure::Generator::State); "\
"#{code}", code, *rest, rss: true, limit: 1.1, **opt)
end
def test_no_memory_leak_allocate
- assert_no_memory_leak("JSON::Ext::Generator::State.allocate")
+ assert_no_memory_leak("JSON::Pure::Generator::State.allocate")
end
end
end
|