Skip to content

Commit

Permalink
fix: funcName
Browse files Browse the repository at this point in the history
  • Loading branch information
Dup4 committed Jun 14, 2022
1 parent 0b96655 commit b5ccfb7
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions include/snapshot/snapshot.h
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,7 @@ class Snapshot {
template <typename T>
static void GenerateSnapshotDiff(const T& before, const T& after, const char* file_name, const char* func_name,
const int line_number, const std::vector<std::string>& custom_keys = std::vector<std::string>({})) {
func_name = fixFuncName(func_name);
const auto filename_split = StringUtility::Split(file_name, '/');
const auto snapshot_key = getSnapshotKey(file_name, func_name, line_number, custom_keys);
const auto snapshot_filename = getSnapshotDiffFilename(filename_split.back());
Expand Down Expand Up @@ -502,6 +503,14 @@ class Snapshot {
}

private:
static const char* fixFuncName(const char* func_name) {
if (strcmp(func_name, "operator()") == 0) {
return "operator";
}

return func_name;
}

static std::pair<int, int> getSnapshotInlineMatchRange(const std::string& s) {
const std::string prefix = "SNAPSHOT_INLINE(";

Expand Down

0 comments on commit b5ccfb7

Please sign in to comment.