spec/unibits_spec.rb in unibits-2.12.0 vs spec/unibits_spec.rb in unibits-2.13.0
- old
+ new
@@ -211,24 +211,25 @@
result.must_match /A.*B.*C/m
end
end
describe "invalid UTF-16 encodings" do
- it "- incomplete number of bytes (1/2)" do
- string = "a".b.force_encoding("UTF-16LE")
- result = Paint.unpaint(Unibits.visualize(string))
- result.must_match "incompl."
- result.must_match "�"
- end
+ unless RUBY_ENGINE === "truffleruby"
+ it "- incomplete number of bytes (1/2)" do
+ string = "a".b.force_encoding("UTF-16LE")
+ result = Paint.unpaint(Unibits.visualize(string))
+ result.must_match "incompl."
+ result.must_match "�"
+ end
- it "- incomplete number of bytes (2/2)" do
- string = "🌫".b[0..-2].force_encoding("UTF-16LE")
- result = Paint.unpaint(Unibits.visualize(string))
- result.must_match "incompl."
- result.must_match "�"
+ it "- incomplete number of bytes (2/2)" do
+ string = "🌫".b[0..-2].force_encoding("UTF-16LE")
+ result = Paint.unpaint(Unibits.visualize(string))
+ result.must_match "incompl."
+ result.must_match "�"
+ end
end
-
it "- only lower half surrogate" do
string = "\x3C\xD8\x2Ba".force_encoding("UTF-16LE")
result = Paint.unpaint(Unibits.visualize(string))
result.must_match "hlf.srg."
result.must_match "�"
@@ -243,28 +244,30 @@
end
describe "invalid UTF-32 encodings" do
# please note, currently, too large codepoints and encoded utf16 surrogates are treated as valid encodings
- it "- incomplete number of bytes (1/3)" do
- string = "a".b.force_encoding("UTF-32LE")
- result = Paint.unpaint(Unibits.visualize(string))
- result.must_match "incompl."
- result.must_match "�"
- end
+ unless RUBY_ENGINE === "truffleruby"
+ it "- incomplete number of bytes (1/3)" do
+ string = "a".b.force_encoding("UTF-32LE")
+ result = Paint.unpaint(Unibits.visualize(string))
+ result.must_match "incompl."
+ result.must_match "�"
+ end
- it "- incomplete number of bytes (2/3)" do
- string = "🌫".b[0..-2].force_encoding("UTF-32LE")
- result = Paint.unpaint(Unibits.visualize(string))
- result.must_match "incompl."
- result.must_match "�"
- end
+ it "- incomplete number of bytes (2/3)" do
+ string = "🌫".b[0..-2].force_encoding("UTF-32LE")
+ result = Paint.unpaint(Unibits.visualize(string))
+ result.must_match "incompl."
+ result.must_match "�"
+ end
- it "- incomplete number of bytes (3/3)" do
- string = "🌫".b[0..-2].force_encoding("UTF-32LE")
- result = Paint.unpaint(Unibits.visualize(string))
- result.must_match "incompl."
- result.must_match "�"
+ it "- incomplete number of bytes (3/3)" do
+ string = "🌫".b[0..-2].force_encoding("UTF-32LE")
+ result = Paint.unpaint(Unibits.visualize(string))
+ result.must_match "incompl."
+ result.must_match "�"
+ end
end
it "- too large codepoint (1/2)" do
string = "\x00\x00\x11\x00".force_encoding("UTF-32LE")
result = Paint.unpaint(Unibits.visualize(string))