summaryrefslogtreecommitdiff
path: root/test/files/run/docgenerator.scala
diff options
context:
space:
mode:
authormichelou <michelou@epfl.ch>2008-02-14 19:12:33 +0000
committermichelou <michelou@epfl.ch>2008-02-14 19:12:33 +0000
commit1aad4cb6517f4c63968d11c29f8dfebd8232a49c (patch)
treed2e24081069dba144185230f85bf7ef12c433531 /test/files/run/docgenerator.scala
parent92f5905cc65a8eb94aa05a8f95ef1f173c796612 (diff)
downloadscala-1aad4cb6517f4c63968d11c29f8dfebd8232a49c.tar.gz
scala-1aad4cb6517f4c63968d11c29f8dfebd8232a49c.tar.bz2
scala-1aad4cb6517f4c63968d11c29f8dfebd8232a49c.zip
removed MD5 test
Diffstat (limited to 'test/files/run/docgenerator.scala')
-rw-r--r--test/files/run/docgenerator.scala61
1 files changed, 19 insertions, 42 deletions
diff --git a/test/files/run/docgenerator.scala b/test/files/run/docgenerator.scala
index ea44db06fe..db214b2c4d 100644
--- a/test/files/run/docgenerator.scala
+++ b/test/files/run/docgenerator.scala
@@ -1,5 +1,5 @@
object Test {
- import java.io.{File, FileWriter}
+ 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
@@ -19,12 +19,17 @@ object Test {
}
private def test1(tmpDir: File) {
- def testOptions(inFile: File, outDir: File, opts: String*) {
+ def testOptions(inFile: File, outDirName: String, opts: String*) {
+ val outDir = createDir(tmpDir, outDirName)
val args = Array.concat(Array("-Ydoc", "-d", outDir.getPath, inFile.getPath), opts.toArray:Array[String])
if (MainDoc.main0(args)) {
for (name <- List("all-classes.html", "index.html")) {
- val f = new File(outDir, name)
- println(name + ": " + generateMD5Sum(f))
+ 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
}
@@ -36,10 +41,10 @@ object Test {
writer.close
f
}
- testOptions(inFile, createDir(tmpDir, "test1"), "") // none (default is -access:protected)
- testOptions(inFile, createDir(tmpDir, "test2"), "-access:public")
- testOptions(inFile, createDir(tmpDir, "test3"), "-access:protected")
- testOptions(inFile, createDir(tmpDir, "test4"), "-access:private")
+ 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) {
@@ -89,8 +94,12 @@ object Foo2 {
val args = Array.concat(Array("-Ydoc", "-d", outDir.getPath, inFile.getPath))
if (MainDoc.main0(args)) {
for (name <- List("all-classes.html", "index.html")) {
- val f = new File(outDir, name)
- println(name + ": " + generateMD5Sum(f))
+ 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
}
@@ -144,38 +153,6 @@ object Foo2 {
outDir
}
- private def generateMD5Sum(f: java.io.File): String = {
- import java.io._, java.security._
- val digest = MessageDigest.getInstance("MD5")
- val is = new FileInputStream(f)
- val buffer = new Array[Byte](8192)
- try {
- var read = is.read(buffer)
- while (read > 0) {
- digest.update(buffer, 0, read)
- read = is.read(buffer)
- }
- val hash = digest.digest()
- val buf = new StringBuilder
- for (i <- hash.indices)
- buf.append((hash(i) & 0xFF).toHexString)
- buf.toString
- }
- catch {
- case e: IOException =>
- throw new RuntimeException("Unable to process file for MD5", e)
- }
- finally {
- try {
- is.close();
- }
- catch {
- case e: IOException =>
- throw new RuntimeException("Unable to close input stream for MD5 calculation", e)
- }
- }
- }
-
private val code1 = """
package examples