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

Commit c0459db

Browse files
committed
[[ Tests ]] Test script compilation
This patch tests the scripts in the IDE compile and checks for explicit variable compliance. In order to avoid masses of unhelpful output the test does not assert explicit variable compliance if the script does not compile. This patch removes a code sample of a `ceiling` function from the resources stack as this no longer compiles given the function of the same name in the engine.
1 parent 748beda commit c0459db

File tree

2 files changed

+89
-0
lines changed

2 files changed

+89
-0
lines changed
-39.9 KB
Binary file not shown.
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
script "TestIDEScriptStatus"
2+
/*
3+
Copyright (C) 2017 LiveCode Ltd.
4+
5+
This file is part of LiveCode.
6+
7+
LiveCode is free software; you can redistribute it and/or modify it under
8+
the terms of the GNU General Public License v3 as published by the Free
9+
Software Foundation.
10+
11+
LiveCode is distributed in the hope that it will be useful, but WITHOUT ANY
12+
WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
for more details.
15+
16+
You should have received a copy of the GNU General Public License
17+
along with LiveCode. If not see <http://www.gnu.org/licenses/>. */
18+
19+
local sTestStack
20+
21+
on TestSetup
22+
create stack uuid()
23+
put it into sTestStack
24+
end TestSetup
25+
26+
on TestExplicitVariables
27+
local tStackFiles
28+
put the stackFiles of stack "home" into tStackFiles
29+
split tStackFiles by comma and return
30+
repeat for each key tStackName in tStackFiles
31+
if there is a stack tStackName then
32+
__RecursiveTest the long id of stack tStackName
33+
end if
34+
end repeat
35+
end TestExplicitVariables
36+
37+
private command __RecursiveTest pObject
38+
if the script of pObject is not empty then
39+
lock messages
40+
local tStatus
41+
put the scriptStatus of pObject into tStatus
42+
switch tStatus
43+
case "uncompiled"
44+
set the script of sTestStack to the script of pObject
45+
if the scriptStatus of sTestStack is "compiled" then
46+
put "compiled" into tStatus
47+
break
48+
end if
49+
case "error"
50+
TestAssert "compiles" && the long name of pObject, false
51+
break
52+
end switch
53+
54+
if tStatus is "compiled" then
55+
set the explicitVariables to true
56+
set the script of sTestStack to the script of pObject
57+
set the explicitVariables to false
58+
if the scriptStatus of sTestStack is not "compiled" then
59+
TestAssertBroken "explicit variables" && the long name of pObject, false, "Bug 20356"
60+
else
61+
TestAssert "explicit variables" && the long name of pObject, true
62+
end if
63+
end if
64+
unlock messages
65+
end if
66+
switch word 1 of pObject
67+
case "stack"
68+
repeat for each line tStack in the substacks of pObject
69+
__RecursiveTest the long id of stack tStack
70+
end repeat
71+
repeat for each line tID in the cardIDs of pObject
72+
__RecursiveTest the long id of card id tID of pObject
73+
end repeat
74+
break
75+
case "card"
76+
case "group"
77+
case "background"
78+
case "bkgnd"
79+
repeat for each line tID in the childControlIDs of pObject
80+
__RecursiveTest the long id of control id tID of pObject
81+
end repeat
82+
break
83+
default
84+
end switch
85+
end __RecursiveTest
86+
87+
on TestTeardown
88+
delete stack sTestStack
89+
end TestTeardown

0 commit comments

Comments
 (0)