[Lldb-commits] [PATCH] D77843: [lldb/DataFormatters] Delete GetStringPrinterEscapingHelper

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Apr 14 05:50:00 PDT 2020


labath added a comment.

I haven't looked at the code in detail, but it seems ok to me.

What does not seem ok is the hand-rolled matching in the tests. A more idiomatic approach would be to replace `isFormatCorrect` with a wrapper function which can be called from a test macro, and let gtest do the matching:
Say, something like this:

  /// Return the formatted string, or None if formatting failed.
  Optional<std::string> format(StringRef input, ...) {
    ...
    if (success)
      return out.GetString();
    return None;
  }
  ...
  EXPECT_EQ(format("foo", ...), std::string("foo")); // std::string is needed because Optional<string> and const char * are not comparable -- may want to make an alias/lambda for that


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77843/new/

https://reviews.llvm.org/D77843





More information about the lldb-commits mailing list