mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
console.c: get rid of NameError
* ext/io/console/console.c (console_dev): id_console is not a constant name, use rb_const_remove() to get rid of NameError. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48982 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
86693b30c5
commit
d8d326c97a
3 changed files with 30 additions and 11 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Thu Dec 25 10:09:14 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* ext/io/console/console.c (console_dev): id_console is not a
|
||||||
|
constant name, use rb_const_remove() to get rid of NameError.
|
||||||
|
|
||||||
Thu Dec 25 09:18:55 2014 NAKAMURA Usaku <usa@ruby-lang.org>
|
Thu Dec 25 09:18:55 2014 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||||
|
|
||||||
* test/resolv/test_dns.rb (TestResolvDNS#test_query_ipv4_address):
|
* test/resolv/test_dns.rb (TestResolvDNS#test_query_ipv4_address):
|
||||||
|
|
|
@ -647,7 +647,7 @@ console_dev(VALUE klass)
|
||||||
if ((fptr = RFILE(con)->fptr) && GetReadFD(fptr) != -1)
|
if ((fptr = RFILE(con)->fptr) && GetReadFD(fptr) != -1)
|
||||||
return con;
|
return con;
|
||||||
}
|
}
|
||||||
rb_mod_remove_const(klass, ID2SYM(id_console));
|
rb_const_remove(klass, id_console);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
VALUE args[2];
|
VALUE args[2];
|
||||||
|
|
|
@ -218,21 +218,22 @@ class TestIO_Console < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
if IO.console
|
if IO.console
|
||||||
|
def test_close
|
||||||
|
IO.console.close
|
||||||
|
assert_kind_of(IO, IO.console)
|
||||||
|
assert_nothing_raised(IOError) {IO.console.fileno}
|
||||||
|
end
|
||||||
|
|
||||||
def test_sync
|
def test_sync
|
||||||
assert(IO.console.sync, "console should be unbuffered")
|
assert(IO.console.sync, "console should be unbuffered")
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
def test_close
|
||||||
|
assert_equal(["true"], run_pty("IO.console.close; p IO.console.fileno >= 0"))
|
||||||
|
end
|
||||||
|
|
||||||
def test_sync
|
def test_sync
|
||||||
r, w, pid = PTY.spawn(EnvUtil.rubybin, "-rio/console", "-e", "p IO.console.class")
|
assert_equal(["true"], run_pty("p IO.console.sync"))
|
||||||
rescue RuntimeError
|
|
||||||
skip $!
|
|
||||||
else
|
|
||||||
con = r.gets.chomp
|
|
||||||
Process.wait(pid)
|
|
||||||
assert_match("File", con)
|
|
||||||
ensure
|
|
||||||
r.close if r
|
|
||||||
w.close if w
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -247,6 +248,19 @@ class TestIO_Console < Test::Unit::TestCase
|
||||||
m.close if m
|
m.close if m
|
||||||
s.close if s
|
s.close if s
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def run_pty(src)
|
||||||
|
r, w, pid = PTY.spawn(EnvUtil.rubybin, "-rio/console", "-e", src)
|
||||||
|
rescue RuntimeError
|
||||||
|
skip $!
|
||||||
|
else
|
||||||
|
result = r.readlines(&:chomp)
|
||||||
|
Process.wait(pid)
|
||||||
|
yield result
|
||||||
|
ensure
|
||||||
|
r.close if r
|
||||||
|
w.close if w
|
||||||
|
end
|
||||||
end if defined?(PTY) and defined?(IO::console)
|
end if defined?(PTY) and defined?(IO::console)
|
||||||
|
|
||||||
class TestIO_Console < Test::Unit::TestCase
|
class TestIO_Console < Test::Unit::TestCase
|
||||||
|
|
Loading…
Reference in a new issue