From 5c9f7a764515fc70b3fabe157fcf196da2a26f07 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Mon, 7 Nov 2016 22:36:32 -0500 Subject: [PATCH] turn on tests for Buffer::write_to_file() --- test/src/test_Buffer.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/test/src/test_Buffer.cc b/test/src/test_Buffer.cc index 6634800..544569d 100644 --- a/test/src/test_Buffer.cc +++ b/test/src/test_Buffer.cc @@ -3,7 +3,6 @@ #include "TestSupport.h" #include "Path.h" -#if 0 TEST(BufferTest, writes_an_identical_file_to_what_is_loaded_if_no_changes_were_performed) { const char * files_to_test[] = { @@ -15,14 +14,21 @@ TEST(BufferTest, writes_an_identical_file_to_what_is_loaded_if_no_changes_were_p }; for (auto e : files_to_test) { - Buffer b; - ASSERT_TRUE(b.load_from_file(e)); + Buffer b(e); ASSERT_TRUE(b.write_to_file("test/tmp/f")); ASSERT_TRUE(Path::is_file("test/tmp/f")); TestSupport::compare_files(e, "test/tmp/f"); } } +TEST(BufferTest, writes_an_empty_file_for_an_empty_buffer) +{ + Buffer b; + ASSERT_TRUE(b.write_to_file("test/tmp/f")); + TestSupport::compare_files("test/files/empty.txt", "test/tmp/f"); +} + +#if 0 TEST(BufferTest, allows_navigating_using_cursors) { Buffer b;