ruby-changes:29312
From: nagachika <ko1@a...>
Date: Tue, 18 Jun 2013 02:25:11 +0900 (JST)
Subject: [ruby-changes:29312] nagachika:r41364 (ruby_2_0_0): merge revision(s) 39721:
nagachika 2013-06-18 02:24:56 +0900 (Tue, 18 Jun 2013) New Revision: 41364 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41364 Log: merge revision(s) 39721: * test/ruby/envutil.rb (EnvUtil.with_default_external): add for changing Encoding.default_external without warnings. * test/ruby/envutil.rb (EnvUtil.with_default_internal): ditto. * test/ruby/test_io_m17n.rb: use above with_default_external. Modified directories: branches/ruby_2_0_0/ Modified files: branches/ruby_2_0_0/ChangeLog branches/ruby_2_0_0/test/ruby/envutil.rb branches/ruby_2_0_0/test/ruby/test_io_m17n.rb branches/ruby_2_0_0/version.h Index: ruby_2_0_0/ChangeLog =================================================================== --- ruby_2_0_0/ChangeLog (revision 41363) +++ ruby_2_0_0/ChangeLog (revision 41364) @@ -1,3 +1,12 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1 +Tue Jun 18 02:21:54 2013 NARUSE, Yui <naruse@r...> + + * test/ruby/envutil.rb (EnvUtil.with_default_external): add for + changing Encoding.default_external without warnings. + + * test/ruby/envutil.rb (EnvUtil.with_default_internal): ditto. + + * test/ruby/test_io_m17n.rb: use above with_default_external. + Tue Jun 18 00:43:27 2013 Zachary Scott <zachary@z...> * vm_backtrace.c: Update rdoc for Backtrace#label with @_ko1 Index: ruby_2_0_0/version.h =================================================================== --- ruby_2_0_0/version.h (revision 41363) +++ ruby_2_0_0/version.h (revision 41364) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1 #define RUBY_VERSION "2.0.0" #define RUBY_RELEASE_DATE "2013-06-18" -#define RUBY_PATCHLEVEL 224 +#define RUBY_PATCHLEVEL 225 #define RUBY_RELEASE_YEAR 2013 #define RUBY_RELEASE_MONTH 6 Index: ruby_2_0_0/test/ruby/test_io_m17n.rb =================================================================== --- ruby_2_0_0/test/ruby/test_io_m17n.rb (revision 41363) +++ ruby_2_0_0/test/ruby/test_io_m17n.rb (revision 41364) @@ -479,14 +479,13 @@ EOT https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_io_m17n.rb#L479 with_tmpdir { src = "\u3042" generate_file('tmp', src) - defext = Encoding.default_external - Encoding.default_external = Encoding::UTF_8 - open("tmp", "rt") {|f| - s = f.getc - assert_equal(true, s.valid_encoding?) - assert_equal("\u3042", s) - } - Encoding.default_external = defext + EnvUtil.with_default_external(Encoding::UTF_8) do + open("tmp", "rt") {|f| + s = f.getc + assert_equal(true, s.valid_encoding?) + assert_equal("\u3042", s) + } + end } end @@ -494,17 +493,16 @@ EOT https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_io_m17n.rb#L493 with_tmpdir { src = "\xE3\x81" generate_file('tmp', src) - defext = Encoding.default_external - Encoding.default_external = Encoding::UTF_8 - open("tmp", "rt") {|f| - s = f.getc - assert_equal(false, s.valid_encoding?) - assert_equal("\xE3".force_encoding("UTF-8"), s) - s = f.getc - assert_equal(false, s.valid_encoding?) - assert_equal("\x81".force_encoding("UTF-8"), s) - } - Encoding.default_external = defext + EnvUtil.with_default_external(Encoding::UTF_8) do + open("tmp", "rt") {|f| + s = f.getc + assert_equal(false, s.valid_encoding?) + assert_equal("\xE3".force_encoding("UTF-8"), s) + s = f.getc + assert_equal(false, s.valid_encoding?) + assert_equal("\x81".force_encoding("UTF-8"), s) + } + end } end @@ -1678,7 +1676,7 @@ EOT https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_io_m17n.rb#L1676 u16 = "\x85\x35\0\r\x00\xa2\0\r\0\n\0\n".force_encoding("utf-16be") i = "\e$B\x42\x22\e(B\r\e$B\x21\x71\e(B\r\n\n".force_encoding("iso-2022-jp") n = system_newline - un = n.encode("utf-16be").force_encoding("ascii-8bit") + n.encode("utf-16be").force_encoding("ascii-8bit") assert_write("a\rb\r#{n}c#{n}", "wt", a) assert_write("\xc2\xa2", "wt", e) Index: ruby_2_0_0/test/ruby/envutil.rb =================================================================== --- ruby_2_0_0/test/ruby/envutil.rb (revision 41363) +++ ruby_2_0_0/test/ruby/envutil.rb (revision 41364) @@ -127,6 +127,30 @@ module EnvUtil https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/envutil.rb#L127 GC.stress = stress end module_function :under_gc_stress + + def with_default_external(enc) + verbose, $VERBOSE = $VERBOSE, nil + origenc, Encoding.default_external = Encoding.default_external, enc + $VERBOSE = verbose + yield + ensure + verbose, $VERBOSE = $VERBOSE, nil + Encoding.default_external = origenc + $VERBOSE = verbose + end + module_function :with_default_external + + def with_default_internal(enc) + verbose, $VERBOSE = $VERBOSE, nil + origenc, Encoding.default_internal = Encoding.default_internal, enc + $VERBOSE = verbose + yield + ensure + verbose, $VERBOSE = $VERBOSE, nil + Encoding.default_internal = origenc + $VERBOSE = verbose + end + module_function :with_default_internal end module Test Property changes on: ruby_2_0_0 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r39721 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/