yajl-ruby 0.7.1 → 0.7.2
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.
Potentially problematic release.
This version of yajl-ruby might be problematic. Click here for more details.
- data/CHANGELOG.md +8 -1
- data/MIT-LICENSE +3 -3
- data/README.rdoc +8 -8
- data/VERSION.yml +1 -1
- data/benchmark/subjects/ohai.yml +171 -171
- data/ext/api/yajl_common.h +9 -9
- data/ext/api/yajl_gen.h +10 -10
- data/ext/api/yajl_parse.h +15 -15
- data/ext/yajl.c +8 -8
- data/ext/yajl_alloc.c +6 -6
- data/ext/yajl_alloc.h +6 -6
- data/ext/yajl_buf.c +7 -7
- data/ext/yajl_buf.h +7 -7
- data/ext/yajl_bytestack.h +10 -10
- data/ext/yajl_encode.c +12 -12
- data/ext/yajl_encode.h +6 -6
- data/ext/yajl_ext.c +67 -80
- data/ext/yajl_ext.h +4 -4
- data/ext/yajl_gen.c +16 -16
- data/ext/yajl_lex.c +79 -76
- data/ext/yajl_lex.h +14 -14
- data/ext/yajl_parser.c +34 -34
- data/ext/yajl_parser.h +7 -7
- data/lib/yajl.rb +7 -7
- data/lib/yajl/bzip2/stream_reader.rb +1 -11
- data/lib/yajl/bzip2/stream_writer.rb +1 -1
- data/lib/yajl/deflate/stream_reader.rb +6 -7
- data/lib/yajl/deflate/stream_writer.rb +2 -2
- data/lib/yajl/gzip/stream_reader.rb +0 -10
- data/lib/yajl/http_stream.rb +12 -12
- data/lib/yajl/json_gem/encoding.rb +4 -4
- data/lib/yajl/json_gem/parsing.rb +3 -3
- data/spec/encoding/encoding_spec.rb +23 -23
- data/spec/global/global_spec.rb +8 -8
- data/spec/http/http_delete_spec.rb +13 -13
- data/spec/http/http_error_spec.rb +2 -2
- data/spec/http/http_get_spec.rb +15 -15
- data/spec/http/http_post_spec.rb +12 -12
- data/spec/http/http_put_spec.rb +14 -14
- data/spec/json_gem_compatibility/compatibility_spec.rb +21 -21
- data/spec/parsing/active_support_spec.rb +6 -6
- data/spec/parsing/chunked_spec.rb +12 -12
- data/spec/parsing/fixtures_spec.rb +4 -4
- data/spec/parsing/one_off_spec.rb +9 -9
- data/yajl-ruby.gemspec +3 -3
- metadata +12 -5
@@ -6,7 +6,7 @@ describe "Chunked parser" do
|
|
6
6
|
before(:all) do
|
7
7
|
@final = [{"abc" => 123}, {"def" => 456}]
|
8
8
|
end
|
9
|
-
|
9
|
+
|
10
10
|
before(:each) do
|
11
11
|
@callback = lambda { |hash|
|
12
12
|
# no-op
|
@@ -14,25 +14,25 @@ describe "Chunked parser" do
|
|
14
14
|
@parser = Yajl::Parser.new
|
15
15
|
@parser.on_parse_complete = @callback
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
it "should parse a single chunk" do
|
19
19
|
@callback.should_receive(:call).with(@final)
|
20
20
|
@parser << '[{"abc": 123},{"def": 456}]'
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
it "should parse a single chunk, 3 times" do
|
24
24
|
@callback.should_receive(:call).with(@final).exactly(3).times
|
25
25
|
@parser << '[{"abc": 123},{"def": 456}]'
|
26
26
|
@parser << '[{"abc": 123},{"def": 456}]'
|
27
27
|
@parser << '[{"abc": 123},{"def": 456}]'
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
30
|
it "should parse in two chunks" do
|
31
31
|
@callback.should_receive(:call).with(@final)
|
32
32
|
@parser << '[{"abc": 123},'
|
33
33
|
@parser << '{"def": 456}]'
|
34
34
|
end
|
35
|
-
|
35
|
+
|
36
36
|
it "should parse in 2 chunks, twice" do
|
37
37
|
@callback.should_receive(:call).with(@final).exactly(2).times
|
38
38
|
@parser << '[{"abc": 123},'
|
@@ -40,29 +40,29 @@ describe "Chunked parser" do
|
|
40
40
|
@parser << '[{"abc": 123},'
|
41
41
|
@parser << '{"def": 456}]'
|
42
42
|
end
|
43
|
-
|
43
|
+
|
44
44
|
it "should parse 2 JSON strings, in 3 chunks" do
|
45
45
|
@callback.should_receive(:call).with(@final).exactly(2).times
|
46
46
|
@parser << '[{"abc": 123},'
|
47
47
|
@parser << '{"def": 456}][{"abc": 123},{"def":'
|
48
48
|
@parser << ' 456}]'
|
49
49
|
end
|
50
|
-
|
50
|
+
|
51
51
|
it "should parse 2 JSON strings in 1 chunk" do
|
52
52
|
@callback.should_receive(:call).with(@final).exactly(2).times
|
53
53
|
@parser << '[{"abc": 123},{"def": 456}][{"abc": 123},{"def": 456}]'
|
54
54
|
end
|
55
|
-
|
55
|
+
|
56
56
|
it "should parse 2 JSON strings from an IO" do
|
57
57
|
@callback.should_receive(:call).with(@final).exactly(2).times
|
58
58
|
@parser.parse(StringIO.new('[{"abc": 123},{"def": 456}][{"abc": 123},{"def": 456}]'))
|
59
59
|
end
|
60
|
-
|
60
|
+
|
61
61
|
it "should parse a JSON string an IO and fire callback once" do
|
62
62
|
@callback.should_receive(:call).with(@final)
|
63
63
|
@parser.parse(StringIO.new('[{"abc": 123},{"def": 456}]'))
|
64
64
|
end
|
65
|
-
|
65
|
+
|
66
66
|
it "should parse twitter_stream.json and fire callback 430 times" do
|
67
67
|
path = File.expand_path(File.dirname(__FILE__) + '/../../benchmark/subjects/twitter_stream.json')
|
68
68
|
json = File.new(path, 'r')
|
@@ -71,7 +71,7 @@ describe "Chunked parser" do
|
|
71
71
|
@parser.parse(json)
|
72
72
|
}.should_not raise_error(Yajl::ParseError)
|
73
73
|
end
|
74
|
-
|
74
|
+
|
75
75
|
it "should parse twitter_stream.json and fire callback 430 times, with a block as the callback" do
|
76
76
|
path = File.expand_path(File.dirname(__FILE__) + '/../../benchmark/subjects/twitter_stream.json')
|
77
77
|
json = File.new(path, 'r')
|
@@ -85,7 +85,7 @@ describe "Chunked parser" do
|
|
85
85
|
times.should eql(430)
|
86
86
|
}.should_not raise_error(Yajl::ParseError)
|
87
87
|
end
|
88
|
-
|
88
|
+
|
89
89
|
it "should raise a Yajl::ParseError error if multiple JSON strings were found when no on_parse_complete callback assigned" do
|
90
90
|
path = File.expand_path(File.dirname(__FILE__) + '/../../benchmark/subjects/twitter_stream.json')
|
91
91
|
json = File.new(path, 'r')
|
@@ -6,7 +6,7 @@ describe "Parsing JSON Fixtures" do
|
|
6
6
|
passed, failed = Dir[fixtures].partition { |f| f['pass'] }
|
7
7
|
PASSED = passed.inject([]) { |a, f| a << [ f, File.read(f) ] }.sort
|
8
8
|
FAILED = failed.inject([]) { |a, f| a << [ f, File.read(f) ] }.sort
|
9
|
-
|
9
|
+
|
10
10
|
FAILED.each do |name, source|
|
11
11
|
it "should not be able to parse #{File.basename(name)} as an IO" do
|
12
12
|
lambda {
|
@@ -14,7 +14,7 @@ describe "Parsing JSON Fixtures" do
|
|
14
14
|
}.should raise_error(Yajl::ParseError)
|
15
15
|
end
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
FAILED.each do |name, source|
|
19
19
|
it "should not be able to parse #{File.basename(name)} as a string" do
|
20
20
|
lambda {
|
@@ -22,7 +22,7 @@ describe "Parsing JSON Fixtures" do
|
|
22
22
|
}.should raise_error(Yajl::ParseError)
|
23
23
|
end
|
24
24
|
end
|
25
|
-
|
25
|
+
|
26
26
|
PASSED.each do |name, source|
|
27
27
|
it "should be able to parse #{File.basename(name)} as an IO" do
|
28
28
|
lambda {
|
@@ -30,7 +30,7 @@ describe "Parsing JSON Fixtures" do
|
|
30
30
|
}.should_not raise_error(Yajl::ParseError)
|
31
31
|
end
|
32
32
|
end
|
33
|
-
|
33
|
+
|
34
34
|
PASSED.each do |name, source|
|
35
35
|
it "should be able to parse #{File.basename(name)} as a string" do
|
36
36
|
lambda {
|
@@ -8,46 +8,46 @@ describe "One-off JSON examples" do
|
|
8
8
|
Yajl::Parser.parse(StringIO.new('{"key": 23456789012E666}')).should == {"key" => infinity}
|
9
9
|
end
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
it "should not parse JSON with a comment, with :allow_comments set to false" do
|
13
13
|
json = StringIO.new('{"key": /* this is a comment */ "value"}')
|
14
14
|
lambda {
|
15
15
|
Yajl::Parser.parse(json, :allow_comments => false)
|
16
16
|
}.should raise_error(Yajl::ParseError)
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
it "should parse JSON with a comment, with :allow_comments set to true" do
|
20
20
|
json = StringIO.new('{"key": /* this is a comment */ "value"}')
|
21
21
|
lambda {
|
22
22
|
Yajl::Parser.parse(json, :allow_comments => true)
|
23
23
|
}.should_not raise_error(Yajl::ParseError)
|
24
24
|
end
|
25
|
-
|
25
|
+
|
26
26
|
it "should not parse invalid UTF8 with :check_utf8 set to true" do
|
27
27
|
parser = Yajl::Parser.new(:check_utf8 => true)
|
28
28
|
lambda {
|
29
29
|
parser.parse("[\"#{"\201\203"}\"]")
|
30
30
|
}.should raise_error(Yajl::ParseError)
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
it "should parse invalid UTF8 with :check_utf8 set to false" do
|
34
34
|
parser = Yajl::Parser.new(:check_utf8 => false)
|
35
35
|
parser.parse("[\"#{"\201\203"}\"]").inspect
|
36
36
|
end
|
37
|
-
|
37
|
+
|
38
38
|
it "should parse using it's class method, from an IO" do
|
39
39
|
io = StringIO.new('{"key": 1234}')
|
40
40
|
Yajl::Parser.parse(io).should == {"key" => 1234}
|
41
41
|
end
|
42
|
-
|
42
|
+
|
43
43
|
it "should parse using it's class method, from an IO with symbolized keys" do
|
44
44
|
Yajl::Parser.parse('{"key": 1234}', :symbolize_keys => true).should == {:key => 1234}
|
45
45
|
end
|
46
|
-
|
46
|
+
|
47
47
|
it "should parse using it's class method, from a string" do
|
48
48
|
Yajl::Parser.parse('{"key": 1234}').should == {"key" => 1234}
|
49
49
|
end
|
50
|
-
|
50
|
+
|
51
51
|
it "should parse using it's class method, from a string with a block" do
|
52
52
|
output = nil
|
53
53
|
Yajl::Parser.parse('{"key": 1234}') do |obj|
|
@@ -55,7 +55,7 @@ describe "One-off JSON examples" do
|
|
55
55
|
end
|
56
56
|
output.should == {"key" => 1234}
|
57
57
|
end
|
58
|
-
|
58
|
+
|
59
59
|
it "should parse numbers greater than 2,147,483,648" do
|
60
60
|
Yajl::Parser.parse("{\"id\": 2147483649}").should eql({"id" => 2147483649})
|
61
61
|
Yajl::Parser.parse("{\"id\": 5687389800}").should eql({"id" => 5687389800})
|
data/yajl-ruby.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{yajl-ruby}
|
8
|
-
s.version = "0.7.
|
8
|
+
s.version = "0.7.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Brian Lopez", "Lloyd Hilaiel"]
|
12
|
-
s.date = %q{2010-02-
|
12
|
+
s.date = %q{2010-02-23}
|
13
13
|
s.email = %q{seniorlopez@gmail.com}
|
14
14
|
s.extensions = ["ext/extconf.rb"]
|
15
15
|
s.extra_rdoc_files = [
|
@@ -163,7 +163,7 @@ Gem::Specification.new do |s|
|
|
163
163
|
s.rdoc_options = ["--charset=UTF-8"]
|
164
164
|
s.require_paths = ["lib", "ext"]
|
165
165
|
s.rubyforge_project = %q{yajl-ruby}
|
166
|
-
s.rubygems_version = %q{1.3.
|
166
|
+
s.rubygems_version = %q{1.3.6}
|
167
167
|
s.summary = %q{Ruby C bindings to the excellent Yajl JSON stream-based parser library.}
|
168
168
|
s.test_files = [
|
169
169
|
"spec/encoding/encoding_spec.rb",
|
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yajl-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 7
|
8
|
+
- 2
|
9
|
+
version: 0.7.2
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- Brian Lopez
|
@@ -10,7 +15,7 @@ autorequire:
|
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
17
|
|
13
|
-
date: 2010-02-
|
18
|
+
date: 2010-02-23 00:00:00 -08:00
|
14
19
|
default_executable:
|
15
20
|
dependencies: []
|
16
21
|
|
@@ -179,18 +184,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
179
184
|
requirements:
|
180
185
|
- - ">="
|
181
186
|
- !ruby/object:Gem::Version
|
187
|
+
segments:
|
188
|
+
- 0
|
182
189
|
version: "0"
|
183
|
-
version:
|
184
190
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
185
191
|
requirements:
|
186
192
|
- - ">="
|
187
193
|
- !ruby/object:Gem::Version
|
194
|
+
segments:
|
195
|
+
- 0
|
188
196
|
version: "0"
|
189
|
-
version:
|
190
197
|
requirements: []
|
191
198
|
|
192
199
|
rubyforge_project: yajl-ruby
|
193
|
-
rubygems_version: 1.3.
|
200
|
+
rubygems_version: 1.3.6
|
194
201
|
signing_key:
|
195
202
|
specification_version: 3
|
196
203
|
summary: Ruby C bindings to the excellent Yajl JSON stream-based parser library.
|