about summary refs log tree commit diff stats
path: root/003trace.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-11-15 21:55:56 -0800
committerKartik K. Agaram <vc@akkartik.com>2016-11-15 22:22:11 -0800
commit4cec4143d3f35be3f4379e00cc4fea357ef2a349 (patch)
treec067f33b8193344993dd45d495be4e22951a1bc0 /003trace.cc
parent293732951a2052dd079c253942922eab6c1a734d (diff)
downloadmu-4cec4143d3f35be3f4379e00cc4fea357ef2a349.tar.gz
3675
Diffstat (limited to '003trace.cc')
-rw-r--r--003trace.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/003trace.cc b/003trace.cc
index aa519eb1..d75596eb 100644
--- a/003trace.cc
+++ b/003trace.cc
@@ -183,9 +183,13 @@ int Trace_errors = 0;  // used only when Trace_stream is NULL
 // Inside tests, fail any tests that displayed (unexpected) errors.
 // Expected errors in tests should always be hidden and silently checked for.
 :(before "End Test Teardown")
-if (Passed && !Hide_errors && trace_count("error") > 0) {
+if (Passed && !Hide_errors && trace_contains_errors()) {
   Passed = false;
 }
+:(code)
+bool trace_contains_errors() {
+  return Trace_errors > 0 || trace_count("error") > 0;
+}
 
 :(before "End Types")
 struct end {};
@@ -223,9 +227,9 @@ START_TRACING_UNTIL_END_OF_SCOPE
 :(before "End Includes")
 #define CHECK_TRACE_CONTENTS(...)  check_trace_contents(__FUNCTION__, __FILE__, __LINE__, __VA_ARGS__)
 
-#define CHECK_TRACE_CONTAINS_ERROR()  CHECK(trace_count("error") > 0)
-#define CHECK_TRACE_DOESNT_CONTAIN_ERROR() \
-  if (Passed && trace_count("error") > 0) { \
+#define CHECK_TRACE_CONTAINS_ERRORS()  CHECK(trace_contains_errors())
+#define CHECK_TRACE_DOESNT_CONTAIN_ERRORS() \
+  if (Passed && trace_contains_errors()) { \
     cerr << "\nF - " << __FUNCTION__ << "(" << __FILE__ << ":" << __LINE__ << "): unexpected errors\n"; \
     DUMP("error"); \
     Passed = false; \