pike.git/
src/
testsuite.in
Branch:
Tag:
Non-build tags
All tags
No tags
2006-03-01
2006-03-01 18:11:26 by Henrik Grubbström (Grubba) <grubba@grubba.org>
887c59f76960b58a517ce6257e103cdfbfd81f1e (
35
lines) (+
34
/-
1
)
[
Show
|
Annotate
]
Branch:
7.9
Added tests for problems with many local variables.
Rev: src/testsuite.in:1.761
1:
START_MARKER
-
test_true([["$Id: testsuite.in,v 1.
760
2006/
01
/
27
20
:
43
:
12
grubba Exp $"]]);
+
test_true([["$Id: testsuite.in,v 1.
761
2006/
03/
01
18
:
11
:
26
grubba Exp $"]]);
// This triggered a bug only if run sufficiently early. test_compile_any([[#pike 7.2]])
225:
} ]])
+
define(test_locals,[[
+
test_any([[
+
string line = sprintf("#line %d %O\n", __LINE__, __FILE__);
+
string s = (map(indices(allocate($1)), lambda(int no) {
+
no++;
+
return sprintf(" int var_%d;\n"
+
" if (var_%d)\n"
+
" error(\"Variable var_%d not \"\n"
+
" \"initialized to zero: \"\n"
+
" \"%%O\\n\",\n"
+
" var_%d);\n"
+
" var_%d = %d;\n",
+
no, no, no, no, no, no);
+
}) +
+
map(indices(allocate($1)), lambda(int no) {
+
no++;
+
return sprintf(" if (var_%d != %d)\n"
+
" error(\"Variable var_%d was \"\n"
+
" \"clobbered with %%O.\\n\",\n"
+
" var_%d);\n",
+
no, no, no, no);
+
})) * "";
+
program p = compile_string("int a() {\n" + line +
+
s +
+
" return 0;\n"
+
"}\n");
+
return p()->a();
+
]], 0)
+
]])
-
+
test_locals(255)
+
test_locals(256)
+
dnl FIXME: Add test that local and local:: in combination dnl with recursion works correctly.