ruby-changes:35542
From: usa <ko1@a...>
Date: Thu, 18 Sep 2014 16:30:35 +0900 (JST)
Subject: [ruby-changes:35542] usa:r47624 (trunk): * test/rubygems/test_gem_commands_setup_command.rb: @ui uses StringIO
usa 2014-09-18 16:30:19 +0900 (Thu, 18 Sep 2014) New Revision: 47624 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=47624 Log: * test/rubygems/test_gem_commands_setup_command.rb: @ui uses StringIO as its streams, and Encoding.default_external does not effect to stringIOs already exist. so, we need to set external_encoding of @ui.outs directly. this problem (test failure) does not appear in the environments default_external is us-ascii or utf-8. Modified files: trunk/ChangeLog trunk/test/rubygems/test_gem_commands_setup_command.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 47623) +++ ChangeLog (revision 47624) @@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Thu Sep 18 16:26:27 2014 NAKAMURA Usaku <usa@r...> + + * test/rubygems/test_gem_commands_setup_command.rb: @ui uses StringIO + as its streams, and Encoding.default_external does not effect to + stringIOs already exist. so, we need to set external_encoding of + @ui.outs directly. this problem (test failure) does not appear in + the environments default_external is us-ascii or utf-8. + Thu Sep 18 15:02:15 2014 NAKAMURA Usaku <usa@r...> * test/rubygems/test_gem_specification.rb: '/' is not always the root. Index: test/rubygems/test_gem_commands_setup_command.rb =================================================================== --- test/rubygems/test_gem_commands_setup_command.rb (revision 47623) +++ test/rubygems/test_gem_commands_setup_command.rb (revision 47624) @@ -77,10 +77,10 @@ class TestGemCommandsSetupCommand < Gem: https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_commands_setup_command.rb#L77 def test_show_release_notes @default_external = nil - capture_io do - @default_external, Encoding.default_external = - Encoding.default_external, Encoding::US_ASCII - end if Object.const_defined? :Encoding + if Object.const_defined? :Encoding + @default_external = @ui.outs.external_encoding + @ui.outs.set_encoding Encoding::US_ASCII + end @cmd.options[:previous_version] = Gem::Version.new '2.0.2' @@ -127,11 +127,9 @@ class TestGemCommandsSetupCommand < Gem: https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_commands_setup_command.rb#L127 output = @ui.output output.force_encoding Encoding::UTF_8 if Object.const_defined? :Encoding - assert_equal expected, @ui.output + assert_equal expected, output ensure - capture_io do - Encoding.default_external = @default_external - end if @default_external + @ui.outs.set_encoding @default_external if @default_external end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/