Fix inaccuracy in encoding tests
These tests assume Encoding.find('locale') == Encoding.find('external') and fail if they are distinct.
This commit is contained in:
parent
7c165bd7d9
commit
7a51d979cf
@ -546,7 +546,7 @@ module BasetestReadline
|
|||||||
saved_completer_quote_characters = Readline.completer_quote_characters
|
saved_completer_quote_characters = Readline.completer_quote_characters
|
||||||
saved_completer_word_break_characters = Readline.completer_word_break_characters
|
saved_completer_word_break_characters = Readline.completer_word_break_characters
|
||||||
return unless Readline.respond_to?(:quoting_detection_proc=)
|
return unless Readline.respond_to?(:quoting_detection_proc=)
|
||||||
unless Encoding.find("external") == Encoding::UTF_8
|
unless get_default_internal_encoding == Encoding::UTF_8
|
||||||
return if assert_under_utf8
|
return if assert_under_utf8
|
||||||
omit 'this test needs UTF-8 locale'
|
omit 'this test needs UTF-8 locale'
|
||||||
end
|
end
|
||||||
|
@ -285,7 +285,7 @@ class TestRubyOptions < Test::Unit::TestCase
|
|||||||
/unknown encoding name - test_ruby_test_rubyoptions_foobarbazqux \(RuntimeError\)/)
|
/unknown encoding name - test_ruby_test_rubyoptions_foobarbazqux \(RuntimeError\)/)
|
||||||
|
|
||||||
if /mswin|mingw|aix|android/ =~ RUBY_PLATFORM &&
|
if /mswin|mingw|aix|android/ =~ RUBY_PLATFORM &&
|
||||||
(str = "\u3042".force_encoding(Encoding.find("locale"))).valid_encoding?
|
(str = "\u3042".force_encoding(Encoding.find("external"))).valid_encoding?
|
||||||
# This result depends on locale because LANG=C doesn't affect locale
|
# This result depends on locale because LANG=C doesn't affect locale
|
||||||
# on Windows.
|
# on Windows.
|
||||||
# On AIX, the source encoding of stdin with LANG=C is ISO-8859-1,
|
# On AIX, the source encoding of stdin with LANG=C is ISO-8859-1,
|
||||||
@ -838,11 +838,11 @@ class TestRubyOptions < Test::Unit::TestCase
|
|||||||
def test_command_line_glob_nonascii
|
def test_command_line_glob_nonascii
|
||||||
bug10555 = '[ruby-dev:48752] [Bug #10555]'
|
bug10555 = '[ruby-dev:48752] [Bug #10555]'
|
||||||
name = "\u{3042}.txt"
|
name = "\u{3042}.txt"
|
||||||
expected = name.encode("locale") rescue "?.txt"
|
expected = name.encode("external") rescue "?.txt"
|
||||||
with_tmpchdir do |dir|
|
with_tmpchdir do |dir|
|
||||||
open(name, "w") {}
|
open(name, "w") {}
|
||||||
assert_in_out_err(["-e", "puts ARGV", "?.txt"], "", [expected], [],
|
assert_in_out_err(["-e", "puts ARGV", "?.txt"], "", [expected], [],
|
||||||
bug10555, encoding: "locale")
|
bug10555, encoding: "external")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -877,7 +877,7 @@ class TestRubyOptions < Test::Unit::TestCase
|
|||||||
with_tmpchdir do |dir|
|
with_tmpchdir do |dir|
|
||||||
Ougai.each {|f| open(f, "w") {}}
|
Ougai.each {|f| open(f, "w") {}}
|
||||||
assert_in_out_err(["-Eutf-8", "-e", "puts ARGV", "*"], "", Ougai, encoding: "utf-8")
|
assert_in_out_err(["-Eutf-8", "-e", "puts ARGV", "*"], "", Ougai, encoding: "utf-8")
|
||||||
ougai = Ougai.map {|f| f.encode("locale", replace: "?")}
|
ougai = Ougai.map {|f| f.encode("external", replace: "?")}
|
||||||
assert_in_out_err(["-e", "puts ARGV", "*.txt"], "", ougai)
|
assert_in_out_err(["-e", "puts ARGV", "*.txt"], "", ougai)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user