Sha256: 6f5780582091308536ac462bb2ee391c6cbb4f8bdf299077bc0f73df51bcaab8
Contents?: true
Size: 1.69 KB
Versions: 1
Compression:
Stored size: 1.69 KB
Contents
require 'rubygems' require 'spec' dir = File.dirname(__FILE__) require File.expand_path("#{dir}/spec_helper") require File.expand_path("#{dir}/../lib/fjson") describe "String with latin1 character set Json" do it 'should format \b' do utf_8_val = [?\b].pack("U") JSON.utf8_to_json(utf_8_val).should == '\b' end it 'should format \t' do utf_8_val = [?\t].pack("U") JSON.utf8_to_json(utf_8_val).should == '\t' end it 'should format \n' do utf_8_val = [?\n].pack("U") JSON.utf8_to_json(utf_8_val).should == '\n' end it 'should format \f' do utf_8_val = [?\f].pack("U") JSON.utf8_to_json(utf_8_val).should == '\f' end it 'should format \r' do utf_8_val = [?\r].pack("U") JSON.utf8_to_json(utf_8_val).should == '\r' end it 'should format ?"' do utf_8_val = [?"].pack("U") JSON.utf8_to_json(utf_8_val).should == '\"' end it 'should format ?\\' do utf_8_val = [?\\].pack("U") JSON.utf8_to_json(utf_8_val).should == '\\\\' end it "should format values between 0x00 and 0x1f" do utf_8_val = [0x0f].pack("U") JSON.utf8_to_json(utf_8_val).should == '\\u000f' utf_8_val = [0x1e].pack("U") JSON.utf8_to_json(utf_8_val).should == '\\u001e' end it "should let ordinary text pass through" do JSON.utf8_to_json("test").should == "test" JSON.utf8_to_json('1').should == '1' end it "should support backslashes" do json = '"\\\\.(?i:gif|jpe?g|png)$"' data = JSON.parse(json) JSON.unparse(data).should == json json = '"\\""' data = JSON.parse(json) JSON.unparse(data).should == json json = '"\/"' data = JSON.parse(json) data.should == '/' JSON.unparse(data).should == json end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fjson-0.1.2 | spec/string_with_latin1_character_set_json_spec.rb |