oj 2.18.3 → 2.18.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +100 -83
- data/ext/oj/dump_custom.c +759 -0
- data/ext/oj/oj.c +10 -2
- data/ext/oj/oj.h +1 -0
- data/ext/oj/parse.c +7 -0
- data/lib/oj/version.rb +1 -1
- data/test/foo.rb +2 -19
- data/test/isolated/shared.rb +10 -4
- data/test/isolated/test_mimic_rails_after.rb +3 -3
- data/test/isolated/test_mimic_rails_before.rb +3 -3
- data/test/mem.rb +20 -0
- data/test/omit.rb +20 -0
- data/test/rails_datetime_test.rb +24 -0
- data/test/test_custom.rb +399 -0
- data/test/test_various.rb +22 -0
- data/test/test_writer.rb +16 -0
- data/test/x_test.rb +185 -0
- metadata +72 -69
- data/test/curl/curl_oj.rb +0 -46
- data/test/curl/get_oj.rb +0 -24
- data/test/curl/just_curl.rb +0 -31
- data/test/curl/just_oj.rb +0 -51
data/test/curl/curl_oj.rb
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# encoding: UTF-8
|
3
|
-
|
4
|
-
#$VERBOSE = true
|
5
|
-
|
6
|
-
$: << File.dirname(__FILE__)
|
7
|
-
$: << File.expand_path("../../ext")
|
8
|
-
$: << File.expand_path("../../lib")
|
9
|
-
$: << File.expand_path("../../../curb/ext")
|
10
|
-
$: << File.expand_path("../../../curb/lib")
|
11
|
-
|
12
|
-
require 'curb'
|
13
|
-
require 'oj'
|
14
|
-
|
15
|
-
$cnt = 0
|
16
|
-
|
17
|
-
$url = "localhost:7660/data.json"
|
18
|
-
|
19
|
-
begin
|
20
|
-
while true
|
21
|
-
before = GC.count
|
22
|
-
curl = Curl::Easy.new($url)
|
23
|
-
curl.ssl_verify_host = false
|
24
|
-
curl.http_get
|
25
|
-
if before != GC.count
|
26
|
-
puts " did a GC in curl #{GC.count}"
|
27
|
-
before = GC.count
|
28
|
-
end
|
29
|
-
=begin
|
30
|
-
data = Oj.load(curl.body, symbol_keys: true, mode: :strict)
|
31
|
-
puts " did a GC in Oj #{GC.count}" if before != GC.count
|
32
|
-
|
33
|
-
if data[:data].nil? or data[:data].any? { |e| e.empty? }
|
34
|
-
puts "body: #{curl.body}"
|
35
|
-
raise "FAILED"
|
36
|
-
end
|
37
|
-
=end
|
38
|
-
$cnt += 1
|
39
|
-
print "\r #{$cnt}"
|
40
|
-
end
|
41
|
-
rescue Exception => e
|
42
|
-
puts "#{e.class}: #{e.message}"
|
43
|
-
puts "url: #{$url}"
|
44
|
-
#puts "data: #{data}"
|
45
|
-
#puts "data[data]: #{data[:data]}"
|
46
|
-
end
|
data/test/curl/get_oj.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# encoding: UTF-8
|
3
|
-
|
4
|
-
$VERBOSE = true
|
5
|
-
|
6
|
-
$: << File.dirname(__FILE__)
|
7
|
-
$: << File.expand_path("../../ext")
|
8
|
-
$: << File.expand_path("../../lib")
|
9
|
-
|
10
|
-
require 'net/http'
|
11
|
-
require 'uri'
|
12
|
-
require 'oj'
|
13
|
-
|
14
|
-
$url = URI.parse("http://localhost:7660/data.json")
|
15
|
-
|
16
|
-
$cnt = 0
|
17
|
-
|
18
|
-
while true
|
19
|
-
response = Net::HTTP.get_response($url)
|
20
|
-
data = Oj.load(response.body, symbol_keys: true, mode: :strict)
|
21
|
-
raise "FAILED" if data[:data].any? { |e| e.empty? }
|
22
|
-
$cnt += 1
|
23
|
-
print "\r #{$cnt}"
|
24
|
-
end
|
data/test/curl/just_curl.rb
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# encoding: UTF-8
|
3
|
-
|
4
|
-
#$VERBOSE = true
|
5
|
-
|
6
|
-
$: << File.dirname(__FILE__)
|
7
|
-
#$: << File.expand_path("../../../curb/ext")
|
8
|
-
#$: << File.expand_path("../../../curb/lib")
|
9
|
-
|
10
|
-
require 'curb'
|
11
|
-
|
12
|
-
$cnt = 0
|
13
|
-
$url = "localhost:7660/data.json"
|
14
|
-
|
15
|
-
begin
|
16
|
-
while true
|
17
|
-
before = GC.count
|
18
|
-
curl = Curl::Easy.new($url)
|
19
|
-
curl.ssl_verify_host = false
|
20
|
-
curl.http_get
|
21
|
-
if before != GC.count
|
22
|
-
puts " did a GC in curl #{GC.count}"
|
23
|
-
before = GC.count
|
24
|
-
end
|
25
|
-
$cnt += 1
|
26
|
-
print "\r #{$cnt}"
|
27
|
-
end
|
28
|
-
rescue Exception => e
|
29
|
-
puts "#{e.class}: #{e.message}"
|
30
|
-
puts "url: #{$url}"
|
31
|
-
end
|
data/test/curl/just_oj.rb
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# encoding: UTF-8
|
3
|
-
|
4
|
-
$VERBOSE = true
|
5
|
-
|
6
|
-
$: << File.dirname(__FILE__)
|
7
|
-
$: << File.expand_path("../../ext")
|
8
|
-
$: << File.expand_path("../../lib")
|
9
|
-
|
10
|
-
require 'oj'
|
11
|
-
|
12
|
-
$json = %|
|
13
|
-
{
|
14
|
-
"data" : [ {
|
15
|
-
"action" : "login",
|
16
|
-
"event" : "user",
|
17
|
-
"field" : "login",
|
18
|
-
"value" : "foobar",
|
19
|
-
"info" : "Authenticated \\"Foo Bar\\"",
|
20
|
-
"id" : "585929918297f2740ed9f5f0",
|
21
|
-
"_metadata" : {
|
22
|
-
"version" : "1"
|
23
|
-
},
|
24
|
-
"timestamp" : "2016-12-20T07:52:33",
|
25
|
-
"key_id" : "4"
|
26
|
-
} ],
|
27
|
-
"info" : {
|
28
|
-
"view" : "partial",
|
29
|
-
"limit" : 500,
|
30
|
-
"offset" : 2000,
|
31
|
-
"results" : 500,
|
32
|
-
"ordering" : "timestamp desc,id",
|
33
|
-
"previous" : "https://api.server.com/some/path/event?calculate_total=false&draft=base&order_by=timestamp_desc&order_by=id&subdraft=none&offset=1500&limit=500",
|
34
|
-
"next" : "https://api.server.com/some/path/event?calculate_total=false&draft=base&order_by=timestamp_desc&order_by=id&subdraft=none&offset=2500&limit=500",
|
35
|
-
"draft" : "base",
|
36
|
-
"subdraft" : "none",
|
37
|
-
"total_results" : 100000
|
38
|
-
}
|
39
|
-
}
|
40
|
-
|
|
41
|
-
|
42
|
-
$cnt = 0
|
43
|
-
|
44
|
-
while true
|
45
|
-
before = GC.count
|
46
|
-
data = Oj.load($json, symbol_keys: true, mode: :strict)
|
47
|
-
puts " did a GC in Oj #{GC.count} - #{$cnt}" if before != GC.count
|
48
|
-
raise "FAILED" if data[:data].any? { |e| e.empty? }
|
49
|
-
$cnt += 1
|
50
|
-
print "\r #{$cnt}" if 0 == ($cnt % 10000)
|
51
|
-
end
|