* test/ruby/test_io.rb (safe_4): does not use Timeout because
Timeout.timeout uses Thread#kill which raises SecurityError when $SAFE == 4. based on a patch from Tomoyuki Chikanaga. [ruby-dev:41484] * test/ruby/test_io.rb (test_print_separators): use pipe (test helper method) instead of IO.pipe. [ruby-dev:41484] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28330 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
6e10636d32
commit
29b22ba2c6
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
|||||||
|
Wed Jun 16 00:04:38 2010 Yusuke Endoh <mame@tsg.ne.jp>
|
||||||
|
|
||||||
|
* test/ruby/test_io.rb (safe_4): does not use Timeout because
|
||||||
|
Timeout.timeout uses Thread#kill which raises SecurityError when
|
||||||
|
$SAFE == 4. based on a patch from Tomoyuki Chikanaga.
|
||||||
|
[ruby-dev:41484]
|
||||||
|
|
||||||
|
* test/ruby/test_io.rb (test_print_separators): use pipe (test helper
|
||||||
|
method) instead of IO.pipe. [ruby-dev:41484]
|
||||||
|
|
||||||
Tue Jun 15 17:14:58 2010 WATANABE Hirofumi <eban@ruby-lang.org>
|
Tue Jun 15 17:14:58 2010 WATANABE Hirofumi <eban@ruby-lang.org>
|
||||||
|
|
||||||
* ext/fiddle/extconf.rb: De Morgan's laws.
|
* ext/fiddle/extconf.rb: De Morgan's laws.
|
||||||
|
@ -740,12 +740,14 @@ class TestIO < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def safe_4
|
def safe_4
|
||||||
Thread.new do
|
t = Thread.new do
|
||||||
Timeout.timeout(10) do
|
$SAFE = 4
|
||||||
$SAFE = 4
|
yield
|
||||||
yield
|
end
|
||||||
end
|
unless t.join(10)
|
||||||
end.join
|
t.kill
|
||||||
|
flunk("timeout in safe_4")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def pipe(wp, rp)
|
def pipe(wp, rp)
|
||||||
@ -1461,15 +1463,16 @@ End
|
|||||||
def test_print_separators
|
def test_print_separators
|
||||||
$, = ':'
|
$, = ':'
|
||||||
$\ = "\n"
|
$\ = "\n"
|
||||||
r, w = IO.pipe
|
pipe(proc do |w|
|
||||||
w.print('a')
|
w.print('a')
|
||||||
w.print('a','b','c')
|
w.print('a','b','c')
|
||||||
w.close
|
w.close
|
||||||
assert_equal("a\n", r.gets)
|
end, proc do |r|
|
||||||
assert_equal("a:b:c\n", r.gets)
|
assert_equal("a\n", r.gets)
|
||||||
assert_nil r.gets
|
assert_equal("a:b:c\n", r.gets)
|
||||||
r.close
|
assert_nil r.gets
|
||||||
|
r.close
|
||||||
|
end)
|
||||||
ensure
|
ensure
|
||||||
$, = nil
|
$, = nil
|
||||||
$\ = nil
|
$\ = nil
|
||||||
|
Loading…
x
Reference in New Issue
Block a user