Skip to content

Commit 624621a

Browse files
committed
Update error test references
1 parent 31f9017 commit 624621a

File tree

5 files changed

+309
-0
lines changed

5 files changed

+309
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"basename": "asr-test_list_const-4ffce80",
3+
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}",
4+
"infile": "tests/../integration_tests/test_list_const.py",
5+
"infile_hash": "f2918a01e7e8a190f97d10ae208627d34944ee9d57aa98e01a239d1d",
6+
"outfile": null,
7+
"outfile_hash": null,
8+
"stdout": "asr-test_list_const-4ffce80.stdout",
9+
"stdout_hash": "1f4d504cea56850fcaa47eac751b413ce6644e36da970c1a1ad26289",
10+
"stderr": null,
11+
"stderr_hash": null,
12+
"returncode": 0
13+
}
Lines changed: 270 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,270 @@
1+
(TranslationUnit
2+
(SymbolTable
3+
1
4+
{
5+
__main__:
6+
(Module
7+
(SymbolTable
8+
2
9+
{
10+
__main__global_stmts:
11+
(Function
12+
(SymbolTable
13+
4
14+
{
15+
16+
})
17+
__main__global_stmts
18+
(FunctionType
19+
[]
20+
()
21+
Source
22+
Implementation
23+
()
24+
.false.
25+
.false.
26+
.false.
27+
.false.
28+
.false.
29+
[]
30+
.false.
31+
)
32+
[test_list_const]
33+
[]
34+
[(SubroutineCall
35+
2 test_list_const
36+
()
37+
[]
38+
()
39+
)]
40+
()
41+
Public
42+
.false.
43+
.false.
44+
()
45+
),
46+
test_list_const:
47+
(Function
48+
(SymbolTable
49+
3
50+
{
51+
CONST_INTEGER_LIST:
52+
(Variable
53+
3
54+
CONST_INTEGER_LIST
55+
[]
56+
Local
57+
(ListConstant
58+
[(IntegerConstant 1 (Integer 4))
59+
(IntegerConstant 2 (Integer 4))
60+
(IntegerConstant 3 (Integer 4))
61+
(IntegerConstant 4 (Integer 4))
62+
(IntegerConstant 5 (Integer 4))
63+
(IntegerConstant 1 (Integer 4))]
64+
(List
65+
(Integer 4)
66+
)
67+
)
68+
(ListConstant
69+
[(IntegerConstant 1 (Integer 4))
70+
(IntegerConstant 2 (Integer 4))
71+
(IntegerConstant 3 (Integer 4))
72+
(IntegerConstant 4 (Integer 4))
73+
(IntegerConstant 5 (Integer 4))
74+
(IntegerConstant 1 (Integer 4))]
75+
(List
76+
(Integer 4)
77+
)
78+
)
79+
Parameter
80+
(Const
81+
(List
82+
(Integer 4)
83+
)
84+
)
85+
()
86+
Source
87+
Public
88+
Required
89+
.false.
90+
),
91+
CONST_STRING_LIST:
92+
(Variable
93+
3
94+
CONST_STRING_LIST
95+
[]
96+
Local
97+
(ListConstant
98+
[(StringConstant
99+
"ALPHA"
100+
(Character 1 5 ())
101+
)
102+
(StringConstant
103+
"BETA"
104+
(Character 1 4 ())
105+
)
106+
(StringConstant
107+
"RELEASE"
108+
(Character 1 7 ())
109+
)]
110+
(List
111+
(Character 1 5 ())
112+
)
113+
)
114+
(ListConstant
115+
[(StringConstant
116+
"ALPHA"
117+
(Character 1 5 ())
118+
)
119+
(StringConstant
120+
"BETA"
121+
(Character 1 4 ())
122+
)
123+
(StringConstant
124+
"RELEASE"
125+
(Character 1 7 ())
126+
)]
127+
(List
128+
(Character 1 5 ())
129+
)
130+
)
131+
Parameter
132+
(Const
133+
(List
134+
(Character 1 -2 ())
135+
)
136+
)
137+
()
138+
Source
139+
Public
140+
Required
141+
.false.
142+
)
143+
})
144+
test_list_const
145+
(FunctionType
146+
[]
147+
()
148+
Source
149+
Implementation
150+
()
151+
.false.
152+
.false.
153+
.false.
154+
.false.
155+
.false.
156+
[]
157+
.false.
158+
)
159+
[]
160+
[]
161+
[(Assert
162+
(IntegerCompare
163+
(ListCount
164+
(Var 3 CONST_INTEGER_LIST)
165+
(IntegerConstant 1 (Integer 4))
166+
(Integer 4)
167+
()
168+
)
169+
Eq
170+
(IntegerConstant 2 (Integer 4))
171+
(Logical 4)
172+
()
173+
)
174+
()
175+
)
176+
(Assert
177+
(IntegerCompare
178+
(IntrinsicScalarFunction
179+
ListIndex
180+
[(Var 3 CONST_INTEGER_LIST)
181+
(IntegerConstant 1 (Integer 4))]
182+
0
183+
(Integer 4)
184+
()
185+
)
186+
Eq
187+
(IntegerConstant 0 (Integer 4))
188+
(Logical 4)
189+
()
190+
)
191+
()
192+
)
193+
(Assert
194+
(IntegerCompare
195+
(ListCount
196+
(Var 3 CONST_STRING_LIST)
197+
(StringConstant
198+
"ALPHA"
199+
(Character 1 5 ())
200+
)
201+
(Integer 4)
202+
()
203+
)
204+
Eq
205+
(IntegerConstant 1 (Integer 4))
206+
(Logical 4)
207+
()
208+
)
209+
()
210+
)
211+
(Assert
212+
(IntegerCompare
213+
(IntrinsicScalarFunction
214+
ListIndex
215+
[(Var 3 CONST_STRING_LIST)
216+
(StringConstant
217+
"RELEASE"
218+
(Character 1 7 ())
219+
)]
220+
0
221+
(Integer 4)
222+
()
223+
)
224+
Eq
225+
(IntegerConstant 2 (Integer 4))
226+
(Logical 4)
227+
()
228+
)
229+
()
230+
)]
231+
()
232+
Public
233+
.false.
234+
.false.
235+
()
236+
)
237+
})
238+
__main__
239+
[]
240+
.false.
241+
.false.
242+
),
243+
main_program:
244+
(Program
245+
(SymbolTable
246+
5
247+
{
248+
__main__global_stmts:
249+
(ExternalSymbol
250+
5
251+
__main__global_stmts
252+
2 __main__global_stmts
253+
__main__
254+
[]
255+
__main__global_stmts
256+
Public
257+
)
258+
})
259+
main_program
260+
[__main__]
261+
[(SubroutineCall
262+
5 __main__global_stmts
263+
2 __main__global_stmts
264+
[]
265+
()
266+
)]
267+
)
268+
})
269+
[]
270+
)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"basename": "asr-test_list_const-7b77194",
3+
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}",
4+
"infile": "tests/errors/test_list_const.py",
5+
"infile_hash": "794f98a9e575bf64082d76c78f2466bf023c8b3f9432fdf3ec8fe866",
6+
"outfile": null,
7+
"outfile_hash": null,
8+
"stdout": null,
9+
"stdout_hash": null,
10+
"stderr": "asr-test_list_const-7b77194.stderr",
11+
"stderr_hash": "d18d6fde09df77a8af0b7b1f15e05aeb6b02e79c62ab97c5af79305d",
12+
"returncode": 2
13+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
semantic error: cannot append element to a const list
2+
--> tests/errors/test_list_const.py:6:5
3+
|
4+
6 | CONST_INTEGER_LIST.append(6)
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/tests.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,10 @@ asr = true
487487
filename = "../integration_tests/global_syms_01.py"
488488
asr = true
489489

490+
[[test]]
491+
filename = "../integration_tests/test_list_const.py"
492+
asr = true
493+
490494
[[test]]
491495
filename = "cast.py"
492496
asr = true
@@ -827,6 +831,10 @@ asr = true
827831
filename = "errors/test_list_slicing.py"
828832
asr = true
829833

834+
[[test]]
835+
filename = "errors/test_list_const.py"
836+
asr = true
837+
830838
[[test]]
831839
filename = "errors/test_annassign_01.py"
832840
asr = true

0 commit comments

Comments
 (0)