ruby-changes:28280
From: nobu <ko1@a...>
Date: Wed, 17 Apr 2013 14:20:25 +0900 (JST)
Subject: [ruby-changes:28280] nobu:r40332 (trunk): test_readline.rb: try UTF-8
nobu 2013-04-17 14:20:18 +0900 (Wed, 17 Apr 2013) New Revision: 40332 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=40332 Log: 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. Modified files: trunk/test/readline/test_readline.rb Index: test/readline/test_readline.rb =================================================================== --- test/readline/test_readline.rb (revision 40331) +++ test/readline/test_readline.rb (revision 40332) @@ -291,7 +291,10 @@ class TestReadline < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/test/readline/test_readline.rb#L291 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::TestCas https://github.com/ruby/ruby/blob/trunk/test/readline/test_readline.rb#L420 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::TestCas https://github.com/ruby/ruby/blob/trunk/test/readline/test_readline.rb#L502 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) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/