ruby-changes:20032
From: nobu <ko1@a...>
Date: Tue, 14 Jun 2011 13:07:39 +0900 (JST)
Subject: [ruby-changes:20032] nobu:r32079 (trunk): * test/io/console/test_io_console.rb (TestIO_Console#test_noctty):
nobu 2011-06-14 13:07:03 +0900 (Tue, 14 Jun 2011) New Revision: 32079 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=32079 Log: * test/io/console/test_io_console.rb (TestIO_Console#test_noctty): split for each platforms. Modified files: trunk/test/io/console/test_io_console.rb Index: test/io/console/test_io_console.rb =================================================================== --- test/io/console/test_io_console.rb (revision 32078) +++ test/io/console/test_io_console.rb (revision 32079) @@ -168,18 +168,22 @@ class TestIO_Console < Test::Unit::TestCase require_relative '../../ruby/envutil' - def test_noctty - if Process.respond_to?(:daemon) + case + when Process.respond_to?(:daemon) + def test_noctty assert_in_out_err(["-rio/console"], "Process.daemon(true, true); p IO.console", ["nil"]) - elsif !(rubyw = RbConfig::CONFIG["RUBYW_INSTALL_NAME"]).empty? - require 'tempfile' + end + when !(rubyw = RbConfig::CONFIG["RUBYW_INSTALL_NAME"]).empty? + require 'tempfile' + dir, base = File.split(EnvUtil.rubybin) + RUBYW = File.join(dir, base.sub(/ruby/, rubyw)) + + def test_noctty t = Tempfile.new("console") t.close - dir, base = File.split(EnvUtil.rubybin) - rubywbin = File.join(dir, base.sub(/ruby/, rubyw)) - cmd = [rubywbin, '-rio/console', '-e', 'STDOUT.reopen(ARGV[0]); p IO.console', '--', t.path] + cmd = [RUBYW, '-rio/console', '-e', 'STDOUT.reopen(ARGV[0]); p IO.console', '--', t.path] system(*cmd) t.open assert_equal("nil", t.gets.chomp) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/