diff options
author | Gilles Dubochet <gilles.dubochet@epfl.ch> | 2009-11-24 19:57:32 +0000 |
---|---|---|
committer | Gilles Dubochet <gilles.dubochet@epfl.ch> | 2009-11-24 19:57:32 +0000 |
commit | 326e2573711c204c2ddf4a65d70325df22eca8ff (patch) | |
tree | ea0e8c0adc681d3c71ddf67c3370a75e77e92d43 /test/disabled/run | |
parent | d9e3dde6d6d18b9a93e7566447cc3ee342f033d5 (diff) | |
download | scala-326e2573711c204c2ddf4a65d70325df22eca8ff.tar.gz scala-326e2573711c204c2ddf4a65d70325df22eca8ff.tar.bz2 scala-326e2573711c204c2ddf4a65d70325df22eca8ff.zip |
Disabled docgenerator test, which isn't compati...
Disabled docgenerator test, which isn't compatible with Scaladoc 2.
Diffstat (limited to 'test/disabled/run')
-rw-r--r-- | test/disabled/run/docgenerator.check | 177 | ||||
-rw-r--r-- | test/disabled/run/docgenerator.scala | 295 |
2 files changed, 472 insertions, 0 deletions
diff --git a/test/disabled/run/docgenerator.check b/test/disabled/run/docgenerator.check new file mode 100644 index 0000000000..dbb7eeed28 --- /dev/null +++ b/test/disabled/run/docgenerator.check @@ -0,0 +1,177 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> + <head><title>List of all classes and objects</title> + <meta http-equiv="content-type" content="text/html; charset=UTF8"></meta><meta content="scaladoc" name="generator"></meta><link href="style.css" type="text/css" rel="stylesheet"></link><script type="text/javascript" src="script.js"></script> + </head> + <body onload="init()"><div><div class="kinds" id="Classes">Classes</div><ul class="list"> + <li id="Classes_C"><a href="examples/C0.html" target="contentFrame">C0</a></li> +<li><a href="examples/C0.C1_Protected.html" target="contentFrame">C0.C1_Protected</a></li> +<li><a href="examples/C0.C1_Public.html" target="contentFrame">C0.C1_Public</a></li> +<li><a href="examples/C0_Protected.html" target="contentFrame">C0_Protected</a></li> +<li><a href="examples/C0_Protected.C1_Protected.html" target="contentFrame">C0_Protected.C1_Protected</a></li> +<li><a href="examples/C0_Protected.C1_Public.html" target="contentFrame">C0_Protected.C1_Public</a></li> + </ul> +<div class="kinds" id="Objects">Objects</div><ul class="list"> + <li id="Objects_o"><a href="examples/obj0$object.html" target="contentFrame">obj0</a></li> +<li><a href="examples/obj0$object.obj1_Protected$object.html" target="contentFrame">obj0.obj1_Protected</a></li> +<li><a href="examples/obj0$object.obj1_Public$object.html" target="contentFrame">obj0.obj1_Public</a></li> +<li><a href="examples/obj0_Protected$object.html" target="contentFrame">obj0_Protected</a></li> +<li><a href="examples/obj0_Protected$object.obj1_Protected$object.html" target="contentFrame">obj0_Protected.obj1_Protected</a></li> +<li><a href="examples/obj0_Protected$object.obj1_Public$object.html" target="contentFrame">obj0_Protected.obj1_Public</a></li> + </ul></div></body> + </html> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> + <head><title>Scala 2</title> + <meta http-equiv="content-type" content="text/html; charset=UTF8"></meta><meta content="scaladoc" name="generator"></meta><link href="style.css" type="text/css" rel="stylesheet"></link><script type="text/javascript" src="script.js"></script> + </head> + <frameset cols="25%, 75%"> + <frameset rows="50%, 28, 50%"> + <frame src="modules.html" name="modulesFrame"></frame> + <frame src="nav-classes.html" name="navigationFrame"></frame> + <frame src="all-classes.html" name="classesFrame"></frame> + </frameset> + <frame src="root-content.html" name="contentFrame"></frame> + </frameset> + </html> + +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> + <head><title>List of all classes and objects</title> + <meta http-equiv="content-type" content="text/html; charset=UTF8"></meta><meta content="scaladoc" name="generator"></meta><link href="style.css" type="text/css" rel="stylesheet"></link><script type="text/javascript" src="script.js"></script> + </head> + <body onload="init()"><div><div class="kinds" id="Classes">Classes</div><ul class="list"> + <li id="Classes_C"><a href="examples/C0.html" target="contentFrame">C0</a></li> +<li><a href="examples/C0.C1_Public.html" target="contentFrame">C0.C1_Public</a></li> + </ul> +<div class="kinds" id="Objects">Objects</div><ul class="list"> + <li id="Objects_o"><a href="examples/obj0$object.html" target="contentFrame">obj0</a></li> +<li><a href="examples/obj0$object.obj1_Public$object.html" target="contentFrame">obj0.obj1_Public</a></li> + </ul></div></body> + </html> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> + <head><title>Scala 2</title> + <meta http-equiv="content-type" content="text/html; charset=UTF8"></meta><meta content="scaladoc" name="generator"></meta><link href="style.css" type="text/css" rel="stylesheet"></link><script type="text/javascript" src="script.js"></script> + </head> + <frameset cols="25%, 75%"> + <frameset rows="50%, 28, 50%"> + <frame src="modules.html" name="modulesFrame"></frame> + <frame src="nav-classes.html" name="navigationFrame"></frame> + <frame src="all-classes.html" name="classesFrame"></frame> + </frameset> + <frame src="root-content.html" name="contentFrame"></frame> + </frameset> + </html> + +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> + <head><title>List of all classes and objects</title> + <meta http-equiv="content-type" content="text/html; charset=UTF8"></meta><meta content="scaladoc" name="generator"></meta><link href="style.css" type="text/css" rel="stylesheet"></link><script type="text/javascript" src="script.js"></script> + </head> + <body onload="init()"><div><div class="kinds" id="Classes">Classes</div><ul class="list"> + <li id="Classes_C"><a href="examples/C0.html" target="contentFrame">C0</a></li> +<li><a href="examples/C0.C1_Protected.html" target="contentFrame">C0.C1_Protected</a></li> +<li><a href="examples/C0.C1_Public.html" target="contentFrame">C0.C1_Public</a></li> +<li><a href="examples/C0_Protected.html" target="contentFrame">C0_Protected</a></li> +<li><a href="examples/C0_Protected.C1_Protected.html" target="contentFrame">C0_Protected.C1_Protected</a></li> +<li><a href="examples/C0_Protected.C1_Public.html" target="contentFrame">C0_Protected.C1_Public</a></li> + </ul> +<div class="kinds" id="Objects">Objects</div><ul class="list"> + <li id="Objects_o"><a href="examples/obj0$object.html" target="contentFrame">obj0</a></li> +<li><a href="examples/obj0$object.obj1_Protected$object.html" target="contentFrame">obj0.obj1_Protected</a></li> +<li><a href="examples/obj0$object.obj1_Public$object.html" target="contentFrame">obj0.obj1_Public</a></li> +<li><a href="examples/obj0_Protected$object.html" target="contentFrame">obj0_Protected</a></li> +<li><a href="examples/obj0_Protected$object.obj1_Protected$object.html" target="contentFrame">obj0_Protected.obj1_Protected</a></li> +<li><a href="examples/obj0_Protected$object.obj1_Public$object.html" target="contentFrame">obj0_Protected.obj1_Public</a></li> + </ul></div></body> + </html> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> + <head><title>Scala 2</title> + <meta http-equiv="content-type" content="text/html; charset=UTF8"></meta><meta content="scaladoc" name="generator"></meta><link href="style.css" type="text/css" rel="stylesheet"></link><script type="text/javascript" src="script.js"></script> + </head> + <frameset cols="25%, 75%"> + <frameset rows="50%, 28, 50%"> + <frame src="modules.html" name="modulesFrame"></frame> + <frame src="nav-classes.html" name="navigationFrame"></frame> + <frame src="all-classes.html" name="classesFrame"></frame> + </frameset> + <frame src="root-content.html" name="contentFrame"></frame> + </frameset> + </html> + +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> + <head><title>List of all classes and objects</title> + <meta http-equiv="content-type" content="text/html; charset=UTF8"></meta><meta content="scaladoc" name="generator"></meta><link href="style.css" type="text/css" rel="stylesheet"></link><script type="text/javascript" src="script.js"></script> + </head> + <body onload="init()"><div><div class="kinds" id="Classes">Classes</div><ul class="list"> + <li id="Classes_C"><a href="examples/C0.html" target="contentFrame">C0</a></li> +<li><a href="examples/C0.C1_Private.html" target="contentFrame">C0.C1_Private</a></li> +<li><a href="examples/C0.C1_Protected.html" target="contentFrame">C0.C1_Protected</a></li> +<li><a href="examples/C0.C1_Public.html" target="contentFrame">C0.C1_Public</a></li> +<li><a href="examples/C0_Protected.html" target="contentFrame">C0_Protected</a></li> +<li><a href="examples/C0_Protected.C1_Private.html" target="contentFrame">C0_Protected.C1_Private</a></li> +<li><a href="examples/C0_Protected.C1_Protected.html" target="contentFrame">C0_Protected.C1_Protected</a></li> +<li><a href="examples/C0_Protected.C1_Public.html" target="contentFrame">C0_Protected.C1_Public</a></li> + </ul> +<div class="kinds" id="Objects">Objects</div><ul class="list"> + <li id="Objects_o"><a href="examples/obj0$object.html" target="contentFrame">obj0</a></li> +<li><a href="examples/obj0$object.obj1_Private$object.html" target="contentFrame">obj0.obj1_Private</a></li> +<li><a href="examples/obj0$object.obj1_Protected$object.html" target="contentFrame">obj0.obj1_Protected</a></li> +<li><a href="examples/obj0$object.obj1_Public$object.html" target="contentFrame">obj0.obj1_Public</a></li> +<li><a href="examples/obj0_Protected$object.html" target="contentFrame">obj0_Protected</a></li> +<li><a href="examples/obj0_Protected$object.obj1_Private$object.html" target="contentFrame">obj0_Protected.obj1_Private</a></li> +<li><a href="examples/obj0_Protected$object.obj1_Protected$object.html" target="contentFrame">obj0_Protected.obj1_Protected</a></li> +<li><a href="examples/obj0_Protected$object.obj1_Public$object.html" target="contentFrame">obj0_Protected.obj1_Public</a></li> + </ul></div></body> + </html> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> + <head><title>Scala 2</title> + <meta http-equiv="content-type" content="text/html; charset=UTF8"></meta><meta content="scaladoc" name="generator"></meta><link href="style.css" type="text/css" rel="stylesheet"></link><script type="text/javascript" src="script.js"></script> + </head> + <frameset cols="25%, 75%"> + <frameset rows="50%, 28, 50%"> + <frame src="modules.html" name="modulesFrame"></frame> + <frame src="nav-classes.html" name="navigationFrame"></frame> + <frame src="all-classes.html" name="classesFrame"></frame> + </frameset> + <frame src="root-content.html" name="contentFrame"></frame> + </frameset> + </html> + +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> + <head><title>List of all classes and objects</title> + <meta http-equiv="content-type" content="text/html; charset=UTF8"></meta><meta content="scaladoc" name="generator"></meta><link href="style.css" type="text/css" rel="stylesheet"></link><script type="text/javascript" src="script.js"></script> + </head> + <body onload="init()"><div><div class="kinds" id="Classes">Classes</div><ul class="list"> + <li id="Classes_B"><a href="annots/Bar.html" target="contentFrame">Bar</a></li> +<li><a href="annots/Bar1.html" target="contentFrame">Bar1</a></li> +<li><a href="annots/Bar2.html" target="contentFrame">Bar2</a></li> + </ul> +<div class="kinds" id="Objects">Objects</div><ul class="list"> + <li id="Objects_B"><a href="annots/Bar1.Foo11$object.html" target="contentFrame">Bar1.Foo11</a></li> +<li id="Objects_F"><a href="annots/Foo$object.html" target="contentFrame">Foo</a></li> +<li><a href="annots/Foo1$object.html" target="contentFrame">Foo1</a></li> +<li><a href="annots/Foo1$object.Foo11$object.html" target="contentFrame">Foo1.Foo11</a></li> +<li><a href="annots/Foo2$object.html" target="contentFrame">Foo2</a></li> + </ul></div></body> + </html> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> + <head><title>Scala 2</title> + <meta http-equiv="content-type" content="text/html; charset=UTF8"></meta><meta content="scaladoc" name="generator"></meta><link href="style.css" type="text/css" rel="stylesheet"></link><script type="text/javascript" src="script.js"></script> + </head> + <frameset cols="25%, 75%"> + <frameset rows="50%, 28, 50%"> + <frame src="modules.html" name="modulesFrame"></frame> + <frame src="nav-classes.html" name="navigationFrame"></frame> + <frame src="all-classes.html" name="classesFrame"></frame> + </frameset> + <frame src="root-content.html" name="contentFrame"></frame> + </frameset> + </html> + diff --git a/test/disabled/run/docgenerator.scala b/test/disabled/run/docgenerator.scala new file mode 100644 index 0000000000..59f90ba415 --- /dev/null +++ b/test/disabled/run/docgenerator.scala @@ -0,0 +1,295 @@ +object Test { + import java.io.{File, FileReader, FileWriter} + + /** Tests the generation of the HTML documentation for some Scala + * code samples (see value 'code' below) with different scaladoc + * options (currently -access:<value>). + * + * @author Stephane Micheloud + */ + def main(args: Array[String]) { + // overwrites value of UrlContext.generator in file DocUtil.scala + System.setProperty("doc.generator", "scaladoc") + var dirname = System.getProperty("scalatest.output") + if (dirname eq null) dirname = System.getProperty("java.io.tmpdir") + val tmpDir = new File(dirname) + tmpDir.mkdirs() + test1(tmpDir) + test2(tmpDir) + } + + private def test1(tmpDir: File) { + def testOptions(inFile: File, outDirName: String, opts: String*) { + val outDir = createDir(tmpDir, outDirName) + val args = Array.concat(Array("-d", outDir.getPath, inFile.getPath), opts.toArray:Array[String]) + if (MainDoc.main0(args)) { + for (name <- List("all-classes.html", "index.html")) { + val outFile = new File(outDir, name) + val n = outFile.length.toInt + val in = new FileReader(outFile) + val cbuf = new Array[Char](n) + in.read(cbuf, 0, n) + println(new String(cbuf)) + } + println + } + } + val inFile = { + val f = new File(tmpDir.getPath, "docgenerator1.scala") + val writer = new FileWriter(f) + writer.write(code1, 0, code1.length) + writer.close + f + } + testOptions(inFile, "test1", "") // none (default is -access:protected) + testOptions(inFile, "test2", "-access:public") + testOptions(inFile, "test3", "-access:protected") + testOptions(inFile, "test4", "-access:private") + } + + private def test2(tmpDir: File) { + val code =""" +package annots + +@deprecated("msg") +object Foo { val x = 0 } + +@deprecated("msg") +class Bar { val x = 1 } + +object Foo1 { + @deprecated("msg") + object Foo11 { val x = 3 } +} + +class Bar1 { + @deprecated("msg") + object Foo11 { val x = 2 } +} + +class Bar2 { + def bar { + @deprecated("msg") + object Foo21 { val x = 4 } + () + } +} + +object Foo2 { + def foo { + @deprecated("msg") + object Foo21 { val x = 5 } + () + } +} +""" + val inFile = { + val f = new File(tmpDir.getPath, "docgenerator2.scala") + val writer = new FileWriter(f) + writer.write(code, 0, code.length) + writer.close + f + } + val outDir = createDir(tmpDir, "annots1") + val args = Array.concat(Array("-d", outDir.getPath, inFile.getPath)) + if (MainDoc.main0(args)) { + for (name <- List("all-classes.html", "index.html")) { + val outFile = new File(outDir, name) + val n = outFile.length.toInt + val in = new FileReader(outFile) + val cbuf = new Array[Char](n) + in.read(cbuf, 0, n) + println(new String(cbuf)) + } + println + } + } + + object MainDoc { + import scala.tools.nsc._ + import scala.tools.nsc.doc.DefaultDocDriver + import scala.tools.nsc.reporters.ConsoleReporter + def error(msg: String) { Console.err.println(msg) } + var reporter: ConsoleReporter = _ + def process(args: Array[String]) { + val docSettings = new scala.tools.nsc.doc.Settings(error) + // when running that compiler, give it a scala-library to the classpath + docSettings.classpath.value = System.getProperty("java.class.path") + reporter = new ConsoleReporter(docSettings) + val command = new CompilerCommand(args.toList, docSettings, error, false) + try { + object compiler extends Global(command.settings, reporter) { + override protected def computeInternalPhases() : Unit = { + phasesSet += syntaxAnalyzer + phasesSet += analyzer.namerFactory + phasesSet += analyzer.typerFactory + } + override def onlyPresentation = true + } + if (reporter.hasErrors) { + reporter.flush() + return + } + val run = new compiler.Run + run compile command.files + object generator extends DefaultDocDriver { + lazy val global: compiler.type = compiler + lazy val settings = docSettings + } + generator process run.units + reporter.printSummary() + } catch { + case ex @ FatalError(msg) => + if (command.settings.debug.value) + ex.printStackTrace(); + reporter.error(null, "fatal error: " + msg) + } + } + def main(args: Array[String]) { + process(args) + exit(if (reporter.hasErrors) 1 else 0) + } + // main returning a status (no exit code) + def main0(args: Array[String]): Boolean = { + process(args) + !reporter.hasErrors + } + } + + private def createDir(parent: File, dirname: String): File = { + val outDir = new File(parent, dirname) + outDir.mkdir + outDir + } + + private val code1 = """ +package examples + +abstract class C0 { + def foo_public + protected def foo_protected + private def foo_private {} + class C1_Public { + val x_public = () + protected val x_protected = () + private val x_private = () + } + protected class C1_Protected { + val x_public = () + protected val x_protected = () + private val x_private = () + } + private class C1_Private { + val x_public = () + protected val x_protected = () + private val x_private = () + } +} + +protected abstract class C0_Protected { + def foo_public + protected def foo_protected + private def foo_private {} + class C1_Public { + val x_public = () + protected val x_protected = () + private val x_private = () + } + protected class C1_Protected { + val x_public = () + protected val x_protected = () + private val x_private = () + } + private class C1_Private { + val x_public = () + protected val x_protected = () + private val x_private = () + } +} + +private abstract class C0_Private { + def foo_public + protected def foo_protected + private def foo_private {} + class C1_Public { + val x_public = () + protected val x_protected = () + private val x_private = () + } + protected class C1_Protected { + val x_public = () + protected val x_protected = () + private val x_private = () + } + private class C1_Private { + val x_public = () + protected val x_protected = () + private val x_private = () + } +} + + +object obj0 { + def bar_public {} + protected def bar_protected {} + private def bar_private {} + object obj1_Public { + val x_public = () + protected val x_protected = () + private val x_private = () + } + protected object obj1_Protected { + val x_public = () + protected val x_protected = () + private val x_private = () + } + private object obj1_Private { + val x_public = () + protected val x_protected = () + private val x_private = () + } +} + +protected object obj0_Protected { + def bar_public {} + protected def bar_protected {} + private def bar_private {} + object obj1_Public { + val x_public = () + protected val x_protected = () + private val x_private = () + } + protected object obj1_Protected { + val x_public = () + protected val x_protected = () + private val x_private = () + } + private object obj1_Private { + val x_public = () + protected val x_protected = () + private val x_private = () + } +} + +private object obj0_Private { + def bar_public {} + protected def bar_protected {} + private def bar_private {} + object obj1_Public { + val x_public = () + protected val x_protected = () + private val x_private = () + } + protected object obj1_Protected { + val x_public = () + protected val x_protected = () + private val x_private = () + } + private object obj1_Private { + val x_public = () + protected val x_protected = () + private val x_private = () + } +} +""" +} |