aboutsummaryrefslogtreecommitdiffstats
path: root/test/readline
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-17 05:20:18 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-17 05:20:18 +0000
commit385de15d5534ed43597319fd926e033449cc4e68 (patch)
tree715f4a4a1467a9e11b4d8f15dec72520a89595bb /test/readline
parenta24b6d3f67a4eb1a163db2a9879b862d68ce898a (diff)
downloadruby-385de15d5534ed43597319fd926e033449cc4e68.tar.gz
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
Diffstat (limited to 'test/readline')
-rw-r--r--test/readline/test_readline.rb19
1 files changed, 18 insertions, 1 deletions
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__], <<SRC)
+#skip "test \#{ENV['LC_ALL']}"
+#{self.class.name}.new(#{loc.dump}).run(Test::Unit::Runner.new)
+SRC
+ return true
+ end
end if defined?(::Readline)