Github user zwoop commented on a diff in the pull request:

    https://github.com/apache/trafficserver/pull/1133#discussion_r84729282
  
    --- Diff: plugins/header_rewrite/header_rewrite_test.cc ---
    @@ -31,274 +33,395 @@ const char PLUGIN_NAME_DBG[] = 
"TEST_dbg_header_rewrite";
     extern "C" void
     TSError(const char *fmt, ...)
     {
    -  char buf[2048];
    -  int bytes = 0;
    -  va_list args;
    -  va_start(args, fmt);
    -  if ((bytes = vsnprintf(buf, sizeof(buf), fmt, args)) > 0) {
    -    fprintf(stderr, "TSError: %s: %.*s\n", PLUGIN_NAME, bytes, buf);
    -  }
    -  va_end(args);
     }
     
    -extern "C" void
    -TSDebug(const char *tag, const char *fmt, ...)
    -{
    -  char buf[2048];
    -  int bytes = 0;
    -  va_list args;
    -  va_start(args, fmt);
    -  if ((bytes = vsnprintf(buf, sizeof(buf), fmt, args)) > 0) {
    -    fprintf(stdout, "TSDebug: %s: %.*s\n", PLUGIN_NAME, bytes, buf);
    -  }
    -  va_end(args);
    -}
    -
    -#define CHECK_EQ(x, y)                   \
    -  do {                                   \
    -    if ((x) != (y)) {                    \
    -      fprintf(stderr, "CHECK FAILED\n"); \
    -      return 1;                          \
    -    }                                    \
    -  } while (false);
    -
     class ParserTest : public Parser
     {
     public:
    -  ParserTest(std::string line) : Parser(line) {}
    +  ParserTest(std::string line) : Parser(line), res(true) { std::cout << 
"Starting parser test: " << line << std::endl; }
       std::vector<std::string>
       getTokens()
       {
         return _tokens;
       }
    +
    +  template <typename T, typename U>
    +  void
    +  do_parser_check(T x, U y, int line = 0)
    +  {
    +    if (x != y) {
    +      std::cerr << "CHECK FAILED on line " << line << ": " << x << " != " 
<< y << std::endl;
    +      res = false;
    +    }
    +  }
    +
    +  bool res;
    --- End diff --
    
    That's the check :). This is what DO_CHECK() used to do as a macro, but I 
turned it into a templetized function so that DO_CHECK can produce output about 
the check for the various types of input parameters.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to