test_pathname: add append_lines tests

Closes Homebrew/homebrew#49233.

Signed-off-by: Dominyk Tiller <dominyktiller@gmail.com>
This commit is contained in:
Dominyk Tiller 2016-02-16 19:08:56 +00:00
parent ff4d16deeb
commit e00375e381

View File

@ -51,6 +51,18 @@ class PathnameTests < Homebrew::TestCase
assert_raises(RuntimeError) { @file.write("CONTENT") }
end
def test_append_lines
touch @file
@file.append_lines("CONTENT")
assert_equal "CONTENT\n", File.read(@file)
@file.append_lines("CONTENTS")
assert_equal "CONTENT\nCONTENTS\n", File.read(@file)
end
def test_append_lines_does_not_create
assert_raises(RuntimeError) { @file.append_lines("CONTENT") }
end
def test_atomic_write
touch @file
@file.atomic_write("CONTENT")