зеркало из https://github.com/github/ruby.git
[ruby/error_highlight] Fix leaked tempfiles
https://github.com/ruby/error_highlight/commit/8b353a10a7
This commit is contained in:
Родитель
6073a8bdc0
Коммит
29ed9d1aaa
|
@ -1002,34 +1002,36 @@ undefined method `time' for 1:Integer
|
|||
end
|
||||
|
||||
def test_hard_tabs
|
||||
tmp = Tempfile.new(["error_highlight_test", ".rb"], binmode: true)
|
||||
tmp << "\t \t1.time {}\n"
|
||||
tmp.close(false)
|
||||
Tempfile.create(["error_highlight_test", ".rb"], binmode: true) do |tmp|
|
||||
tmp << "\t \t1.time {}\n"
|
||||
tmp.close
|
||||
|
||||
assert_error_message(NoMethodError, <<~END.gsub("_", "\t")) do
|
||||
assert_error_message(NoMethodError, <<~END.gsub("_", "\t")) do
|
||||
undefined method `time' for 1:Integer
|
||||
|
||||
_ _1.time {}
|
||||
_ _ ^^^^^
|
||||
END
|
||||
|
||||
load tmp.path
|
||||
load tmp.path
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def test_no_final_newline
|
||||
tmp = Tempfile.new(["error_highlight_test", ".rb"])
|
||||
tmp << "1.time {}"
|
||||
tmp.close(false)
|
||||
Tempfile.create(["error_highlight_test", ".rb"]) do |tmp|
|
||||
tmp << "1.time {}"
|
||||
tmp.close
|
||||
|
||||
assert_error_message(NoMethodError, <<~END) do
|
||||
assert_error_message(NoMethodError, <<~END) do
|
||||
undefined method `time' for 1:Integer
|
||||
|
||||
1.time {}
|
||||
^^^^^
|
||||
END
|
||||
|
||||
load tmp.path
|
||||
load tmp.path
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче