mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Close leaked file descripters in tests
This commit is contained in:
parent
3428922437
commit
1bfba99b79
2 changed files with 7 additions and 1 deletions
|
@ -5,7 +5,11 @@ class Reline::MacroTest < Reline::TestCase
|
||||||
@config = Reline::Config.new
|
@config = Reline::Config.new
|
||||||
@line_editor = Reline::LineEditor.new(@config)
|
@line_editor = Reline::LineEditor.new(@config)
|
||||||
@line_editor.instance_variable_set(:@screen_size, [24, 80])
|
@line_editor.instance_variable_set(:@screen_size, [24, 80])
|
||||||
@line_editor.output = File.open(IO::NULL, "w")
|
@output = @line_editor.output = File.open(IO::NULL, "w")
|
||||||
|
end
|
||||||
|
|
||||||
|
def teardown
|
||||||
|
@output.close
|
||||||
end
|
end
|
||||||
|
|
||||||
def input_key(char, combined_char = char, with_meta = false)
|
def input_key(char, combined_char = char, with_meta = false)
|
||||||
|
|
|
@ -5,6 +5,7 @@ class Reline::WithinPipeTest < Reline::TestCase
|
||||||
Reline.send(:test_mode)
|
Reline.send(:test_mode)
|
||||||
@reader, @writer = IO.pipe((RELINE_TEST_ENCODING rescue Encoding.default_external))
|
@reader, @writer = IO.pipe((RELINE_TEST_ENCODING rescue Encoding.default_external))
|
||||||
Reline.input = @reader
|
Reline.input = @reader
|
||||||
|
@output = Reline.output = File.open(IO::NULL, 'w')
|
||||||
@config = Reline.class_variable_get(:@@config)
|
@config = Reline.class_variable_get(:@@config)
|
||||||
@line_editor = Reline.class_variable_get(:@@line_editor)
|
@line_editor = Reline.class_variable_get(:@@line_editor)
|
||||||
end
|
end
|
||||||
|
@ -14,6 +15,7 @@ class Reline::WithinPipeTest < Reline::TestCase
|
||||||
Reline.output = STDOUT
|
Reline.output = STDOUT
|
||||||
@reader.close
|
@reader.close
|
||||||
@writer.close
|
@writer.close
|
||||||
|
@output.close
|
||||||
@config.reset
|
@config.reset
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue