diff options
author | paltherr <paltherr@epfl.ch> | 2003-06-18 16:14:25 +0000 |
---|---|---|
committer | paltherr <paltherr@epfl.ch> | 2003-06-18 16:14:25 +0000 |
commit | b74ad75078d533fc59cf858379a2a0d2f9bfde62 (patch) | |
tree | 0bc63be11df2a156973b4772c036020c7707e0be | |
parent | f770cdac705b6a4bf71762e29382142c7053f4f4 (diff) | |
download | scala-b74ad75078d533fc59cf858379a2a0d2f9bfde62.tar.gz scala-b74ad75078d533fc59cf858379a2a0d2f9bfde62.tar.bz2 scala-b74ad75078d533fc59cf858379a2a0d2f9bfde62.zip |
- Added files/run/imports.scala
- Added files/run/imports.check
-rw-r--r-- | test/files/run/imports.check | 12 | ||||
-rw-r--r-- | test/files/run/imports.scala | 95 |
2 files changed, 107 insertions, 0 deletions
diff --git a/test/files/run/imports.check b/test/files/run/imports.check new file mode 100644 index 0000000000..56f5e23d45 --- /dev/null +++ b/test/files/run/imports.check @@ -0,0 +1,12 @@ +In C_ico, v_ico .toString() returns C_ico -> ok +In C_ico, field .toString() returns C_ico -> ok +In C_ico, method.toString() returns C_ico -> ok + +In C_ioc, v_ioc .toString() returns C_ioc -> ok +In C_ioc, field .toString() returns C_ioc -> ok +In C_ioc, method.toString() returns C_ioc -> ok + +In C_oic, v_oic .toString() returns C_oic -> ok +In C_oic, field .toString() returns C_oic -> ok +In C_oic, method.toString() returns C_oic -> ok + diff --git a/test/files/run/imports.scala b/test/files/run/imports.scala new file mode 100644 index 0000000000..0eb342b984 --- /dev/null +++ b/test/files/run/imports.scala @@ -0,0 +1,95 @@ +//############################################################################ +// Import statements +//############################################################################ +// $Id$ + +//############################################################################ + +object checker { + def check(where: String, what: String, value: Any): Unit = { + System.out.print("In " + where + ", " + what + ".toString() returns "); + System.out.flush(); + val string: String = if (value == null) "null" else value.toString(); + val test = if (string == where) "ok" else "KO"; + System.out.println(string + " -> " + test); + System.out.flush(); + } +} + +import checker.check; + +//############################################################################ + +import o_ico.v_ico; + +class C_ico() { + o_ico.v_ico = this; + override def toString(): String = "C_ico"; + def method: C_ico = v_ico; + val field: C_ico = v_ico; + + check("C_ico", "v_ico ", v_ico); + check("C_ico", "field ", field); + check("C_ico", "method", method); + System.out.println(); +} + +object o_ico { + var v_ico: C_ico = null; + new C_ico(); +} + +//############################################################################ + +import o_ioc.v_ioc; + +object o_ioc { + var v_ioc: C_ioc = null; + new C_ioc(); +} + +class C_ioc() { + o_ioc.v_ioc = this; + override def toString(): String = "C_ioc"; + def method: C_ioc = v_ioc; + val field: C_ioc = v_ioc; + + check("C_ioc", "v_ioc ", v_ioc); + check("C_ioc", "field ", field); + check("C_ioc", "method", method); + System.out.println(); +} + +//############################################################################ + +object o_oic { + var v_oic: C_oic = null; + new C_oic(); +} + +import o_oic.v_oic; + +class C_oic() { + o_oic.v_oic = this; + override def toString(): String = "C_oic"; + def method: C_oic = v_oic; + val field: C_oic = v_oic; + + check("C_oic", "v_oic ", v_oic); + check("C_oic", "field ", field); + check("C_oic", "method", method); + System.out.println(); +} + +//############################################################################ + +object Test { + def main(args: Array[String]): Unit = { + o_ico; + o_ioc; + o_oic; + () + } +} + +//############################################################################ |