This repository was archived by the owner on Aug 31, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 225
Expand file tree
/
Copy pathconstants.parsertest
More file actions
149 lines (136 loc) · 3.71 KB
/
constants.parsertest
File metadata and controls
149 lines (136 loc) · 3.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
%% Copyright (C) 2019 LiveCode Ltd.
%%
%% This file is part of LiveCode.
%%
%% LiveCode is free software; you can redistribute it and/or modify it under
%% the terms of the GNU General Public License v3 as published by the Free
%% Software Foundation.
%%
%% LiveCode is distributed in the hope that it will be useful, but WITHOUT ANY
%% WARRANTY; without even the implied warranty of MERCHANTABILITY or
%% FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
%% for more details.
%%
%% You should have received a copy of the GNU General Public License
%% along with LiveCode. If not see <http://www.gnu.org/licenses/>.
%% infinity constant is okay as uql assignment
%TEST UnquotedLiteralConstantInfinity
on compiler_test
local tInfinity = infinity
end compiler_test
%EXPECT PASS
%SUCCESS
%ENDTEST
%% true and false constants are okay for uql assignment
%TEST UnquotedLiteralConstantBoolean
on compiler_test
local tTrue = true
local tFalse = false
end compiler_test
%EXPECT PASS
%SUCCESS
%ENDTEST
%% string constants are okay for uql assignment if their
%% constant value is equal to their name
%TEST UnquotedLiteralConstantConverts
on compiler_test
local tDown = down
local tUp = up
local tRight = right
local tLeft = left
local tDone = done
end compiler_test
%EXPECT PASS
%SUCCESS
%ENDTEST
%% constants whose name values do not convert as the constant's
%% type to their value are only okay for uql assignment if
%% explicit variables is false
%TEST UnquotedLiteralConstantDoesntConvertNonExplicit
%SET explicitvariables false
// Real constant
local tPi = pi
// Integer constant
local tOne = one
// String constant
local tEOF = eof
// Special-case value constants
local tNull = null
local tEmpty = empty
end compiler_test
%EXPECT PASS
%SUCCESS
%ENDTEST
%TEST UnquotedLiteralRealConstantDoesntConvertExplicit
%SET explicitvariables true
on compiler_test
local tPi = pi%{UQL}
end compiler_test
%EXPECT PASS
%ERROR PE_LOCAL_BADINIT AT UQL
%ENDTEST
%TEST UnquotedLiteralIntegerConstantDoesntConvertExplicit
%SET explicitvariables true
on compiler_test
constant tOne = one%{UQL}
end compiler_test
%EXPECT PASS
%ERROR PE_CONSTANT_BADINIT AT UQL
%ENDTEST
%TEST UnquotedLiteralStringConstantDoesntConvertExplicit
%SET explicitvariables true
on compiler_test
local tEOF = eof%{UQL}
end compiler_test
%EXPECT PASS
%ERROR PE_LOCAL_BADINIT AT UQL
%ENDTEST
%TEST UnquotedLiteralNullDoesntConvertExplicit
%SET explicitvariables true
on compiler_test
constant tNull = null%{UQL}
end compiler_test
%EXPECT PASS
%ERROR PE_CONSTANT_BADINIT AT UQL
%ENDTEST
%TEST UnquotedLiteralEmptyDoesntConvertExplicit
%SET explicitvariables true
on compiler_test
local tEmpty = empty%{UQL}
end compiler_test
%EXPECT PASS
%ERROR PE_LOCAL_BADINIT AT UQL
%ENDTEST
%% infinity constant as uql assignment is case sensitive
%TEST UnquotedLiteralConstantInfinityCase
on compiler_test
local tInfinity = InFiNiTy%{UQL_CASE}
end compiler_test
%EXPECT PASS
%ERROR PE_LOCAL_BADINIT AT UQL_CASE
%ENDTEST
%% true constant as uql assignment is case sensitive
%TEST UnquotedLiteralConstantTrueCase
on compiler_test
local tInfinity = TrUe%{UQL_CASE}
end compiler_test
%EXPECT PASS
%ERROR PE_LOCAL_BADINIT AT UQL_CASE
%ENDTEST
%% false constant as uql assignment is case sensitive
%TEST UnquotedLiteralConstantFalseCase
on compiler_test
local tFalse = FaLsE%{UQL_CASE}
end compiler_test
%EXPECT PASS
%ERROR PE_LOCAL_BADINIT AT UQL_CASE
%ENDTEST
%% string constants with constant value is equal to
%% their name as uql assigment is case sensitive
%TEST UnquotedLiteralConstantConvertsCase
on compiler_test
local tDown = dOwN%{UQL_CASE}
end compiler_test
%EXPECT PASS
%ERROR PE_LOCAL_BADINIT AT UQL_CASE
%ENDTEST