From e00375e381c7bcd4f0db0d69944dbf831fc62672 Mon Sep 17 00:00:00 2001 From: Dominyk Tiller Date: Tue, 16 Feb 2016 19:08:56 +0000 Subject: [PATCH] test_pathname: add append_lines tests Closes Homebrew/homebrew#49233. Signed-off-by: Dominyk Tiller --- Library/Homebrew/test/test_pathname.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Library/Homebrew/test/test_pathname.rb b/Library/Homebrew/test/test_pathname.rb index 5456c5bdc2..d29a2bc1ea 100644 --- a/Library/Homebrew/test/test_pathname.rb +++ b/Library/Homebrew/test/test_pathname.rb @@ -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")