summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2013-12-28 22:39:08 +0300
committerEugene Burmako <xeno.by@gmail.com>2013-12-29 10:24:19 +0300
commit08a5e03280e305bf19904a1a4f80ab328eeaacab (patch)
treeb70fd6785d72f4bc62342bbdf5b94d9fa005f8d8 /test
parent9f0594c57716ed551918e15be6da843982e8ba12 (diff)
downloadscala-08a5e03280e305bf19904a1a4f80ab328eeaacab.tar.gz
scala-08a5e03280e305bf19904a1a4f80ab328eeaacab.tar.bz2
scala-08a5e03280e305bf19904a1a4f80ab328eeaacab.zip
makes well-known packages and package classes consistent with each other
As discovered in https://groups.google.com/forum/#!topic/scala-user/RckXE90LoXo, RootClass.sourceModule and EmptyPackageClass.sourceModule used to incorrectly return NoSymbol instead of RootModule and EmptyPackage. This is now fixed.
Diffstat (limited to 'test')
-rw-r--r--test/junit/scala/reflect/internal/MirrorsTest.scala18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/junit/scala/reflect/internal/MirrorsTest.scala b/test/junit/scala/reflect/internal/MirrorsTest.scala
new file mode 100644
index 0000000000..9108af139f
--- /dev/null
+++ b/test/junit/scala/reflect/internal/MirrorsTest.scala
@@ -0,0 +1,18 @@
+package scala.reflect.internal
+
+import org.junit.Assert._
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+
+@RunWith(classOf[JUnit4])
+class MirrorsTest {
+ @Test def rootCompanionsAreConnected(): Unit = {
+ val cm = scala.reflect.runtime.currentMirror
+ import cm._
+ assertEquals("RootPackage.moduleClass == RootClass", RootClass, RootPackage.moduleClass)
+ assertEquals("RootClass.module == RootPackage", RootPackage, RootClass.module)
+ assertEquals("EmptyPackage.moduleClass == EmptyPackageClass", EmptyPackageClass, EmptyPackage.moduleClass)
+ assertEquals("EmptyPackageClass.module == EmptyPackage", EmptyPackage, EmptyPackageClass.module)
+ }
+} \ No newline at end of file