diff options
author | Felix Mulder <felix.mulder@gmail.com> | 2016-08-09 18:42:54 +0200 |
---|---|---|
committer | Felix Mulder <felix.mulder@gmail.com> | 2016-08-19 15:37:33 +0200 |
commit | 5cd1d51c3cb44b2c9b2c1abd433da50a00e5219e (patch) | |
tree | 2f87a0e18b2c44cce28a2b424f2b3b1e97ac1732 /dottydoc/test/PackageStructure.scala | |
parent | 079e3db0f157ee6eae9e8a34b3bbf7a75cdaa929 (diff) | |
download | dotty-5cd1d51c3cb44b2c9b2c1abd433da50a00e5219e.tar.gz dotty-5cd1d51c3cb44b2c9b2c1abd433da50a00e5219e.tar.bz2 dotty-5cd1d51c3cb44b2c9b2c1abd433da50a00e5219e.zip |
Remove client from dottydoc - no more Scala.JS deps!
Diffstat (limited to 'dottydoc/test/PackageStructure.scala')
-rw-r--r-- | dottydoc/test/PackageStructure.scala | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/dottydoc/test/PackageStructure.scala b/dottydoc/test/PackageStructure.scala new file mode 100644 index 000000000..af6e52184 --- /dev/null +++ b/dottydoc/test/PackageStructure.scala @@ -0,0 +1,89 @@ +package dotty.tools +package dottydoc + +import org.junit.Test +import org.junit.Assert._ + +import dotc.util.SourceFile +import model.internal._ + +class PackageStructure extends DottyTest { + @Test def multipleCompilationUnits = { + val source1 = new SourceFile( + "<test>", + """ + |package scala + | + |trait A + """.stripMargin + ) + + val source2 = new SourceFile( + "<test>", + """ + |package scala + | + |trait B + """.stripMargin + ) + + checkSources(source1 :: source2 :: Nil) { doc => + doc.packages("scala") match { + case PackageImpl(_, List(tA, tB), _, _) => + assert( + tA.name == "A" && tB.name == "B", + s"trait A had name '${tA.name}' and trait B had name '${tB.name}'" + ) + case _ => fail("Incorrect package structure after run") + } + } + } + + + @Test def multiplePackages = { + val source1 = new SourceFile( + "<test>", + """ + |package scala + |package collection + | + |trait A + """.stripMargin) + + val source2 = new SourceFile( + "<test>", + """ + |package scala + |package collection + | + |trait B + """.stripMargin) + + checkSources(source1 :: source2 :: Nil) { doc => + doc.packages("scala") match { + case PackageImpl( + "scala", + List(PackageImpl("scala.collection", List(tA, tB), _, _)), + _, _ + ) => + assert( + tA.name == "A" && tB.name == "B", + s"trait A had name '${tA.name}' and trait B had name '${tB.name}'" + ) + + case _ => + fail(s"""Incorrect package structure for 'scala' package: ${doc.packages("scala")}""") + } + + doc.packages("scala.collection") match { + case PackageImpl("scala.collection", List(tA, tB), _, _) => + assert( + tA.name == "A" && tB.name == "B", + s"trait A had name '${tA.name}' and trait B had name '${tB.name}'" + ) + + case _ => fail("Incorrect package structure for 'scala.collection' package") + } + } + } +} |