diff options
author | paltherr <paltherr@epfl.ch> | 2005-02-09 14:30:38 +0000 |
---|---|---|
committer | paltherr <paltherr@epfl.ch> | 2005-02-09 14:30:38 +0000 |
commit | c053c8af0027ccb85354d06227a3ba27ad37be24 (patch) | |
tree | a69f15b044c41fe99badbb215f62ad0aef3e3a0b | |
parent | 390e2599ebb1d2a8294849ecb662949b0991e5e5 (diff) | |
download | scala-c053c8af0027ccb85354d06227a3ba27ad37be24.tar.gz scala-c053c8af0027ccb85354d06227a3ba27ad37be24.tar.bz2 scala-c053c8af0027ccb85354d06227a3ba27ad37be24.zip |
- Added tests for bug 396
-rw-r--r-- | test/files/run/bugs.check | 6 | ||||
-rw-r--r-- | test/files/run/bugs.scala | 24 | ||||
-rw-r--r-- | test/files/run/runtime.check | 29 | ||||
-rw-r--r-- | test/files/run/runtime.scala | 48 |
4 files changed, 100 insertions, 7 deletions
diff --git a/test/files/run/bugs.check b/test/files/run/bugs.check index fe780cd863..7dd6a42bfb 100644 --- a/test/files/run/bugs.check +++ b/test/files/run/bugs.check @@ -85,3 +85,9 @@ hello <<< bug 328 >>> bug 328 +<<< bug 396 +A +B +C +>>> bug 396 + diff --git a/test/files/run/bugs.scala b/test/files/run/bugs.scala index 757c80cee6..494ed35b53 100644 --- a/test/files/run/bugs.scala +++ b/test/files/run/bugs.scala @@ -409,6 +409,29 @@ object Bug328Test { } //############################################################################ +// Bug 396 + +class Bug396A { + class I { + def run = System.out.println("A"); + } +} +class Bug396B extends Bug396A { + class I extends super.I { + override def run = { super.run; System.out.println("B"); } + } +} +class Bug396C extends Bug396A { + class I extends super.I { + override def run = { super.run; System.out.println("C"); } + } +} +object Bug396Test extends Bug396B with Bug396C with Application { + class I2 extends super[Bug396B].I with super[Bug396C].I; + (new I2).run +} + +//############################################################################ // Main object Test { @@ -454,6 +477,7 @@ object Test { else Bug281Test.main(args)); // !!! test(316, Bug316Test.main(args)); test(328, Bug328Test.main(args)); + test(396, Bug396Test.main(args)); if (errors > 0) { System.out.println(); diff --git a/test/files/run/runtime.check b/test/files/run/runtime.check index 806a4b3c17..2f7a6180bf 100644 --- a/test/files/run/runtime.check +++ b/test/files/run/runtime.check @@ -1,4 +1,4 @@ -<<< bug Test0 +<<< Test0 hello [] [false,true] @@ -12,9 +12,9 @@ hello [6,7,8.0,9.0] [string] [0,bye] ->>> bug Test0 +>>> Test0 -<<< bug Test1 +<<< Test1 10 14 15 @@ -24,5 +24,26 @@ hello 24 25 26 ->>> bug Test1 +>>> Test1 + +<<< Test2 +A +M0 +N0 + +A +N0 +M0 + +A +M0 +M1 +N0 + +A +N0 +N1 +M0 + +>>> Test2 diff --git a/test/files/run/runtime.scala b/test/files/run/runtime.scala index f83f0a4133..a6f1e15513 100644 --- a/test/files/run/runtime.scala +++ b/test/files/run/runtime.scala @@ -97,12 +97,53 @@ object Test1Test { } //############################################################################ +// Test 2 - Super Calls with Mixins + +package test2 { + + class A { + def run = System.out.println("A"); + } + + class M0 extends A { + override def run = { super.run; System.out.println("M0"); } + } + + class M1 extends M0 { + override def run = { super.run; System.out.println("M1"); } + } + + class N0 extends A { + override def run = { super.run; System.out.println("N0"); } + } + + class N1 extends N0 { + override def run = { super.run; System.out.println("N1"); } + } + + object M0N0 extends M0 with N0; + object N0M0 extends N0 with M0; + object M1N0 extends M1 with N0; + object N1M0 extends N1 with M0; + +} + +object Test2Test { + def main(args: Array[String]): Unit = { + test2.M0N0.run; System.out.println(); + test2.N0M0.run; System.out.println(); + test2.M1N0.run; System.out.println(); + test2.N1M0.run; System.out.println(); + } +} + +//############################################################################ // Main object Test { var errors: Int = 0; - def test(bug: String, test: => Unit): Unit = { - System.out.println("<<< bug " + bug); + def test(name: String, test: => Unit): Unit = { + System.out.println("<<< " + name); try { test; } catch { @@ -113,7 +154,7 @@ object Test { errors = errors + 1; } } - System.out.println(">>> bug " + bug); + System.out.println(">>> " + name); System.out.println(); } @@ -121,6 +162,7 @@ object Test { test("Test0" , Test0Test.main(args)); test("Test1" , Test1Test.main(args)); + test("Test2" , Test2Test.main(args)); if (errors > 0) { System.out.println(); |