From 385de15d5534ed43597319fd926e033449cc4e68 Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 17 Apr 2013 05:20:18 +0000 Subject: test_readline.rb: try UTF-8 * test/readline/test_readline.rb (test_completion_encoding), (test_input_metachar_multibyte): try to run under UTF-8 locale, before skipping. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40332 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/readline/test_readline.rb | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/test/readline/test_readline.rb b/test/readline/test_readline.rb index 84cfcf2ae3..88ad10195b 100644 --- a/test/readline/test_readline.rb +++ b/test/readline/test_readline.rb @@ -291,7 +291,10 @@ class TestReadline < Test::Unit::TestCase else results = %W"\xa1\xa1 \xa1\xa2".map {|s| s.force_encoding(locale)} end or + begin + return if assert_under_utf8 skip("missing test for locale #{locale.name}") + end expected = results[0][0...1] Readline.completion_case_fold = false assert_equal(expected, with_pipe {|r, w| w << "\t"}, bug5941) @@ -417,7 +420,10 @@ class TestReadline < Test::Unit::TestCase end if !/EditLine/n.match(Readline::VERSION) def test_input_metachar_multibyte - skip 'this test needs UTF-8 locale' unless Encoding.find("locale") == Encoding::UTF_8 + unless Encoding.find("locale") == Encoding::UTF_8 + return if assert_under_utf8 + skip 'this test needs UTF-8 locale' + end bug6602 = '[ruby-core:45683]' Readline::HISTORY << "\u3042\u3093" Readline::HISTORY << "\u3044\u3093" @@ -496,4 +502,15 @@ class TestReadline < Test::Unit::TestCase def get_default_internal_encoding return Encoding.default_internal || Encoding.find("locale") end + + def assert_under_utf8 + return false if ENV['LC_ALL'] == 'UTF-8' + loc = caller_locations(1, 1)[0].base_label.to_s + require_relative "../ruby/envutil" + assert_separately([{"LC_ALL"=>"UTF-8"}, "-r", __FILE__], <