Similar to Jest Snapshot, but implemented in C++.
SNAPSHOT(content)
SNAPSHOT_INLINE(content)
SNAPSHOT_DIFF(before_content, after_content)
requiredgit
binary.- Support Linux and macOS.
FetchContent_Declare(
snapshot
QUIET
GIT_REPOSITORY https://github.com/Dup4/snapshot-cpp.git
GIT_TAG v{x.y.z} # Where `x.y.z` is the release version you want to use.
)
git_repository(
name = "snapshot",
remote = "https://github.com/Dup4/snapshot-cpp.git",
tag = "v{x.y.z}", # Where `x.y.z` is the release version you want to use.
)
const std::string tmp = "snapshot-cpp";
const std::string tmp_diff = tmp + "-diff";
EXPECT_EQ(tmp, SNAPSHOT_INLINE(tmp));
// EXPECT_EQ(tmp, std::string("snapshot-cpp"));
SNAPSHOT(tmp);
// // /home/Dup4/snapshot-cpp/test/snapshot_test.cc.TestBody.58.0
// std::string("snapshot-cpp")
SNAPSHOT_DIFF(tmp, tmp_diff);
// // /home/Dup4/snapshot-cpp/test/snapshot_test.cc.TestBody.59.0
// // before
// std::string("snapshot-cpp")
// // after
// std::string("snapshot-cpp-diff")
// // diff
// diff --git a/tmp/snapshot_test.cc.TestBody.59.0.snap.before b/tmp/snapshot_test.cc.TestBody.59.0.snap.after
// index aeb786e..3982900 100644
// --- a/tmp/snapshot_test.cc.TestBody.59.0.snap.before
// +++ b/tmp/snapshot_test.cc.TestBody.59.0.snap.after
// @@ -1 +1 @@
// -std::string("snapshot-cpp")
// \ No newline at end of file
// +std::string("snapshot-cpp-diff")
// \ No newline at end of file