|
848 | 848 | # @see http://www.w3.org/TR/rdf-testcases/#ntrip_strings |
849 | 849 | it "should correctly escape ASCII characters (#x0-#x7F)" do |
850 | 850 | (0x00..0x07).each { |u| expect(writer.escape(u.chr, encoding)).to eq "\\u#{u.to_s(16).upcase.rjust(4, '0')}" } |
851 | | - expect(writer.escape(0x08.chr, encoding)).to eq "\b" |
852 | | - expect(writer.escape(0x09.chr, encoding)).to eq "\t" |
| 851 | + expect(writer.escape(0x08.chr, encoding)).to eq "\\b" |
| 852 | + expect(writer.escape(0x09.chr, encoding)).to eq "\\t" |
853 | 853 | expect(writer.escape(0x0A.chr, encoding)).to eq "\\n" |
854 | | - expect(writer.escape(0x0B.chr, encoding)).to eq "\v" |
855 | | - expect(writer.escape(0x0C.chr, encoding)).to eq "\f" |
| 854 | + expect(writer.escape(0x0B.chr, encoding)).to eq "\\u000B" |
| 855 | + expect(writer.escape(0x0C.chr, encoding)).to eq "\\f" |
856 | 856 | expect(writer.escape(0x0D.chr, encoding)).to eq "\\r" |
857 | 857 | (0x0E..0x1F).each { |u| expect(writer.escape(u.chr, encoding)).to eq "\\u#{u.to_s(16).upcase.rjust(4, '0')}" } |
858 | 858 | (0x20..0x21).each { |u| expect(writer.escape(u.chr, encoding)).to eq u.chr } |
859 | 859 | expect(writer.escape(0x22.chr, encoding)).to eq "\\\"" |
860 | 860 | (0x23..0x26).each { |u| expect(writer.escape(u.chr, encoding)).to eq u.chr } |
861 | | - expect(writer.escape(0x27.chr, encoding)).to eq "'" |
| 861 | + expect(writer.escape(0x27.chr, encoding)).to eq "\\'" |
862 | 862 | (0x28..0x5B).each { |u| expect(writer.escape(u.chr, encoding)).to eq u.chr } |
863 | 863 | expect(writer.escape(0x5C.chr, encoding)).to eq "\\\\" |
864 | 864 | (0x5D..0x7E).each { |u| expect(writer.escape(u.chr, encoding)).to eq u.chr } |
|
910 | 910 | # @see http://www.w3.org/TR/rdf-testcases/#ntrip_strings |
911 | 911 | it "should correctly escape ASCII characters (#x0-#x7F)" do |
912 | 912 | (0x00..0x07).each { |u| expect(writer.escape(u.chr, encoding)).to eq "\\u#{u.to_s(16).upcase.rjust(4, '0')}" } |
913 | | - expect(writer.escape(0x08.chr, encoding)).to eq "\b" |
914 | | - expect(writer.escape(0x09.chr, encoding)).to eq "\t" |
| 913 | + expect(writer.escape(0x08.chr, encoding)).to eq "\\b" |
| 914 | + expect(writer.escape(0x09.chr, encoding)).to eq "\\t" |
915 | 915 | expect(writer.escape(0x0A.chr, encoding)).to eq "\\n" |
916 | | - expect(writer.escape(0x0B.chr, encoding)).to eq "\v" |
917 | | - expect(writer.escape(0x0C.chr, encoding)).to eq "\f" |
| 916 | + expect(writer.escape(0x0B.chr, encoding)).to eq "\\u000B" |
| 917 | + expect(writer.escape(0x0C.chr, encoding)).to eq "\\f" |
918 | 918 | expect(writer.escape(0x0D.chr, encoding)).to eq "\\r" |
919 | 919 | (0x0E..0x1F).each { |u| expect(writer.escape(u.chr, encoding)).to eq "\\u#{u.to_s(16).upcase.rjust(4, '0')}" } |
920 | 920 | (0x20..0x21).each { |u| expect(writer.escape(u.chr, encoding)).to eq u.chr } |
921 | 921 | expect(writer.escape(0x22.chr, encoding)).to eq "\\\"" |
922 | 922 | (0x23..0x26).each { |u| expect(writer.escape(u.chr, encoding)).to eq u.chr } |
923 | | - expect(writer.escape(0x27.chr, encoding)).to eq "'" |
| 923 | + expect(writer.escape(0x27.chr, encoding)).to eq "\\'" |
924 | 924 | (0x28..0x5B).each { |u| expect(writer.escape(u.chr, encoding)).to eq u.chr } |
925 | 925 | expect(writer.escape(0x5C.chr, encoding)).to eq "\\\\" |
926 | 926 | (0x5D..0x7E).each { |u| expect(writer.escape(u.chr, encoding)).to eq u.chr } |
|
0 commit comments