summaryrefslogtreecommitdiff
path: root/test/ruby/test_io_m17n.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-29 11:29:47 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-29 11:29:47 +0000
commitbe4d1fd95383bd10054b54b1d32c561d32d4633d (patch)
treed8df6032e60bdc45aa5351f049dba05b4ddbd148 /test/ruby/test_io_m17n.rb
parent2ad20073074f39f3ee2904a45da310ce4041aa22 (diff)
* io.c (rb_io_s_pipe): Close pipes if io_encoding_set() raises an
exception. (io_encoding_set_v): New function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_io_m17n.rb')
-rw-r--r--test/ruby/test_io_m17n.rb46
1 files changed, 24 insertions, 22 deletions
diff --git a/test/ruby/test_io_m17n.rb b/test/ruby/test_io_m17n.rb
index 0b435dd8c1f..e9e6a1cf83a 100644
--- a/test/ruby/test_io_m17n.rb
+++ b/test/ruby/test_io_m17n.rb
@@ -2142,32 +2142,34 @@ EOT
def test_textmode_paragraph_nonasciicompat
bug3534 = ['[ruby-dev:41803]', '[Bug #3534]']
- r, w = IO.pipe
- [Encoding::UTF_32BE, Encoding::UTF_32LE,
- Encoding::UTF_16BE, Encoding::UTF_16LE,
- Encoding::UTF_8].each do |e|
- r.set_encoding(Encoding::US_ASCII, e)
- wthr = Thread.new{ w.print(bug3534[0], "\n\n\n\n", bug3534[1], "\n") }
- assert_equal((bug3534[0]+"\n\n").encode(e), r.gets(""), bug3534[0])
- assert_equal((bug3534[1]+"\n").encode(e), r.gets(), bug3534[1])
- wthr.join
- end
+ IO.pipe {|r, w|
+ [Encoding::UTF_32BE, Encoding::UTF_32LE,
+ Encoding::UTF_16BE, Encoding::UTF_16LE,
+ Encoding::UTF_8].each do |e|
+ r.set_encoding(Encoding::US_ASCII, e)
+ wthr = Thread.new{ w.print(bug3534[0], "\n\n\n\n", bug3534[1], "\n") }
+ assert_equal((bug3534[0]+"\n\n").encode(e), r.gets(""), bug3534[0])
+ assert_equal((bug3534[1]+"\n").encode(e), r.gets(), bug3534[1])
+ wthr.join
+ end
+ }
end
def test_binmode_paragraph_nonasciicompat
bug3534 = ['[ruby-dev:41803]', '[Bug #3534]']
- r, w = IO.pipe
- r.binmode
- w.binmode
- [Encoding::UTF_32BE, Encoding::UTF_32LE,
- Encoding::UTF_16BE, Encoding::UTF_16LE,
- Encoding::UTF_8].each do |e|
- r.set_encoding(Encoding::US_ASCII, e)
- wthr = Thread.new{ w.print(bug3534[0], "\n\n\n\n", bug3534[1], "\n") }
- assert_equal((bug3534[0]+"\n\n").encode(e), r.gets(""), bug3534[0])
- assert_equal((bug3534[1]+"\n").encode(e), r.gets(), bug3534[1])
- wthr.join
- end
+ IO.pipe {|r, w|
+ r.binmode
+ w.binmode
+ [Encoding::UTF_32BE, Encoding::UTF_32LE,
+ Encoding::UTF_16BE, Encoding::UTF_16LE,
+ Encoding::UTF_8].each do |e|
+ r.set_encoding(Encoding::US_ASCII, e)
+ wthr = Thread.new{ w.print(bug3534[0], "\n\n\n\n", bug3534[1], "\n") }
+ assert_equal((bug3534[0]+"\n\n").encode(e), r.gets(""), bug3534[0])
+ assert_equal((bug3534[1]+"\n").encode(e), r.gets(), bug3534[1])
+ wthr.join
+ end
+ }
end
def test_puts_widechar