spec/unibits_spec.rb in unibits-2.1.0 vs spec/unibits_spec.rb in unibits-2.1.1

- old
+ new

@@ -257,24 +257,29 @@ result = Paint.unpaint(Unibits.visualize(string)) result.must_match "incompl." result.must_match "�" end - # TODO implement when https://bugs.ruby-lang.org/issues/13292 is released + it "- too large codepoint (1/2)" do + string = "\x00\x00\x11\x00".force_encoding("UTF-32LE") + result = Paint.unpaint(Unibits.visualize(string)) + result.must_match "�" + result.must_match "toolarge" + end - # it "- too large codepoint" do - # string = "\x00\x00\x11\x00".force_encoding("UTF-32LE") - # result = Paint.unpaint(Unibits.visualize(string)) - # result.must_match "�" - # result.must_match /toolarge.*toolarge.*toolarge.*toolarge/m - # end + it "- too large codepoint (2/2)" do + string = "\x00\x00\x00\x01".force_encoding("UTF-32LE") + result = Paint.unpaint(Unibits.visualize(string)) + result.must_match "�" + result.must_match "toolarge" + end - # it "- has surrogate" do - # string = "\x00\xD8\x00\x00".force_encoding("UTF-32LE") - # result = Paint.unpaint(Unibits.visualize(string)) - # result.must_match "�" - # result.must_match "sur.gate" - # end + it "- has surrogate" do + string = "\x00\xD8\x00\x00".force_encoding("UTF-32LE") + result = Paint.unpaint(Unibits.visualize(string)) + result.must_match "�" + result.must_match "sur.gate" + end end describe "invalid ASCII encodings" do it "- contains bytes with 8th bit set" do string = "abc\x80efg".force_encoding("ASCII")