Skip to content

Instantly share code, notes, and snippets.

@fd
Created May 24, 2011 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fd/988743 to your computer and use it in GitHub Desktop.
Save fd/988743 to your computer and use it in GitHub Desktop.
yajl-ruby parser bug.
(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
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment