Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 5fb5e76

Browse files
Merge pull request #5510 from livecodeali/merge-develop-8.1_24.05.17
Merge develop 8.1 24.05.17
2 parents 7f69d34 + 9617fcd commit 5fb5e76

18 files changed

+104
-60
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ script: |
9494
mkdir -p "${LICENSE_DIR}" &&
9595
touch "${LICENSE_DIR}/livecode-firstrun.lcf" &&
9696
make all-${BUILD_PLATFORM} &&
97-
${CHECK_COMMAND} make check-${BUILD_PLATFORM}
97+
${CHECK_COMMAND} make check-${BUILD_PLATFORM} V=1
9898
fi
9999
100100
addons:

docs/development/testing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Before running each test command, the test framework inserts a test library stac
6161
* `TestAssert pDescription, pExpectTrue`: Make a test assertion. The test is recorded as a failure if *pExpectTrue* is false. *pDescription* should be a short string that describes the test (e.g. "clipboard is clear").
6262
* `TestSkip pDescription, pReasonSkipped`: Record a test as having been skipped. *pReasonSkipped* should be a short explanation of why the test was skipped (e.g. "not supported on Windows").
6363
* `TestAssertBroken pDescription, pExpectTrue, pReasonBroken`: The same as `TestAssert`, but marking the test as "expected to fail". *pReasonBroken* should be a short explanation of why the test is currently expected to fail; it should almost always be a reference to a bug report, e.g. "bug 54321".
64-
* `TestAssertThrow pDescription, pHandlerName, pTarget, pExpectedError, pParam`: Assert that a given handler triggers the expected error message. *pHandlerName* is the name of the handler containing the script expected to cause an error; it is dispatched to *pTarget* with *pParam* as a parameter within a try/catch structure. *pExpectedError* is the expected script execution error code.
64+
* `TestAssertThrow pDescription, pHandlerName, pTarget, pExpectedError, pParam`: Assert that a given handler triggers the expected error message. *pHandlerName* is the name of the handler containing the script expected to cause an error; it is dispatched to *pTarget* with *pParam* as a parameter within a try/catch structure. *pExpectedError* is the expected script execution error name in the enumeration in engine/src/executionerrors.h - e.g. `"EE_PROPERTY_CANTSET"`.
6565
* `TestAssertDoesNotThrow pDescription, pHandlerName, pTarget, pParam`: Assert that a given handler does not trigger any exceptions. *pHandlerName* is the name of the handler containing the script expected to cause an error; it is dispatched to *pTarget* with *pParam* as a parameter within a try/catch structure.
6666
* `TestGetEngineRepositoryPath`: A function that returns the path to the main LiveCode engine repository.
6767
* `TestGetIDERepositoryPath`: A function that returns the path to the LiveCode IDE repository.

extensions/libraries/json/tests/numbers.livecodescript

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,5 @@ on TestImportLonelyInt
4747
TestAssert "import lonely single-digit integer", tExpected is tValue
4848

4949
TestAssertThrow "import lonely minus sign", "__TestImportLonelyInt_Minus", \
50-
the long id of me, 863, ""
50+
the long id of me, "EE_EXTENSION_ERROR_DOMAIN"
5151
end TestImportLonelyInt

extensions/widgets/graph/tests/properties.livecodescript

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,5 @@ on _TestEmptyGraphData
5858
end _TestEmptyGraphData
5959
on TestEmptyGraphData
6060
TestAssertThrow "set graph data to empty", "_TestEmptyGraphData", \
61-
the long id of me, 863 -- Error occurred in extension
61+
the long id of me, "EE_EXTENSION_ERROR_DOMAIN"
6262
end TestEmptyGraphData

extensions/widgets/spinner/tests/properties.livecodescript

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,5 @@ end _TestOutOfRangeMarkerCount
3333

