summaryrefslogtreecommitdiff
path: root/test/ruby/test_encoding.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_encoding.rb')
-rw-r--r--test/ruby/test_encoding.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/test/ruby/test_encoding.rb b/test/ruby/test_encoding.rb
index bae8e763b3..8f73a8fce1 100644
--- a/test/ruby/test_encoding.rb
+++ b/test/ruby/test_encoding.rb
@@ -1,5 +1,5 @@
+# frozen_string_literal: false
require 'test/unit'
-require_relative 'envutil'
class TestEncoding < Test::Unit::TestCase
@@ -110,12 +110,17 @@ class TestEncoding < Test::Unit::TestCase
bin = "a".force_encoding(Encoding::ASCII_8BIT)
asc = "b".force_encoding(Encoding::US_ASCII)
assert_equal(Encoding::ASCII_8BIT, Encoding.compatible?(bin, asc))
+ bin = "\xff".force_encoding(Encoding::ASCII_8BIT).to_sym
+ asc = "b".force_encoding(Encoding::ASCII_8BIT)
+ assert_equal(Encoding::ASCII_8BIT, Encoding.compatible?(bin, asc))
+ assert_equal(Encoding::UTF_8, Encoding.compatible?("\u{3042}".to_sym, ua.to_sym))
end
def test_errinfo_after_autoload
+ assert_separately(%w[--disable=gems], "#{<<~"begin;"}\n#{<<~'end;'}")
bug9038 = '[ruby-core:57949] [Bug #9038]'
- assert_separately(%w[--disable=gems], <<-"end;")
- assert_raise_with_message(SyntaxError, /unknown regexp option - Q/, #{bug9038.dump}) {
+ begin;
+ assert_raise_with_message(SyntaxError, /unknown regexp option - Q/, bug9038) {
eval("/regexp/sQ")
}
end;