public
Created

yajl-ruby parser bug.

  • Download Gist
output.txt
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
(in /Users/Simon/Projects/json_select/t)
FF
 
Failures:
 
1) Parser should not swallow the first object after parsing a number(integer)
Failure/Error: ]
expected: ["foo", "bar", 42, "baz", "bax"]
got: ["foo", "bar", 42, "bax"] (using ==)
Diff:
@@ -1,2 +1,2 @@
-["foo", "bar", 42, "baz", "bax"]
+["foo", "bar", 42, "bax"]
# ./parser_spec.rb:23
 
2) Parser should not swallow the first object after parsing a number(float)
Failure/Error: ]
expected: ["foo", "bar", 41.9, "baz", "bax"]
got: ["foo", "bar", 41.9, "bax"] (using ==)
Diff:
@@ -1,2 +1,2 @@
-["foo", "bar", 41.9, "baz", "bax"]
+["foo", "bar", 41.9, "bax"]
# ./parser_spec.rb:44
 
Finished in 0.00263 seconds
2 examples, 2 failures
parser_spec.rb
Ruby
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
require 'yajl'
 
describe "Parser" do
 
it "should not swallow the first object after parsing a number(integer)" do
json_stream = <<-JSON
"foo"
"bar"
42
"baz"
"bax"
JSON
objects = []
Yajl::Parser.parse(json_stream) { |o| objects << o }
objects.should == [
"foo",
"bar",
42,
"baz",
"bax"
]
end
 
it "should not swallow the first object after parsing a number(float)" do
json_stream = <<-JSON
"foo"
"bar"
41.9
"baz"
"bax"
JSON
objects = []
Yajl::Parser.parse(json_stream) { |o| objects << o }
objects.should == [
"foo",
"bar",
41.9,
"baz",
"bax"
]
end
 
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.