ffi-yajl 2.3.0-universal-java → 2.3.1-universal-java
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 +31 -73
- data/Rakefile +55 -96
- data/bin/ffi-yajl-bench +7 -7
- data/ext/ffi_yajl/ext/dlopen/extconf.rb +5 -5
- data/ext/ffi_yajl/ext/encoder/extconf.rb +12 -12
- data/ext/ffi_yajl/ext/parser/extconf.rb +12 -12
- data/lib/ffi_yajl.rb +7 -7
- data/lib/ffi_yajl/benchmark.rb +5 -5
- data/lib/ffi_yajl/benchmark/encode.rb +8 -8
- data/lib/ffi_yajl/benchmark/encode_json_and_marshal.rb +9 -9
- data/lib/ffi_yajl/benchmark/encode_json_and_yaml.rb +11 -11
- data/lib/ffi_yajl/benchmark/encode_profile.rb +5 -5
- data/lib/ffi_yajl/benchmark/http.rb +12 -12
- data/lib/ffi_yajl/benchmark/parse.rb +8 -8
- data/lib/ffi_yajl/benchmark/parse_json_and_marshal.rb +10 -10
- data/lib/ffi_yajl/benchmark/parse_json_and_yaml.rb +11 -11
- data/lib/ffi_yajl/benchmark/parse_profile.rb +5 -5
- data/lib/ffi_yajl/benchmark/parse_profile_ruby_prof.rb +4 -4
- data/lib/ffi_yajl/benchmark/parse_stream.rb +9 -9
- data/lib/ffi_yajl/encoder.rb +2 -2
- data/lib/ffi_yajl/ext.rb +9 -9
- data/lib/ffi_yajl/ffi.rb +8 -8
- data/lib/ffi_yajl/ffi/encoder.rb +9 -27
- data/lib/ffi_yajl/ffi/parser.rb +5 -5
- data/lib/ffi_yajl/map_library_name.rb +3 -3
- data/lib/ffi_yajl/parser.rb +2 -2
- data/lib/ffi_yajl/version.rb +2 -2
- data/spec/ffi_yajl/encoder_spec.rb +10 -10
- data/spec/ffi_yajl/map_library_name_spec.rb +2 -2
- data/spec/ffi_yajl/parser_spec.rb +7 -7
- data/spec/spec_helper.rb +4 -4
- metadata +12 -26
data/lib/ffi_yajl/encoder.rb
CHANGED
@@ -47,7 +47,7 @@ module FFI_Yajl
|
|
47
47
|
if str.respond_to?(:scrub)
|
48
48
|
str.scrub!
|
49
49
|
else
|
50
|
-
str.encode!("UTF-16le", undef: :replace, invalid: :replace).encode!(
|
50
|
+
str.encode!("UTF-16le", undef: :replace, invalid: :replace).encode!("UTF-8")
|
51
51
|
end
|
52
52
|
end
|
53
53
|
str
|
@@ -68,7 +68,7 @@ module FFI_Yajl
|
|
68
68
|
if token.respond_to?(:scrub)
|
69
69
|
token.scrub!
|
70
70
|
else
|
71
|
-
token.encode!("UTF-16le", undef: :replace, invalid: :replace).encode!(
|
71
|
+
token.encode!("UTF-16le", undef: :replace, invalid: :replace).encode!("UTF-8")
|
72
72
|
end
|
73
73
|
case status
|
74
74
|
when 1 # yajl_gen_keys_must_be_strings
|
data/lib/ffi_yajl/ext.rb
CHANGED
@@ -20,16 +20,16 @@
|
|
20
20
|
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
21
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
22
|
|
23
|
-
require
|
23
|
+
require "rubygems"
|
24
24
|
|
25
|
-
require
|
26
|
-
require
|
27
|
-
require
|
28
|
-
require
|
25
|
+
require "ffi_yajl/encoder"
|
26
|
+
require "ffi_yajl/parser"
|
27
|
+
require "ffi_yajl/ext/dlopen"
|
28
|
+
require "ffi_yajl/map_library_name"
|
29
29
|
|
30
30
|
# needed so the encoder c-code can find these symbols
|
31
|
-
require
|
32
|
-
require
|
31
|
+
require "stringio"
|
32
|
+
require "date"
|
33
33
|
|
34
34
|
module FFI_Yajl
|
35
35
|
extend FFI_Yajl::MapLibraryName
|
@@ -38,12 +38,12 @@ module FFI_Yajl
|
|
38
38
|
dlopen_yajl_library
|
39
39
|
|
40
40
|
class Parser
|
41
|
-
require
|
41
|
+
require "ffi_yajl/ext/parser"
|
42
42
|
include FFI_Yajl::Ext::Parser
|
43
43
|
end
|
44
44
|
|
45
45
|
class Encoder
|
46
|
-
require
|
46
|
+
require "ffi_yajl/ext/encoder"
|
47
47
|
include FFI_Yajl::Ext::Encoder
|
48
48
|
end
|
49
49
|
end
|
data/lib/ffi_yajl/ffi.rb
CHANGED
@@ -20,18 +20,18 @@
|
|
20
20
|
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
21
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
22
|
|
23
|
-
require
|
23
|
+
require "rubygems"
|
24
24
|
|
25
|
-
require
|
25
|
+
require "libyajl2"
|
26
26
|
begin
|
27
|
-
require
|
27
|
+
require "ffi"
|
28
28
|
rescue LoadError
|
29
29
|
$stderr.puts "FATAL: to use the ffi extension instead of the compiled C extension, the ffi gem must be installed"
|
30
30
|
$stderr.puts " (it is optional, so you must include it in your bundle manually)"
|
31
31
|
exit 1
|
32
32
|
end
|
33
33
|
|
34
|
-
require
|
34
|
+
require "ffi_yajl/map_library_name"
|
35
35
|
|
36
36
|
module FFI_Yajl
|
37
37
|
extend ::FFI::Library
|
@@ -137,17 +137,17 @@ module FFI_Yajl
|
|
137
137
|
attach_function :yajl_gen_clear, [:yajl_gen], :void
|
138
138
|
end
|
139
139
|
|
140
|
-
require
|
141
|
-
require
|
140
|
+
require "ffi_yajl/encoder"
|
141
|
+
require "ffi_yajl/parser"
|
142
142
|
|
143
143
|
module FFI_Yajl
|
144
144
|
class Parser
|
145
|
-
require
|
145
|
+
require "ffi_yajl/ffi/parser"
|
146
146
|
include FFI_Yajl::FFI::Parser
|
147
147
|
end
|
148
148
|
|
149
149
|
class Encoder
|
150
|
-
require
|
150
|
+
require "ffi_yajl/ffi/encoder"
|
151
151
|
include FFI_Yajl::FFI::Encoder
|
152
152
|
end
|
153
153
|
end
|
data/lib/ffi_yajl/ffi/encoder.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Copyright (c) 2015 Lamont Granquist
|
2
|
-
# Copyright (c) 2015 Chef Software
|
2
|
+
# Copyright (c) 2015-2017, Chef Software Inc.
|
3
3
|
#
|
4
4
|
# Permission is hereby granted, free of charge, to any person obtaining
|
5
5
|
# a copy of this software and associated documentation files (the
|
@@ -20,8 +20,8 @@
|
|
20
20
|
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
21
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
22
|
|
23
|
-
require
|
24
|
-
require
|
23
|
+
require "date"
|
24
|
+
require "stringio"
|
25
25
|
|
26
26
|
module FFI_Yajl
|
27
27
|
module FFI
|
@@ -73,7 +73,7 @@ class Hash
|
|
73
73
|
end
|
74
74
|
else
|
75
75
|
if ( status = FFI_Yajl.yajl_gen_map_open(yajl_gen) ) != 0
|
76
|
-
FFI_Yajl::Encoder.raise_error_for_status(status,
|
76
|
+
FFI_Yajl::Encoder.raise_error_for_status(status, "{")
|
77
77
|
end
|
78
78
|
each do |key, value|
|
79
79
|
# Perf Fix: mutate state hash rather than creating new copy
|
@@ -83,7 +83,7 @@ class Hash
|
|
83
83
|
value.ffi_yajl(yajl_gen, state)
|
84
84
|
end
|
85
85
|
if ( status = FFI_Yajl.yajl_gen_map_close(yajl_gen) ) != 0
|
86
|
-
FFI_Yajl::Encoder.raise_error_for_status(status,
|
86
|
+
FFI_Yajl::Encoder.raise_error_for_status(status, "}")
|
87
87
|
end
|
88
88
|
end
|
89
89
|
end
|
@@ -98,13 +98,13 @@ class Array
|
|
98
98
|
end
|
99
99
|
else
|
100
100
|
if ( status = FFI_Yajl.yajl_gen_array_open(yajl_gen) ) != 0
|
101
|
-
FFI_Yajl::Encoder.raise_error_for_status(status,
|
101
|
+
FFI_Yajl::Encoder.raise_error_for_status(status, "[")
|
102
102
|
end
|
103
103
|
each do |value|
|
104
104
|
value.ffi_yajl(yajl_gen, state)
|
105
105
|
end
|
106
106
|
if ( status = FFI_Yajl.yajl_gen_array_close(yajl_gen) ) != 0
|
107
|
-
FFI_Yajl::Encoder.raise_error_for_status(status,
|
107
|
+
FFI_Yajl::Encoder.raise_error_for_status(status, "]")
|
108
108
|
end
|
109
109
|
end
|
110
110
|
end
|
@@ -155,25 +155,7 @@ class FalseClass
|
|
155
155
|
end
|
156
156
|
end
|
157
157
|
|
158
|
-
class
|
159
|
-
def ffi_yajl(yajl_gen, state)
|
160
|
-
str = to_s
|
161
|
-
if str == "NaN" || str == "Infinity" || str == "-Infinity"
|
162
|
-
raise ::FFI_Yajl::EncodeError, "'#{str}' is an invalid number"
|
163
|
-
end
|
164
|
-
if state[:processing_key]
|
165
|
-
if ( status = FFI_Yajl.yajl_gen_string(yajl_gen, str, str.bytesize) ) != 0
|
166
|
-
FFI_Yajl::Encoder.raise_error_for_status(status, str)
|
167
|
-
end
|
168
|
-
else
|
169
|
-
if ( status = FFI_Yajl.yajl_gen_integer(yajl_gen, self) ) != 0
|
170
|
-
FFI_Yajl::Encoder.raise_error_for_status(status, str)
|
171
|
-
end
|
172
|
-
end
|
173
|
-
end
|
174
|
-
end
|
175
|
-
|
176
|
-
class Bignum
|
158
|
+
class Integer
|
177
159
|
def ffi_yajl(yajl_gen, state)
|
178
160
|
str = to_s
|
179
161
|
if str == "NaN" || str == "Infinity" || str == "-Infinity"
|
@@ -265,7 +247,7 @@ end
|
|
265
247
|
# I feel dirty
|
266
248
|
class Object
|
267
249
|
def ffi_yajl(yajl_gen, state)
|
268
|
-
if !state[:processing_key] &&
|
250
|
+
if !state[:processing_key] && respond_to?(:to_json)
|
269
251
|
str = to_json(state[:json_opts])
|
270
252
|
# #yajl_gen_number outputs a string without quotes around it
|
271
253
|
status = FFI_Yajl.yajl_gen_number(yajl_gen, str, str.bytesize)
|
data/lib/ffi_yajl/ffi/parser.rb
CHANGED
@@ -65,7 +65,7 @@ module FFI_Yajl
|
|
65
65
|
end
|
66
66
|
@number_callback = ::FFI::Function.new(:int, [:pointer, :string, :size_t ]) do |ctx, stringval, stringlen|
|
67
67
|
s = stringval.slice(0, stringlen)
|
68
|
-
s.force_encoding(
|
68
|
+
s.force_encoding("UTF-8") if defined? Encoding
|
69
69
|
# XXX: I can't think of a better way to do this right now. need to call to_f if and only if its a float.
|
70
70
|
v = ( s =~ /[\.eE]/ ) ? s.to_f : s.to_i
|
71
71
|
set_value(v)
|
@@ -77,7 +77,7 @@ module FFI_Yajl
|
|
77
77
|
end
|
78
78
|
@string_callback = ::FFI::Function.new(:int, [:pointer, :string, :size_t]) do |ctx, stringval, stringlen|
|
79
79
|
s = stringval.slice(0, stringlen)
|
80
|
-
s.force_encoding(
|
80
|
+
s.force_encoding("UTF-8") if defined? Encoding
|
81
81
|
set_value(s)
|
82
82
|
1
|
83
83
|
end
|
@@ -88,7 +88,7 @@ module FFI_Yajl
|
|
88
88
|
end
|
89
89
|
@map_key_callback = ::FFI::Function.new(:int, [:pointer, :string, :size_t]) do |ctx, key, keylen|
|
90
90
|
s = key.slice(0, keylen)
|
91
|
-
s.force_encoding(
|
91
|
+
s.force_encoding("UTF-8") if defined? Encoding
|
92
92
|
self.key = @opts[:symbolize_keys] ? s.to_sym : s
|
93
93
|
1
|
94
94
|
end
|
@@ -143,12 +143,12 @@ module FFI_Yajl
|
|
143
143
|
::FFI_Yajl.yajl_config(yajl_handle, :yajl_allow_partial_values, :int, 1)
|
144
144
|
end
|
145
145
|
|
146
|
-
if
|
146
|
+
if ::FFI_Yajl.yajl_parse(yajl_handle, str, str.bytesize) != :yajl_status_ok
|
147
147
|
# FIXME: dup the error and call yajl_free_error?
|
148
148
|
error = ::FFI_Yajl.yajl_get_error(yajl_handle, 1, str, str.bytesize)
|
149
149
|
raise ::FFI_Yajl::ParseError, error
|
150
150
|
end
|
151
|
-
if
|
151
|
+
if ::FFI_Yajl.yajl_complete_parse(yajl_handle) != :yajl_status_ok
|
152
152
|
# FIXME: dup the error and call yajl_free_error?
|
153
153
|
error = ::FFI_Yajl.yajl_get_error(yajl_handle, 1, str, str.bytesize)
|
154
154
|
raise ::FFI_Yajl::ParseError, error
|
@@ -20,7 +20,7 @@
|
|
20
20
|
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
21
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
22
|
|
23
|
-
require
|
23
|
+
require "libyajl2"
|
24
24
|
|
25
25
|
# Mixin for use in finding the right yajl library on the system. The 'caller'
|
26
26
|
# needs to also mixin either the FFI module or the DLopen module. Those are
|
@@ -36,7 +36,7 @@ module FFI_Yajl
|
|
36
36
|
# @api private
|
37
37
|
# @return Array<String> lower case ruby host_os string
|
38
38
|
def host_os
|
39
|
-
RbConfig::CONFIG[
|
39
|
+
RbConfig::CONFIG["host_os"].downcase
|
40
40
|
end
|
41
41
|
|
42
42
|
# Array of yajl library names on the platform. Some platforms like Windows
|
@@ -103,7 +103,7 @@ module FFI_Yajl
|
|
103
103
|
rescue LoadError
|
104
104
|
end
|
105
105
|
end
|
106
|
-
ffi_lib
|
106
|
+
ffi_lib "yajl" unless found
|
107
107
|
end
|
108
108
|
end
|
109
109
|
end
|
data/lib/ffi_yajl/parser.rb
CHANGED
@@ -65,10 +65,10 @@ module FFI_Yajl
|
|
65
65
|
raise ArgumentError, "options check_utf8 and dont_validate_strings are both true which conflict"
|
66
66
|
end
|
67
67
|
|
68
|
-
yajl_opts[:yajl_allow_comments]
|
68
|
+
yajl_opts[:yajl_allow_comments] = true
|
69
69
|
|
70
70
|
if @opts.key?(:allow_comments)
|
71
|
-
yajl_opts[:yajl_allow_comments]
|
71
|
+
yajl_opts[:yajl_allow_comments] = @opts[:allow_comments]
|
72
72
|
end
|
73
73
|
|
74
74
|
yajl_opts[:yajl_dont_validate_strings] = (@opts[:check_utf8] == false || @opts[:dont_validate_strings])
|
data/lib/ffi_yajl/version.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Copyright (c) 2015 Lamont Granquist
|
2
|
-
# Copyright (c) 2015 Chef Software
|
2
|
+
# Copyright (c) 2015-2017, Chef Software Inc.
|
3
3
|
#
|
4
4
|
# Permission is hereby granted, free of charge, to any person obtaining
|
5
5
|
# a copy of this software and associated documentation files (the
|
@@ -21,5 +21,5 @@
|
|
21
21
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
22
|
|
23
23
|
module FFI_Yajl
|
24
|
-
VERSION = "2.3.
|
24
|
+
VERSION = "2.3.1"
|
25
25
|
end
|
@@ -21,8 +21,8 @@
|
|
21
21
|
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
22
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23
23
|
|
24
|
-
require
|
25
|
-
require
|
24
|
+
require "spec_helper"
|
25
|
+
require "date"
|
26
26
|
|
27
27
|
describe "FFI_Yajl::Encoder" do
|
28
28
|
let(:options) { {} }
|
@@ -30,7 +30,7 @@ describe "FFI_Yajl::Encoder" do
|
|
30
30
|
let(:encoder) { FFI_Yajl::Encoder.new(options) }
|
31
31
|
|
32
32
|
it "encodes hashes in keys as strings", ruby_gte_193: true do
|
33
|
-
ruby = { {
|
33
|
+
ruby = { { "a" => "b" } => 2 }
|
34
34
|
expect(encoder.encode(ruby)).to eq('{"{\"a\"=>\"b\"}":2}')
|
35
35
|
end
|
36
36
|
|
@@ -126,23 +126,23 @@ describe "FFI_Yajl::Encoder" do
|
|
126
126
|
end
|
127
127
|
|
128
128
|
it "can encode Date objects" do
|
129
|
-
ruby = Date.parse(
|
129
|
+
ruby = Date.parse("2001-02-03")
|
130
130
|
expect(encoder.encode(ruby)).to eq( '"2001-02-03"' )
|
131
131
|
end
|
132
132
|
|
133
133
|
it "can encode StringIOs" do
|
134
|
-
ruby = { "foo" => StringIO.new(
|
134
|
+
ruby = { "foo" => StringIO.new("THING") }
|
135
135
|
expect(encoder.encode(ruby)).to eq("{\"foo\":\"THING\"}")
|
136
136
|
end
|
137
137
|
|
138
138
|
context "when encoding Time objects in UTC timezone" do
|
139
139
|
before do
|
140
|
-
@saved_tz = ENV[
|
141
|
-
ENV[
|
140
|
+
@saved_tz = ENV["TZ"]
|
141
|
+
ENV["TZ"] = "UTC"
|
142
142
|
end
|
143
143
|
|
144
144
|
after do
|
145
|
-
ENV[
|
145
|
+
ENV["TZ"] = @saved_tz
|
146
146
|
end
|
147
147
|
|
148
148
|
it "encodes them correctly" do
|
@@ -152,7 +152,7 @@ describe "FFI_Yajl::Encoder" do
|
|
152
152
|
end
|
153
153
|
|
154
154
|
it "can encode DateTime objects" do
|
155
|
-
ruby = DateTime.parse(
|
155
|
+
ruby = DateTime.parse("2001-02-03T04:05:06.1+07:00")
|
156
156
|
expect(encoder.encode(ruby)).to eq( '"2001-02-03T04:05:06+07:00"' )
|
157
157
|
end
|
158
158
|
|
@@ -191,7 +191,7 @@ describe "FFI_Yajl::Encoder" do
|
|
191
191
|
end
|
192
192
|
|
193
193
|
context "when validate_utf8 is off" do
|
194
|
-
let(:options) {
|
194
|
+
let(:options) { { validate_utf8: false } }
|
195
195
|
|
196
196
|
it "does not raise an error" do
|
197
197
|
expect { encoder.encode(ruby) }.not_to raise_error
|
@@ -20,7 +20,7 @@
|
|
20
20
|
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
21
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
22
|
|
23
|
-
require
|
23
|
+
require "spec_helper"
|
24
24
|
|
25
25
|
class Test
|
26
26
|
extend FFI_Yajl::MapLibraryName
|
@@ -107,7 +107,7 @@ describe "FFI_Yajl::MapLibraryName" do
|
|
107
107
|
allow(File).to receive(:file?).with(path).and_return(true)
|
108
108
|
allow(Test).to receive(:ffi_lib).with(path).and_raise(LoadError)
|
109
109
|
end
|
110
|
-
allow(Test).to receive(:ffi_lib).with(
|
110
|
+
allow(Test).to receive(:ffi_lib).with("yajl").and_return(nil)
|
111
111
|
Test.send(:ffi_open_yajl_library)
|
112
112
|
end
|
113
113
|
end
|
@@ -21,12 +21,12 @@
|
|
21
21
|
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
22
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23
23
|
|
24
|
-
require
|
24
|
+
require "spec_helper"
|
25
25
|
|
26
26
|
describe "FFI_Yajl::Parser" do
|
27
27
|
shared_examples_for "correct json parsing" do
|
28
28
|
context "when json has 23456789012E666" do
|
29
|
-
let(:json) {
|
29
|
+
let(:json) { '{"key": 23456789012E666}' }
|
30
30
|
|
31
31
|
it "should return infinity" do
|
32
32
|
infinity = (1.0 / 0)
|
@@ -271,10 +271,10 @@ describe "FFI_Yajl::Parser" do
|
|
271
271
|
Encoding.default_internal = @saved_encoding
|
272
272
|
end
|
273
273
|
it "encodes keys to UTF-8" do
|
274
|
-
expect(parser.keys.first.encoding).to eql(Encoding.find(
|
274
|
+
expect(parser.keys.first.encoding).to eql(Encoding.find("utf-8"))
|
275
275
|
end
|
276
276
|
it "encodes values to UTF-8" do
|
277
|
-
expect(parser.values.first.encoding).to eql(Encoding.find(
|
277
|
+
expect(parser.values.first.encoding).to eql(Encoding.find("utf-8"))
|
278
278
|
end
|
279
279
|
end
|
280
280
|
|
@@ -349,7 +349,7 @@ describe "FFI_Yajl::Parser" do
|
|
349
349
|
# NOTE: we are choosing to be compatible with yajl-ruby here vs. JSON
|
350
350
|
# gem and libyajl C behavior (which is to throw an exception in this case)
|
351
351
|
context "when the JSON is empty string" do
|
352
|
-
let(:json) {
|
352
|
+
let(:json) { "" }
|
353
353
|
|
354
354
|
it "returns nil" do
|
355
355
|
expect(parser).to be_nil
|
@@ -475,7 +475,7 @@ describe "FFI_Yajl::Parser" do
|
|
475
475
|
# NOTE: parsing floats with 8 million digits on windows has some kind of huge
|
476
476
|
# perf issues likely in ruby and/or the underlying windows libs
|
477
477
|
context "when parsing big floats", ruby_gte_193: true, unix_only: true do
|
478
|
-
let(:json) {
|
478
|
+
let(:json) { "[0." + "1" * 2**23 + "]" }
|
479
479
|
|
480
480
|
it "parses" do
|
481
481
|
expect { parser }.not_to raise_error
|
@@ -483,7 +483,7 @@ describe "FFI_Yajl::Parser" do
|
|
483
483
|
end
|
484
484
|
|
485
485
|
context "when parsing long hash keys with symbolize_keys option", ruby_gte_193: true do
|
486
|
-
let(:json) { '{"' +
|
486
|
+
let(:json) { '{"' + "a" * 2**23 + '": 0}' }
|
487
487
|
let(:options) { { symbolize_keys: true } }
|
488
488
|
|
489
489
|
it "parses" do
|
data/spec/spec_helper.rb
CHANGED
@@ -26,18 +26,18 @@ $LOAD_PATH << File.expand_path(File.join(File.dirname( __FILE__ ), "../lib"))
|
|
26
26
|
# linked in the same process). this should work, see:
|
27
27
|
# http://stackoverflow.com/questions/3232822/linking-with-multiple-versions-of-a-library
|
28
28
|
begin
|
29
|
-
require
|
29
|
+
require "yajl"
|
30
30
|
rescue LoadError
|
31
|
-
puts
|
31
|
+
puts "WARN: yajl cannot be loaded, expected if this is jruby"
|
32
32
|
end
|
33
33
|
|
34
|
-
require
|
34
|
+
require "ffi_yajl"
|
35
35
|
|
36
36
|
RSpec.configure do |conf|
|
37
37
|
conf.filter_run_excluding unix_only: true unless RUBY_PLATFORM !~ /mswin|mingw|windows/
|
38
38
|
conf.filter_run_excluding ruby_gte_193: true unless RUBY_VERSION.to_f >= 2.0 || RUBY_VERSION =~ /^1\.9\.3/
|
39
39
|
|
40
|
-
conf.order =
|
40
|
+
conf.order = "random"
|
41
41
|
|
42
42
|
conf.expect_with :rspec do |rspec|
|
43
43
|
rspec.syntax = :expect
|
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ffi-yajl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.1
|
5
5
|
platform: universal-java
|
6
6
|
authors:
|
7
7
|
- Lamont Granquist
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-06-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '10.1'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '10.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '3.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '3.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: pry
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,28 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '1.0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: activesupport
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '4.0'
|
75
|
+
version: '2.0'
|
90
76
|
type: :development
|
91
77
|
prerelease: false
|
92
78
|
version_requirements: !ruby/object:Gem::Requirement
|
93
79
|
requirements:
|
94
80
|
- - "~>"
|
95
81
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
82
|
+
version: '2.0'
|
97
83
|
- !ruby/object:Gem::Dependency
|
98
84
|
name: libyajl2
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -123,7 +109,7 @@ dependencies:
|
|
123
109
|
- !ruby/object:Gem::Version
|
124
110
|
version: '1.5'
|
125
111
|
description: Ruby FFI wrapper around YAJL 2.x
|
126
|
-
email: lamont@
|
112
|
+
email: lamont@chef.io
|
127
113
|
executables:
|
128
114
|
- ffi-yajl-bench
|
129
115
|
extensions: []
|
@@ -178,7 +164,7 @@ files:
|
|
178
164
|
- spec/spec_helper.rb
|
179
165
|
homepage: http://github.com/chef/ffi-yajl
|
180
166
|
licenses:
|
181
|
-
-
|
167
|
+
- MIT
|
182
168
|
metadata: {}
|
183
169
|
post_install_message:
|
184
170
|
rdoc_options: []
|
@@ -188,7 +174,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
188
174
|
requirements:
|
189
175
|
- - ">="
|
190
176
|
- !ruby/object:Gem::Version
|
191
|
-
version: '2.
|
177
|
+
version: '2.2'
|
192
178
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
193
179
|
requirements:
|
194
180
|
- - ">="
|
@@ -196,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
196
182
|
version: '0'
|
197
183
|
requirements: []
|
198
184
|
rubyforge_project:
|
199
|
-
rubygems_version: 2.6.
|
185
|
+
rubygems_version: 2.6.11
|
200
186
|
signing_key:
|
201
187
|
specification_version: 4
|
202
188
|
summary: Ruby FFI wrapper around YAJL 2.x
|