diff --git a/include/snapshot/snapshot.h b/include/snapshot/snapshot.h index 77451ad..6e346bf 100644 --- a/include/snapshot/snapshot.h +++ b/include/snapshot/snapshot.h @@ -447,17 +447,14 @@ class Snapshot { const auto before_content = StringUtility::ToString(before); const auto after_content = StringUtility::ToString(after); - const auto before_content_target_file = - StringUtility::Join({"/tmp", getSnapshotDiffBeforeFilename(filename_split.back())}, '/'); - const auto after_content_target_file = - StringUtility::Join({"/tmp", getSnapshotDiffAfterFilename(filename_split.back())}, '/'); + const auto before_content_target_file = StringUtility::Join( + {"/tmp", getSnapshotDiffBeforeFilename(StringUtility::Split(snapshot_key, '/').back())}, '/'); + const auto after_content_target_file = StringUtility::Join( + {"/tmp", getSnapshotDiffAfterFilename(StringUtility::Split(snapshot_key, '/').back())}, '/'); FileUtility::RewriteFile(before_content_target_file, before_content); FileUtility::RewriteFile(after_content_target_file, after_content); - std::cout << before_content_target_file << std::endl; - std::cout << after_content_target_file << std::endl; - const auto diff_content = SystemUtility::Diff(before_content_target_file, after_content_target_file); FileUtility::RemoveFile(before_content_target_file); diff --git a/test/file_utility_test.cc b/test/file_utility_test.cc index bb52cc4..2e71a7c 100644 --- a/test/file_utility_test.cc +++ b/test/file_utility_test.cc @@ -10,4 +10,14 @@ class FileUtilityTest : public testing::Test { public: }; -TEST_F(FileUtilityTest, get_all_lines) {} +TEST_F(FileUtilityTest, get_all_lines) { + const std::string a = R"( + "foo": bar + )"; + + const std::string b = R"( + "foo": bar2 + )"; + + SNAPSHOT_DIFF(a, b); +}