pike.git/
src/
testsuite.in
Branch:
Tag:
Non-build tags
All tags
No tags
2002-03-01
2002-03-01 13:42:50 by Martin Stjernholm <mast@lysator.liu.se>
fa8c4f01fd95d9f39f9fd91ef4c45b4179dd3e72 (
36
lines) (+
35
/-
1
)
[
Show
|
Annotate
]
Branch:
7.9
Added a test case for two rather tricky resolver problems.
Rev: src/testsuite.in:1.486
1:
-
test_true([["$Id: testsuite.in,v 1.
485
2002/
02
/
28
12
:
22
:
03
mast Exp $"]]);
+
test_true([["$Id: testsuite.in,v 1.
486
2002/
03
/
01
13
:
42
:
50
mast Exp $"]]);
cond([[all_constants()->_verify_internals]], [[
1200:
Stdio.recursive_rm ("testsuite_test_dir.pmod"); ]]);
+
test_any_equal([[
+
// Problem 1: module.pmod is in pass 1 when it tries to resolve the
+
// .B.c constant and is therefore temparily interned as a
+
// placeholder object. The (<>) in B.pike is equivalent to
+
// aggregate_multiset, which due to the import is looked up in the
+
// placeholder object and therefore resolved as a placeholder
+
// object.
+
//
+
// Problem 2: The placeholder object isn't constant and is delayed
+
// to pass 2. The index operation in B.c will therefore try to index
+
// out an undefined constant which leads to a fatal.
+
Stdio.recursive_rm ("testsuite_test_dir.pmod");
+
mkdir ("testsuite_test_dir.pmod");
+
+
Stdio.write_file ("testsuite_test_dir.pmod/module.pmod", #"\
+
mixed x = .B.c;");
+
Stdio.write_file ("testsuite_test_dir.pmod/B.pike", #"\
+
import \".\";
+
constant c = (<>);");
+
+
object orig_master = master();
+
replace_master (object_program (orig_master)());
+
mixed res;
+
mixed err = catch {
+
res = compile_string (#"\
+
mixed foo() {return .testsuite_test_dir.B.c;}",
+
"test")()->foo();
+
};
+
replace_master (orig_master);
+
if (err) throw (err);
+
return res;
+
]], (<>));
+
cond(0,[[ test_do([[ // This is a case of cyclic references I think should work, but