ruby-changes:22438
From: naruse <ko1@a...>
Date: Wed, 8 Feb 2012 15:42:49 +0900 (JST)
Subject: [ruby-changes:22438] naruse:r34487 (ruby_1_9_3): merge revision(s) 34394,34398:
naruse 2012-02-08 15:42:39 +0900 (Wed, 08 Feb 2012) New Revision: 34487 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=34487 Log: merge revision(s) 34394,34398: ------------------------------------------------------------------------ r34394 | naruse | 2012-01-29 23:24:05 +0900 (Sun, 29 Jan 2012) | 1 line Skip test if locale is not Japanese nor UTF-8. ------------------------------------------------------------------------ Modified files: branches/ruby_1_9_3/test/readline/test_readline.rb branches/ruby_1_9_3/version.h Index: ruby_1_9_3/version.h =================================================================== --- ruby_1_9_3/version.h (revision 34486) +++ ruby_1_9_3/version.h (revision 34487) @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.3" -#define RUBY_PATCHLEVEL 64 +#define RUBY_PATCHLEVEL 65 #define RUBY_RELEASE_DATE "2012-02-08" #define RUBY_RELEASE_YEAR 2012 Index: ruby_1_9_3/test/readline/test_readline.rb =================================================================== --- ruby_1_9_3/test/readline/test_readline.rb (revision 34486) +++ ruby_1_9_3/test/readline/test_readline.rb (revision 34487) @@ -255,8 +255,9 @@ def test_completion_encoding bug5941 = '[Bug #5941]' + append_character = Readline.completion_append_character + Readline.completion_append_character = "" completion_case_fold = Readline.completion_case_fold - Readline.completion_case_fold = false locale = Encoding.find("locale") if locale == Encoding::UTF_8 enc1 = Encoding::EUC_JP @@ -266,14 +267,31 @@ results = nil Readline.completion_proc = ->(text) {results} - results = ["\u{3042 3042}", "\u{3042 3044}"].map {|s| s.encode(locale)} - assert_equal("\u{3042}", with_pipe {|r, w| w << "\t"}, bug5941) + [%W"\u{3042 3042} \u{3042 3044}", %W"\u{fe5b fe5b} \u{fe5b fe5c}"].any? do |w| + begin + results = w.map {|s| s.encode(locale)} + rescue Encoding::UndefinedConversionError + end + end or + begin + "\xa1\xa2".encode(Encoding::UTF_8, locale) + rescue + else + results = %W"\xa1\xa1 \xa1\xa2".map {|s| s.force_encoding(locale)} + end or + skip("missing test for locale #{locale.name}") + expected = results[0][0...1] Readline.completion_case_fold = false - assert_equal("\u{3042}", with_pipe {|r, w| w << "\t"}, bug5941) - results = ["\u{3042 3042}", "\u{3042 3044}"].map {|s| s.encode(enc1)} - assert_raise(Encoding::CompatibilityError, bug5941) {with_pipe {|r, w| w << "\t"}} + assert_equal(expected, with_pipe {|r, w| w << "\t"}, bug5941) + Readline.completion_case_fold = true + assert_equal(expected, with_pipe {|r, w| w << "\t"}, bug5941) + results.map! {|s| s.encode(enc1)} + assert_raise(Encoding::CompatibilityError, bug5941) do + with_pipe {|r, w| w << "\t"} + end ensure Readline.completion_case_fold = completion_case_fold + Readline.completion_append_character = append_character end # basic_word_break_characters -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/