We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2c65043 commit d050851Copy full SHA for d050851
test/strscan/test_stringscanner.rb
@@ -558,6 +558,16 @@ def test_matched_size
558
assert_nil s.matched_size
559
end
560
561
+ def test_empty_encoding_utf8
562
+ ss = create_string_scanner('')
563
+ assert_equal(Encoding::UTF_8, ss.rest.encoding)
564
+ end
565
+
566
+ def test_empty_encoding_ascii_8bit
567
+ ss = create_string_scanner(''.dup.force_encoding("ASCII-8BIT"))
568
+ assert_equal(Encoding::ASCII_8BIT, ss.rest.encoding)
569
570
571
def test_encoding
572
ss = create_string_scanner("\xA1\xA2".dup.force_encoding("euc-jp"))
573
assert_equal(Encoding::EUC_JP, ss.scan(/./e).encoding)
0 commit comments