3434
on TestOutOfRangeMarkerCount
3535
TestAssertThrow "set markerCount to 4", "_TestOutOfRangeMarkerCount", \
36-
the long id of me, 863 -- Error occurred in extension
36+
the long id of me, "EE_EXTENSION_ERROR_DOMAIN"
3737
end TestOutOfRangeMarkerCount

tests/_parsertestrunner.livecodescript

Lines changed: 4 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -106,41 +106,11 @@ local sErrorMap
106106
private command __BuildErrorMap
107107
if sErrorMap is not empty then
108108
exit __BuildErrorMap
109-
end if
110-
111-
local tSourceFile
112-
put TestGetEngineRepositoryPath() & slash & "engine/src/parseerrors.h" \
113-
into tSourceFile
114-
115-
local tSource
116-
put textDecode(url("binfile:" & tSourceFile), "utf-8") into tSource
109+
end if
117110

118-
local tErrorMap, tCurrentCode, tCodeFound
119-
put false into tCodeFound
120-
repeat for each line tLine in tSource
121-
if tLine is empty then next repeat
122-
if word 1 of tLine begins with "PE_UNDEFINED" then next repeat
123-
124-
local tCode
125-
if matchText(tLine, ".*\/\/ \{PE-([0-9]{4})\}.*", tCode) then
126-
put tCode into tCurrentCode
127-
put true into tCodeFound
128-
next repeat
129-
end if
130-
if word 1 of tLine begins with "PE_" then
131-
if tCodeFound is false then
132-
if tCurrentCode is empty then
133-
throw "no parse error code found:" && tLine
134-
else
135-
throw "duplicate parse error code" && tCurrentCode && "found:" && tLine
136-
end if
137-
138-
end if
139-
put item 1 of (word 1 of tLine) into tErrorMap[tCurrentCode]
140-
put false into tCodeFound
141-
end if
142-
end repeat
143-
put tErrorMap into sErrorMap
111+
write the backscripts to stdout
112+
113+
put TestBuildErrorMap("parseerrors.h", "PE", "UNDEFINED") into sErrorMap
144114
end __BuildErrorMap
145115

146116
function CompilerTestRunner_DoesOutputSatisfyAssertion pCompilerOutput, pCompilerExitCode, pAssertion, pTestInfo

tests/_testlib.livecodescript

Lines changed: 59 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,64 @@ private command _TestLoadExtension pFolder, pPath
143143
return the result
144144
end _TestLoadExtension
145145

146+
function TestBuildErrorMap pErrorFile, pErrorPrefix, pZerothError
147+
local tSourceFile
148+
put TestGetEngineRepositoryPath() & slash & "engine/src/" & \
149+
pErrorFile into tSourceFile
150+
151+
local tSource
152+
put textDecode(url("binfile:" & tSourceFile), "utf-8") into tSource
153+
154+
local tErrorMap, tCurrentCode, tCodeFound
155+
put false into tCodeFound
156+
repeat for each line tLine in tSource
157+
if tLine is empty then next repeat
158+
if word 1 of tLine begins with pErrorPrefix & "_" & pZerothError then
159+
next repeat
160+
end if
161+
162+
local tCode
163+
if matchText(tLine, ".*\/\/ \{" & pErrorPrefix & "-([0-9]{4})\}.*", tCode) then
164+
put tCode into tCurrentCode
165+
put true into tCodeFound
166+
next repeat
167+
end if
168+
if word 1 of tLine begins with pErrorPrefix & "_" then
169+
if tCodeFound is false then
170+
if tCurrentCode is empty then
171+
throw "no error code found:" && tLine
172+
else
173+
throw "duplicate error code" && tCurrentCode && "found:" && tLine
174+
end if
175+
176+
end if
177+
put item 1 of (word 1 of tLine) into tErrorMap[tCurrentCode]
178+
put false into tCodeFound
179+
end if
180+
end repeat
181+
182+
return tErrorMap
183+
end TestBuildErrorMap
184+
185+
local sExecErrorMap
186+
private command __TestEnsureExecErrorMap
187+
if sExecErrorMap is not empty then
188+
exit __TestEnsureExecErrorMap
189+
end if
190+
191+
put TestBuildErrorMap("executionerrors.h", "EE", "UNDEFINED") \
192+
into sExecErrorMap
193+
end __TestEnsureExecErrorMap
194+
195+
private function __TestErrorMatches pError, pCode
196+
__TestEnsureExecErrorMap
197+
198+
local tErrorNumber
199+
put format("%04d", item 1 of line 1 of pError) into tErrorNumber
200+
201+
return sExecErrorMap[tErrorNumber] is pCode
202+
end __TestErrorMatches
203+
146204
----------------------------------------------------------------
147205
-- Unit test library functions
148206
----------------------------------------------------------------
@@ -197,8 +255,7 @@ on TestAssertThrow pDescription, pHandler, pTarget, pErrorCodes, pParam
197255
local tSuccess
198256
put true into tSuccess
199257
repeat for each item tErrorCode in pErrorCodes
200-
put tSuccess and \
201-
(tErrorCode is item 1 of the first line of tError) into tSuccess
258+
put tSuccess and __TestErrorMatches(tError, tErrorCode) into tSuccess
202259
delete the first line of tError
203260
end repeat
204261

