Skip to content

Commit 090eb74

Browse files
committed
EvaluteRTE: Correctly report AbortOnValue aborts with negative abort codes
We need to assume that all error codes not being -1, -2, -3, -4 are from AbortOnValue as we can't differentiate them. This now correctly reports AbortOnValue aborts with negative abort codes. Broken since a7ab54c (More detailed RTE error message, 2017-03-07). It did not help that the Igor Pro documentation is also wrong in this regard.
1 parent 52402c2 commit 090eb74

File tree

3 files changed

+37
-6
lines changed

3 files changed

+37
-6
lines changed

procedures/igortest-basics.ipf

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -453,15 +453,12 @@ static Function EvaluateRTE(err, errmessage, abortCode, funcName, funcType, proc
453453
IUTF_Reporting#AddError(str, IUTF_STATUS_ERROR)
454454
break
455455
default:
456+
sprintf str, "Encountered \"AbortOnValue\" Code %d in %s \"%s\" (%s)", abortCode, funcTypeString, funcName, procWin
457+
IUTF_Reporting#AddFailedSummaryInfo(str)
458+
IUTF_Reporting#AddError(str, IUTF_STATUS_ERROR)
456459
break
457460
endswitch
458461
message += str
459-
if(abortCode > 0)
460-
sprintf str, "Encountered \"AbortOnValue\" Code %d in %s \"%s\" (%s)", abortCode, funcTypeString, funcName, procWin
461-
IUTF_Reporting#AddFailedSummaryInfo(str)
462-
IUTF_Reporting#AddError(str, IUTF_STATUS_ERROR)
463-
message += str
464-
endif
465462
endif
466463

467464
IUTF_Reporting#ReportError(message, incrGlobalErrorCounter = 0)
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#pragma rtGlobals=3
2+
#pragma TextEncoding="UTF-8"
3+
#pragma rtFunctionErrors=1
4+
#pragma version=1.10
5+
#pragma ModuleName=TEST_Aborted
6+
7+
static Function TEST_CASE_BEGIN_OVERRIDE(testcase)
8+
string testcase
9+
10+
variable/G root:historyRef = CaptureHistoryStart()
11+
End
12+
13+
static Function TEST_CASE_END_OVERRIDE(testcase)
14+
string testcase
15+
16+
NVAR/SDFR=root: historyRef
17+
string/G root:history = CaptureHistory(historyRef, 1)
18+
End
19+
20+
// IUTF_EXPECTED_FAILURE
21+
static Function AbortWithNegativeValue()
22+
23+
AbortOnValue 1, -10
24+
End
25+
26+
static Function EvaluateAbortWithNegativeValue()
27+
28+
SVAR/SDFR=root: history
29+
30+
INFO("%s", s0 = history)
31+
32+
CHECK_GE_VAR(strsearch(history, "Encountered \"AbortOnValue\" Code -10 in test case \"TEST_Aborted#AbortWithNegativeValue\" (AbortedTestcases.ipf)", 0), 0)
33+
End

tests/UnitTests/main.ipf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include ":Tracing:ComplexityTests"
1111
#include ":Utils:PathsTests"
1212
#include ":Utils:StringsTests"
13+
#include ":Utils:AbortedTests"
1314

1415
#undef UTF_ALLOW_TRACING
1516
#if Exists("TUFXOP_Version")

0 commit comments

Comments
 (0)