Skip to content

Commit 3f9eda8

Browse files
committed
Merge remote-tracking branch 'upstream/develop-8.1' into merge-develop-8.1_24.05.17
2 parents 4a9ec06 + 2f303f7 commit 3f9eda8

File tree

13 files changed

+90
-18
lines changed

13 files changed

+90
-18
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/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

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/globalproperties.livecodescript

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ on _TestSetReadOnlyProperty
2020
set the screenPixelScale to 2
2121
end _TestSetReadOnlyProperty
2222

23-
constant kCantSetPropertyCode = 448
2423
on TestSetReadOnlyProperty
2524
TestAssertThrow "setting read-only global property throws", \
26-
"_TestSetReadOnlyProperty", the long id of me, kCantSetPropertyCode
25+
"_TestSetReadOnlyProperty", the long id of me, \
26+
"EE_PROPERTY_CANTSET"
2727
end TestSetReadOnlyProperty
2828

2929
on TestGetSetSecurityPermissions

tests/lcs/core/engine/password.livecodescript

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ on TestPassword
2929

3030
TestAssert "stack initial passKey true", the passKey of stack "foo"
3131

32-
TestAssertThrow "can't set password in community", "SetPasswordOnStack", the long id of me, 361
32+
TestAssertThrow "can't set password in community", \
33+
"SetPasswordOnStack", the long id of me, "EE_OBJECT_SETNOPROP"
3334

34-
TestAssertThrow "can't set passKey in community", "SetPasskeyOnStack", the long id of me, 361
35+
TestAssertThrow "can't set passKey in community", \
36+
"SetPasskeyOnStack", the long id of me, "EE_OBJECT_SETNOPROP"
3537

3638
delete stack "foo"
3739
end TestPassword

tests/lcs/core/engine/send.livecodescript

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,5 @@ end __SendError
6262

6363
on TestSendError
6464
TestAssertThrow "send throws correct error", __SendError, \
65-
the long id of me, 91
65+
the long id of me, "EE_CHUNK_NOSTACK"
6666
end TestSendError

tests/lcs/core/engine/target.livecodescript

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ end TestDeleteTargetInBackScript
4141

4242
on TestDeleteTargetInBehavior
4343
set the behavior of button "test" to the long id of button "script"
44-
TestAssertThrow "Delete target in behavior", "__TestDeleteTarget", the long id me, 347
44+
TestAssertThrow "Delete target in behavior", "__TestDeleteTarget", \
45+
the long id me, "EE_OBJECT_CANTREMOVE"
4546
set the behavior of button "test" to empty
4647
end TestDeleteTargetInBehavior
4748

0 commit comments

Comments
 (0)