tests/_testrunnerbehavior.livecodescript

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ private command doRun pInfo
118118
put tLogForWriting into url ("binfile:" & tLogFilename)
119119

120120
if TesterTapGetWorstResult(tAnalysis) is "FAIL" then
121+
if $V is not empty then
122+
write tLogForWriting to stdout
123+
end if
121124
quit 1
122125
end if
123126
end doRun

tests/lcs/core/array/vector.livecodescript

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,6 @@ on TestVectorDotProduct
5757
TestAssert "non-integer keys (1,2,3) dot (2,3,5) is 23", \
5858
vectorDotProduct(tLeft, tRight) is 23
5959
TestAssertThrow "dot of mismatched vectors is error", \
60-
"DoTestVectorDotMismatchedArrays", the long id of me, 891
60+
"DoTestVectorDotMismatchedArrays", the long id of me, \
61+
"EE_VECTORDOT_MISMATCH"
6162
end TestVectorDotProduct

tests/lcs/core/engine/behavior.livecodescript

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ on TestCyclicBehavior
2929
create stack
3030
set the behavior of it to the long id of stack "Behavior"
3131
TestAssertThrow "cycle in behavior script hierarchy throws", \
32-
"_TestCyclicBehavior", the long id of me, 678, it
32+
"_TestCyclicBehavior", the long id of me, \
33+
"EE_PARENTSCRIPT_CYCLICOBJECT", it
3334
end TestCyclicBehavior
3435

3536
on TestInvalidBehaviorChange
@@ -46,7 +47,7 @@ on TestInvalidBehaviorChange
4647
create stack
4748
set the behavior of it to the long id of stack "Behavior"
4849
TestAssertThrow "behavior change while parent script is executing throws", \
49-
"changeBehavior", it, 897
50+
"changeBehavior", it, "EE_PARENTSCRIPT_EXECUTING"
5051
end TestInvalidBehaviorChange
5152

5253
on _TestInvalidObjectBehavior pStack
@@ -60,7 +61,8 @@ on TestInvalidObjectTypeBehavior
6061
put it into tStack
6162

6263
TestAssertThrow "set behavior to non-button control throws", \
63-
"_TestInvalidObjectBehavior", the long id of me, 673, tStack
64+
"_TestInvalidObjectBehavior", the long id of me, \
65+
"EE_PARENTSCRIPT_BADOBJECT", tStack
6466
end TestInvalidObjectTypeBehavior
6567

6668
----------------------------------------------------------------

0 commit comments

Comments
 (0)