spec/parsing/one_off_spec.rb in yajl-ruby-1.3.0 vs spec/parsing/one_off_spec.rb in yajl-ruby-1.3.1

- old
+ new

@@ -1,8 +1,15 @@ # encoding: UTF-8 require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb') describe "One-off JSON examples" do + it "should not blow up with a bad surrogate trailer" do + # https://github.com/brianmario/yajl-ruby/issues/176 + bad_json = "{\"e\":{\"\\uD800\\\\DC00\":\"a\"}}" + + Yajl::Parser.new.parse(bad_json) + end + it "should parse 23456789012E666 and return Infinity" do infinity = (1.0/0) silence_warnings do expect(Yajl::Parser.parse(StringIO.new('{"key": 23456789012E666}'))).to eq({"key" => infinity}) end