|
672 | 672 |
|
673 | 673 | # @see http://www.w3.org/TR/rdf-testcases/#ntrip_strings |
674 | 674 | it "should correctly escape ASCII characters (#x0-#x7F)" do |
675 | | - (0x00..0x08).each { |u| expect(writer.escape(u.chr, encoding)).to eq "\\u#{u.to_s(16).upcase.rjust(4, '0')}" } |
676 | | - expect(writer.escape(0x09.chr, encoding)).to eq "\\t" |
| 675 | + (0x00..0x07).each { |u| expect(writer.escape(u.chr, encoding)).to eq "\\u#{u.to_s(16).upcase.rjust(4, '0')}" } |
| 676 | + expect(writer.escape(0x08.chr, encoding)).to eq "\b" |
| 677 | + expect(writer.escape(0x09.chr, encoding)).to eq "\t" |
677 | 678 | expect(writer.escape(0x0A.chr, encoding)).to eq "\\n" |
678 | | - (0x0B..0x0C).each { |u| expect(writer.escape(u.chr, encoding)).to eq "\\u#{u.to_s(16).upcase.rjust(4, '0')}" } |
| 679 | + expect(writer.escape(0x0B.chr, encoding)).to eq "\v" |
| 680 | + expect(writer.escape(0x0C.chr, encoding)).to eq "\f" |
679 | 681 | expect(writer.escape(0x0D.chr, encoding)).to eq "\\r" |
680 | 682 | (0x0E..0x1F).each { |u| expect(writer.escape(u.chr, encoding)).to eq "\\u#{u.to_s(16).upcase.rjust(4, '0')}" } |
681 | 683 | (0x20..0x21).each { |u| expect(writer.escape(u.chr, encoding)).to eq u.chr } |
682 | 684 | expect(writer.escape(0x22.chr, encoding)).to eq "\\\"" |
683 | 685 | (0x23..0x26).each { |u| expect(writer.escape(u.chr, encoding)).to eq u.chr } |
684 | | - expect(writer.escape(0x27.chr, encoding)).to eq "\\'" |
| 686 | + expect(writer.escape(0x27.chr, encoding)).to eq "'" |
685 | 687 | (0x28..0x5B).each { |u| expect(writer.escape(u.chr, encoding)).to eq u.chr } |
686 | 688 | expect(writer.escape(0x5C.chr, encoding)).to eq "\\\\" |
687 | 689 | (0x5D..0x7E).each { |u| expect(writer.escape(u.chr, encoding)).to eq u.chr } |
|
733 | 735 | # @see http://www.w3.org/TR/rdf-testcases/#ntrip_strings |
734 | 736 | it "should correctly escape ASCII characters (#x0-#x7F)" do |
735 | 737 | (0x00..0x07).each { |u| expect(writer.escape(u.chr, encoding)).to eq "\\u#{u.to_s(16).upcase.rjust(4, '0')}" } |
736 | | - expect(writer.escape(0x08.chr, encoding)).to eq (encoding ? "\\b" : "\\u0008") |
737 | | - expect(writer.escape(0x09.chr, encoding)).to eq "\\t" |
| 738 | + expect(writer.escape(0x08.chr, encoding)).to eq "\b" |
| 739 | + expect(writer.escape(0x09.chr, encoding)).to eq "\t" |
738 | 740 | expect(writer.escape(0x0A.chr, encoding)).to eq "\\n" |
739 | | - (0x0B..0x0B).each { |u| expect(writer.escape(u.chr, encoding)).to eq "\\u#{u.to_s(16).upcase.rjust(4, '0')}" } |
740 | | - expect(writer.escape(0x0C.chr, encoding)).to eq (encoding ? "\\f" : "\\u000C") |
| 741 | + expect(writer.escape(0x0B.chr, encoding)).to eq "\v" |
| 742 | + expect(writer.escape(0x0C.chr, encoding)).to eq "\f" |
741 | 743 | expect(writer.escape(0x0D.chr, encoding)).to eq "\\r" |
742 | 744 | (0x0E..0x1F).each { |u| expect(writer.escape(u.chr, encoding)).to eq "\\u#{u.to_s(16).upcase.rjust(4, '0')}" } |
743 | 745 | (0x20..0x21).each { |u| expect(writer.escape(u.chr, encoding)).to eq u.chr } |
744 | 746 | expect(writer.escape(0x22.chr, encoding)).to eq "\\\"" |
745 | 747 | (0x23..0x26).each { |u| expect(writer.escape(u.chr, encoding)).to eq u.chr } |
746 | | - expect(writer.escape(0x27.chr, encoding)).to eq "\\'" |
| 748 | + expect(writer.escape(0x27.chr, encoding)).to eq "'" |
747 | 749 | (0x28..0x5B).each { |u| expect(writer.escape(u.chr, encoding)).to eq u.chr } |
748 | 750 | expect(writer.escape(0x5C.chr, encoding)).to eq "\\\\" |
749 | 751 | (0x5D..0x7E).each { |u| expect(writer.escape(u.chr, encoding)).to eq u.chr } |
|
0 commit comments