summaryrefslogtreecommitdiff
path: root/test/io/console/test_io_console.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-01-25 18:24:09 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-01-25 18:24:09 +0000
commit8335ce7065be10565e0c1fb8971df2b43d9d4d95 (patch)
treea0a9a8ab282bf416e8a4e8cff9bb1c125407f159 /test/io/console/test_io_console.rb
parent97f0b0f55818420b4c7a7002c92c08ad78a7e579 (diff)
* ext/io/console/console.c (io_getch): default delegating method
for StringIO. https://github.com/nobu/io-console/issues/4 * ext/stringio/stringio.c: moved some methods to hidden modules. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34376 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/io/console/test_io_console.rb')
-rw-r--r--test/io/console/test_io_console.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/test/io/console/test_io_console.rb b/test/io/console/test_io_console.rb
index 05ab1a353e..1616342b86 100644
--- a/test/io/console/test_io_console.rb
+++ b/test/io/console/test_io_console.rb
@@ -4,6 +4,7 @@ begin
require 'pty'
rescue LoadError
end
+require_relative '../../ruby/envutil'
class TestIO_Console < Test::Unit::TestCase
def test_raw
@@ -193,8 +194,6 @@ class TestIO_Console < Test::Unit::TestCase
end if defined?(PTY) and defined?(IO::console)
class TestIO_Console < Test::Unit::TestCase
- require_relative '../../ruby/envutil'
-
case
when Process.respond_to?(:daemon)
noctty = [EnvUtil.rubybin, "-e", "Process.daemon(true)"]
@@ -212,6 +211,7 @@ class TestIO_Console < Test::Unit::TestCase
t2 = Tempfile.new("console")
t2.close
cmd = NOCTTY + [
+ '--disable=gems',
'-rio/console',
'-e', 'open(ARGV[0], "w") {|f| f.puts IO.console.inspect}',
'-e', 'File.unlink(ARGV[1])',
@@ -226,3 +226,11 @@ class TestIO_Console < Test::Unit::TestCase
end
end
end if defined?(IO.console)
+
+class TestIO_Console < Test::Unit::TestCase
+ def test_stringio_getch
+ assert_ruby_status(%w"--disable=gems -rstringio -rio/console", "exit(StringIO.method_defined?(:getch))")
+ assert_ruby_status(%w"--disable=gems -rio/console -rstringio", "exit(StringIO.method_defined?(:getch))")
+ assert_ruby_status(%w"--disable=gems -rstringio", "exit(!StringIO.method_defined?(:getch))")
+ end
+end