From 099bd85ed7cdca017fbfae4d12134a00fcf2236b Mon Sep 17 00:00:00 2001 From: David Steele Date: Tue, 7 Apr 2020 14:42:05 -0400 Subject: [PATCH] Reset line number in TEST_ERROR*() macros. If these are not reset then an error not wrapped in a TEST_ERROR*() macro may show the line number of the previous error in a stack trace, which is confusing. It is better for the line number to be unreported than wrong. --- test/src/common/harnessTest.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/src/common/harnessTest.h b/test/src/common/harnessTest.h index 432798212..c5bc71d2b 100644 --- a/test/src/common/harnessTest.h +++ b/test/src/common/harnessTest.h @@ -117,6 +117,8 @@ Test that an expected error is actually thrown and error when it isn't THROW_FMT( \ TestError, "statement '%s' returned but error %s, '%s' was expected", #statement, errorTypeName(&errorTypeExpected), \ errorMessageExpected); \ + \ + stackTraceTestFileLineSet(0); \ } /*********************************************************************************************************************************** @@ -130,6 +132,8 @@ Test error with a formatted expected message THROW_FMT(AssertError, "error message needs more than the %zu characters available", sizeof(TEST_ERROR_FMT_buffer)); \ \ TEST_ERROR(statement, errorTypeExpected, TEST_ERROR_FMT_buffer); \ + \ + stackTraceTestFileLineSet(0); \ } /***********************************************************************************************************************************