From a46f483678190be6706d55ed05175d7bf9f1e806 Mon Sep 17 00:00:00 2001 From: cheeseng Date: Tue, 26 Nov 2013 15:15:44 +0800 Subject: [PATCH 1/5] Removed shapelessTables.scala. --- cleanem.sh | 2 +- runem.sh | 1 - shapelessTables.scala | 351 ------------------------------------------ 3 files changed, 1 insertion(+), 353 deletions(-) delete mode 100644 shapelessTables.scala diff --git a/cleanem.sh b/cleanem.sh index cfe754e..74840bf 100755 --- a/cleanem.sh +++ b/cleanem.sh @@ -1,2 +1,2 @@ -rm -rf allMethodTestsInOneFile allTestsInOneFile assertTestsInOneFile dataTables tenTestsPerFile testsIn100Files allClassTestsInOneFile scalautilsScalaz shapelessTables +rm -rf allMethodTestsInOneFile allTestsInOneFile assertTestsInOneFile dataTables tenTestsPerFile testsIn100Files allClassTestsInOneFile scalautilsScalaz diff --git a/runem.sh b/runem.sh index e15c1cd..d210965 100644 --- a/runem.sh +++ b/runem.sh @@ -11,5 +11,4 @@ scala allMethodTestsInOneFile.scala scala assertTestsInOneFile.scala scala allClassTestsInOneFile.scala scala scalautilsScalaz.scala -scala shapelessTables.scala scala google-chart.scala diff --git a/shapelessTables.scala b/shapelessTables.scala deleted file mode 100644 index bd761d1..0000000 --- a/shapelessTables.scala +++ /dev/null @@ -1,351 +0,0 @@ -import java.net._ -import java.io._ -import java.nio.channels.Channels -import scala.annotation.tailrec - -def scalaVersion = "2.10" -val scalaTestVersion = "2.0" - -def downloadFile(urlString: String, targetFile: File) { - println("Downloading " + urlString) - val url = new URL(urlString) - val connection = url.openConnection - val in = connection.getInputStream - val out = new FileOutputStream(targetFile) - out getChannel() transferFrom(Channels.newChannel(in), 0, Long.MaxValue) - in.close() - out.flush() - out.close() -} - -sealed trait Align -object Left extends Align -object Right extends Align - -def padValue(value: String, columnWidth:Int, align: Align): String = { - val padCount = columnWidth - value.length - require(padCount >= 0) - align match { - case Left => - value + (" " * padCount) - case Right => - (" " * padCount) + value - } -} - -val leftColHeader = "\"left\"" -val rightColHeader = "\"right\"" -val sumColHeader = "\"sum\"" - -def generateScalaTestSourceFile(testCount: Int, targetDir: File): File = { - targetDir.mkdirs() - val targetFile = new File(targetDir, "ExampleSpec.scala") - val targetOut = new BufferedWriter(new FileWriter(targetFile)) - - val leftColValueWidth = testCount.toString.length - val sumColValueWidth = (testCount + 1).toString.length - val leftColWidth = List(leftColValueWidth, leftColHeader.length).max - val rightColWidth = rightColHeader.length - val sumColWidth = List(sumColValueWidth, sumColHeader.length).max - - try { - targetOut.write("package scalatest\n\n") - - targetOut.write("import org.scalatest._\n") - targetOut.write("import prop.TableDrivenPropertyChecks._\n\n") - - targetOut.write("class ExampleSpec extends WordSpec with Matchers {\n\n") - - targetOut.write(" \"Scala\" can {\n") - targetOut.write(" \"increment integers\" in {\n\n") - - targetOut.write(" val examples = \n") - targetOut.write(" Table(\n") - - // print headers - targetOut.write(" (" + padValue(leftColHeader, leftColWidth, Left) + ", " + padValue(rightColHeader, rightColWidth, Left) + ", " + padValue(sumColHeader, sumColWidth, Left) + ")" + (if (testCount > 0) ", \n" else "\n")) - // print data rows - for (x <- 1 to testCount) { - targetOut.write(" (" + padValue(x.toString, leftColWidth, Right) + ", " + padValue("1", rightColWidth, Right) + ", " + padValue((x + 1).toString, sumColWidth, Right) + ")" + (if (x < testCount) ", \n" else "\n")) - } - targetOut.write(" )\n\n") - - targetOut.write(" }\n") - targetOut.write(" }\n") - targetOut.write("}\n") - } - finally { - targetOut.flush() - targetOut.close() - } - targetFile -} - -def generateShapelessSourceFile(testCount: Int, targetDir: File): File = { - targetDir.mkdirs() - val targetFile = new File(targetDir, "ExampleSpec.scala") - val targetOut = new BufferedWriter(new FileWriter(targetFile)) - - val leftColValueWidth = testCount.toString.length - val sumColValueWidth = (testCount + 1).toString.length - val leftColWidth = List(leftColValueWidth, leftColHeader.length).max - val rightColWidth = rightColHeader.length - val sumColWidth = List(sumColValueWidth, sumColHeader.length).max - - try { - targetOut.write("package shapelessTables\n\n") - - targetOut.write("import org.scalatest._\n") - targetOut.write("import shapelessTable._\n\n") - - targetOut.write("class ExampleSpec extends WordSpec with Matchers {\n\n") - - targetOut.write(" \"Scala\" can {\n") - targetOut.write(" \"increment integers\" in {\n\n") - - targetOut.write(" val examples = \n") - targetOut.write(" Table(\n") - - // print headers - targetOut.write(" (" + padValue(leftColHeader, leftColWidth, Left) + ", " + padValue(rightColHeader, rightColWidth, Left) + ", " + padValue(sumColHeader, sumColWidth, Left) + ")" + (if (testCount > 0) ", \n" else "\n")) - // print data rows - for (x <- 1 to testCount) { - targetOut.write(" (" + padValue(x.toString, leftColWidth, Right) + ", " + padValue("1", rightColWidth, Right) + ", " + padValue((x + 1).toString, sumColWidth, Right) + ")" + (if (x < testCount) ", \n" else "\n")) - } - targetOut.write(" )\n\n") - - targetOut.write(" }\n") - targetOut.write(" }\n") - targetOut.write("}\n") - } - finally { - targetOut.flush() - targetOut.close() - } - targetFile -} - -def compile(srcFile: String, classpath: String, targetDir: String) = { - import scala.collection.JavaConversions._ - - val command = List("scalac", "-classpath", classpath, "-d", targetDir, srcFile) - val builder = new ProcessBuilder(command) - builder.redirectErrorStream(true) - val start = System.currentTimeMillis - val process = builder.start() - - val stdout = new BufferedReader(new InputStreamReader(process.getInputStream)) - - var line = "Compiling " + srcFile + "..." - while (line != null) { - println (line) - line = stdout.readLine - } - - val end = System.currentTimeMillis - end - start -} - -def jar(jarFileName: String, classesDir: String) = { - import scala.collection.JavaConversions._ - - val command = List("jar", "cf", jarFileName, "-C", classesDir, ".") - val builder = new ProcessBuilder(command) - builder.redirectErrorStream(true) - val start = System.currentTimeMillis - val process = builder.start() - - val stdout = new BufferedReader(new InputStreamReader(process.getInputStream)) - - var line = "Creating jar file " + jarFileName + "..." - while (line != null) { - println (line) - line = stdout.readLine - } - - val end = System.currentTimeMillis - end - start -} - -def getFileAndByteCount(srcDir: File) = { - @tailrec - def getFileAndByteCountAcc(dirList: Array[File], fileCount: Long, byteCount: Long): Tuple2[Long, Long] = { - val (files, subDirs) = dirList.partition(_.isFile) - val classFiles = files.filter(f => f.getName.endsWith(".class")) - val newFileCount = fileCount + classFiles.size - val newByteCount = byteCount + classFiles.map { f => f.length.toLong }.foldLeft(0l) { (a, b) => a + b } - if (subDirs.isEmpty) - (newFileCount, newByteCount) - else - getFileAndByteCountAcc(subDirs.flatMap(d => d.listFiles), newFileCount, newByteCount) - } - getFileAndByteCountAcc(srcDir.listFiles, 0l, 0l) -} - -def deleteDir(targetDir: File) { - val children = targetDir.listFiles - if (children != null) { - targetDir.listFiles.foreach { child => - if (child.isFile) - child.delete() - else - deleteDir(child) - } - targetDir.delete() - } - else - println("Unable to list files in " + targetDir.getAbsolutePath) -} - -def getOutputDir(baseOutputDir: File, testCount: Int): File = { - val outputDirName = "output-" + testCount - val outputDir = new File(baseOutputDir, outputDirName) - outputDir.mkdirs() - outputDir -} - -val scalatestJar = new File("scalatest_" + scalaVersion + "-" + scalaTestVersion + ".jar") -if (!scalatestJar.exists) - downloadFile("https://oss.sonatype.org/content/repositories/releases/org/scalatest/scalatest_" + scalaVersion + "/" + scalaTestVersion + "/scalatest_" + scalaVersion + "-" + scalaTestVersion + ".jar", scalatestJar) - -val shapelessJar = new File("shapeless_2.10.2-2.0.0-SNAPSHOT.jar") -if (!shapelessJar.exists) - downloadFile("http://oss.sonatype.org/content/repositories/snapshots/com/chuusai/shapeless_2.10.2/2.0.0-SNAPSHOT/shapeless_2.10.2-2.0.0-SNAPSHOT.jar", shapelessJar) - -val baseDir = new File("shapelessTables") -if (baseDir.exists) - deleteDir(baseDir) - -baseDir.mkdirs() - -val shapelessTableJar = new File("shapeless-table.jar") -if (!shapelessTableJar.exists) { - val shapelessTableSource = new File("ShapelessTable.scala") - val shapelessTableClassDir = new File(baseDir, "shapeless-table") - shapelessTableClassDir.mkdirs() - compile(shapelessTableSource.getAbsolutePath, shapelessJar.getName, shapelessTableClassDir.getAbsolutePath) - jar(shapelessTableJar.getName, shapelessTableClassDir.getAbsolutePath) -} - -val statDir = new File(baseDir, "stat") -statDir.mkdirs() - -val durationFile = new FileWriter(new File(statDir, "duration.csv")) -val fileCountFile = new FileWriter(new File(statDir, "filecount.csv")) -val fileSizeFile = new FileWriter(new File(statDir, "filesize.csv")) - -val scalaTestClasspath = scalatestJar.getName - -val shapelessClasspath = scalatestJar.getName + File.pathSeparator + shapelessJar.getName + File.pathSeparator + shapelessTableJar.getName - -val baseOutputDir = new File(baseDir, "output") -baseOutputDir.mkdirs() - -val baseGeneratedDir = new File(baseDir, "generated") -baseGeneratedDir.mkdirs() - -val testCounts = - Array( - 10, - 20, - 30, - 40, - 50, - 60, - 70, - 80, - 90, - 100, - 200, - 300, - 400, - 500, - 600, - 700, - 800, - 900, - 1000 - ) - -val headers = "TestCount," + testCounts.mkString(",") + "\n" -durationFile.write(headers) -fileCountFile.write(headers) -fileSizeFile.write(headers) - -// ScalaTest Table -durationFile.write("scalatest") -durationFile.flush() -fileCountFile.write("scalatest") -fileCountFile.flush() -fileSizeFile.write("scalatest") -fileSizeFile.flush() - -try { - testCounts.foreach { testCount => - println("Working on ScalaTest test count " + testCount + "...") - val outputDir = getOutputDir(baseOutputDir, testCount) - val generatedDir = new File(baseGeneratedDir, "generated-" + testCount) - - val generatedSrc = generateScalaTestSourceFile(testCount, new File(generatedDir, "scalatest")) - val duration = compile(generatedSrc.getAbsolutePath, scalaTestClasspath, outputDir.getAbsolutePath) - durationFile.write("," + duration) - durationFile.flush() - - val (fileCount, fileSize) = getFileAndByteCount(new File(outputDir, "scalatest")) - fileCountFile.write("," + fileCount) - fileCountFile.flush() - fileSizeFile.write("," + fileSize) - fileSizeFile.flush() - } -} -catch { - case e: Throwable => - e.printStackTrace() -} -finally { - durationFile.write("\n") - durationFile.flush() - fileCountFile.write("\n") - fileCountFile.flush() - fileSizeFile.write("\n") - fileSizeFile.flush() -} - -// Shapeless Table -durationFile.write("shapeless") -durationFile.flush() -fileCountFile.write("shapeless") -fileCountFile.flush() -fileSizeFile.write("shapeless") -fileSizeFile.flush() - -try { - testCounts.foreach { testCount => - println("Working on Shapeless test count " + testCount + "...") - val outputDir = getOutputDir(baseOutputDir, testCount) - val generatedDir = new File(baseGeneratedDir, "generated-" + testCount) - - val generatedSrc = generateShapelessSourceFile(testCount, new File(generatedDir, "shapelessTables")) - val duration = compile(generatedSrc.getAbsolutePath, shapelessClasspath, outputDir.getAbsolutePath) - durationFile.write("," + duration) - durationFile.flush() - - val (fileCount, fileSize) = getFileAndByteCount(new File(outputDir, "shapelessTables")) - fileCountFile.write("," + fileCount) - fileCountFile.flush() - fileSizeFile.write("," + fileSize) - fileSizeFile.flush() - } -} -catch { - case e: Throwable => - e.printStackTrace() -} -finally { - durationFile.write("\n") - durationFile.flush() - fileCountFile.write("\n") - fileCountFile.flush() - fileSizeFile.write("\n") - fileSizeFile.flush() -} \ No newline at end of file From 8eeb3f7d7b83e5c060caf8ae5992086a7c26c5af Mon Sep 17 00:00:00 2001 From: cheeseng Date: Tue, 26 Nov 2013 15:16:40 +0800 Subject: [PATCH 2/5] Commentted out allClassTestsInOneFile.scala from runem.sh and cleanem.sh. --- cleanem.sh | 2 +- runem.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cleanem.sh b/cleanem.sh index 74840bf..8f94ab5 100755 --- a/cleanem.sh +++ b/cleanem.sh @@ -1,2 +1,2 @@ -rm -rf allMethodTestsInOneFile allTestsInOneFile assertTestsInOneFile dataTables tenTestsPerFile testsIn100Files allClassTestsInOneFile scalautilsScalaz +rm -rf allMethodTestsInOneFile allTestsInOneFile assertTestsInOneFile dataTables tenTestsPerFile testsIn100Files scalautilsScalaz #allClassTestsInOneFile diff --git a/runem.sh b/runem.sh index d210965..83f2243 100644 --- a/runem.sh +++ b/runem.sh @@ -9,6 +9,6 @@ scala testsIn100Files.scala scala dataTables.scala scala allMethodTestsInOneFile.scala scala assertTestsInOneFile.scala -scala allClassTestsInOneFile.scala +//scala allClassTestsInOneFile.scala scala scalautilsScalaz.scala scala google-chart.scala From c13b26c4c0640141f2b39fb220c97e5a92decc17 Mon Sep 17 00:00:00 2001 From: cheeseng Date: Tue, 26 Nov 2013 16:04:19 +0800 Subject: [PATCH 3/5] Reorder shapeless table and specs2 table in dataTables. --- dataTables.scala | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/dataTables.scala b/dataTables.scala index d8a6baf..e2dd7c1 100644 --- a/dataTables.scala +++ b/dataTables.scala @@ -381,25 +381,26 @@ if (scalaVersion != "unknown") { fileSizeFile.flush() } - // Specs2 mutable - durationFile.write("specs2.mutable.Specification") + // Shapeless Table + durationFile.write("shapeless") durationFile.flush() - fileCountFile.write("specs2.mutable.Specification") + fileCountFile.write("shapeless") fileCountFile.flush() - fileSizeFile.write("specs2.mutable.Specification") + fileSizeFile.write("shapeless") fileSizeFile.flush() + try { testCounts.foreach { testCount => - println("Working on specs2.mutable.Specification test count " + testCount + "...") + println("Working on Shapeless test count " + testCount + "...") val outputDir = getOutputDir(baseOutputDir, testCount) val generatedDir = new File(baseGeneratedDir, "generated-" + testCount) - val generatedSrc = generateSpecs2Mutable(testCount, new File(generatedDir, "mSpecification")) - val duration = compile(generatedSrc.getAbsolutePath, specs2Classpath, outputDir.getAbsolutePath) + val generatedSrc = generateShapelessSourceFile(testCount, new File(generatedDir, "shapelessTables")) + val duration = compile(generatedSrc.getAbsolutePath, shapelessClasspath, outputDir.getAbsolutePath) durationFile.write("," + duration) durationFile.flush() - val (fileCount, fileSize) = getFileAndByteCount(new File(outputDir, "mSpecification")) + val (fileCount, fileSize) = getFileAndByteCount(new File(outputDir, "shapelessTables")) fileCountFile.write("," + fileCount) fileCountFile.flush() fileSizeFile.write("," + fileSize) @@ -407,7 +408,7 @@ if (scalaVersion != "unknown") { } } catch { - case e: Throwable => + case e: Throwable => e.printStackTrace() } finally { @@ -419,26 +420,25 @@ if (scalaVersion != "unknown") { fileSizeFile.flush() } - // Shapeless Table - durationFile.write("shapeless") + // Specs2 mutable + durationFile.write("specs2.mutable.Specification") durationFile.flush() - fileCountFile.write("shapeless") + fileCountFile.write("specs2.mutable.Specification") fileCountFile.flush() - fileSizeFile.write("shapeless") + fileSizeFile.write("specs2.mutable.Specification") fileSizeFile.flush() - try { testCounts.foreach { testCount => - println("Working on Shapeless test count " + testCount + "...") + println("Working on specs2.mutable.Specification test count " + testCount + "...") val outputDir = getOutputDir(baseOutputDir, testCount) val generatedDir = new File(baseGeneratedDir, "generated-" + testCount) - val generatedSrc = generateShapelessSourceFile(testCount, new File(generatedDir, "shapelessTables")) - val duration = compile(generatedSrc.getAbsolutePath, shapelessClasspath, outputDir.getAbsolutePath) + val generatedSrc = generateSpecs2Mutable(testCount, new File(generatedDir, "mSpecification")) + val duration = compile(generatedSrc.getAbsolutePath, specs2Classpath, outputDir.getAbsolutePath) durationFile.write("," + duration) durationFile.flush() - val (fileCount, fileSize) = getFileAndByteCount(new File(outputDir, "shapelessTables")) + val (fileCount, fileSize) = getFileAndByteCount(new File(outputDir, "mSpecification")) fileCountFile.write("," + fileCount) fileCountFile.flush() fileSizeFile.write("," + fileSize) @@ -446,7 +446,7 @@ if (scalaVersion != "unknown") { } } catch { - case e: Throwable => + case e: Throwable => e.printStackTrace() } finally { From 54ca949070783db93bf282e0afa06fb7ea6a083b Mon Sep 17 00:00:00 2001 From: cheeseng Date: Tue, 26 Nov 2013 17:07:44 +0800 Subject: [PATCH 4/5] Refactored dataTables.scala to use UnitSpec. --- dataTables.scala | 25 +++++++++++++++++-------- scalatest-class.scala | 3 +++ 2 files changed, 20 insertions(+), 8 deletions(-) create mode 100644 scalatest-class.scala diff --git a/dataTables.scala b/dataTables.scala index e2dd7c1..df7be13 100644 --- a/dataTables.scala +++ b/dataTables.scala @@ -59,12 +59,12 @@ def generateSourceFile(testCount: Int, targetDir: File): File = { val targetOut = new BufferedWriter(new FileWriter(targetFile)) try { - targetOut.write("package WordSpecMust\n\n") + targetOut.write("package WordSpec\n\n") targetOut.write("import org.scalatest._\n") targetOut.write("import prop.TableDrivenPropertyChecks._\n\n") - targetOut.write("class ExampleSpec extends WordSpec with Matchers {\n\n") + targetOut.write("class ExampleSpec extends UnitSpec {\n\n") targetOut.write(" \"Scala\" can {\n") targetOut.write(" \"increment integers\" in {\n\n") @@ -111,7 +111,7 @@ def generateShapelessSourceFile(testCount: Int, targetDir: File): File = { targetOut.write("import shapeless.TableChecker._\n") targetOut.write("import shapelessTable._\n\n") - targetOut.write("class ExampleSpec extends WordSpec with Matchers {\n\n") + targetOut.write("class ExampleSpec extends UnitSpec {\n\n") targetOut.write(" \"Scala\" can {\n") targetOut.write(" \"increment integers\" in {\n\n") @@ -288,13 +288,22 @@ if (scalaVersion != "unknown") { deleteDir(baseDir) val shapelessTableJar = new File("shapeless-table.jar") - if (!shapelessTableJar.exists) { + if (!shapelessTableJar.exists || shapelessTableJar.lastModified < new File("ShapelessTable.scala").lastModified) { val shapelessTableSource = new File("ShapelessTable.scala") val shapelessTableClassDir = new File(baseDir, "shapeless-table") shapelessTableClassDir.mkdirs() compile(shapelessTableSource.getAbsolutePath, shapelessJar.getName, shapelessTableClassDir.getAbsolutePath) jar(shapelessTableJar.getName, shapelessTableClassDir.getAbsolutePath) } + + val scalatestClassJar = new File("scalatest-class.jar") + if (!scalatestClassJar.exists || scalatestClassJar.lastModified < new File("scalatest-class.scala").lastModified) { + val scalatestClassSource = new File("scalatest-class.scala") + val scalatestClassDir = new File(baseDir, "scalatest-class") + scalatestClassDir.mkdirs() + compile(scalatestClassSource.getAbsolutePath, scalatestJar.getName, scalatestClassDir.getAbsolutePath) + jar(scalatestClassJar.getName, scalatestClassDir.getAbsolutePath) + } val statDir = new File(baseDir, "stat") statDir.mkdirs() @@ -303,11 +312,11 @@ if (scalaVersion != "unknown") { val fileCountFile = new FileWriter(new File(statDir, "filecount.csv")) val fileSizeFile = new FileWriter(new File(statDir, "filesize.csv")) - val scalaTestClasspath = scalatestJar.getName + val scalaTestClasspath = scalatestJar.getName + File.pathSeparator + scalatestClassJar.getName val specs2Classpath = specs2Jar.getName + File.pathSeparator + specs2ScalazJar.getName - val shapelessClasspath = scalatestJar.getName + File.pathSeparator + shapelessJar.getName + File.pathSeparator + shapelessTableJar.getName + val shapelessClasspath = scalaTestClasspath + File.pathSeparator + shapelessJar.getName + File.pathSeparator + shapelessTableJar.getName val baseOutputDir = new File(baseDir, "output") baseOutputDir.mkdirs() @@ -356,12 +365,12 @@ if (scalaVersion != "unknown") { val outputDir = getOutputDir(baseOutputDir, testCount) val generatedDir = new File(baseGeneratedDir, "generated-" + testCount) - val generatedSrc = generateSourceFile(testCount, new File(generatedDir, "WordSpecMust")) + val generatedSrc = generateSourceFile(testCount, new File(generatedDir, "WordSpec")) val duration = compile(generatedSrc.getAbsolutePath, scalaTestClasspath, outputDir.getAbsolutePath) durationFile.write("," + duration) durationFile.flush() - val (fileCount, fileSize) = getFileAndByteCount(new File(outputDir, "WordSpecMust")) + val (fileCount, fileSize) = getFileAndByteCount(new File(outputDir, "WordSpec")) fileCountFile.write("," + fileCount) fileCountFile.flush() fileSizeFile.write("," + fileSize) diff --git a/scalatest-class.scala b/scalatest-class.scala new file mode 100644 index 0000000..09823c0 --- /dev/null +++ b/scalatest-class.scala @@ -0,0 +1,3 @@ +package org.scalatest + +class UnitSpec extends WordSpec with Matchers \ No newline at end of file From 6c900f4198fa261a312110d27ed1f453b6ef943d Mon Sep 17 00:00:00 2001 From: cheeseng Date: Wed, 27 Nov 2013 10:51:53 +0800 Subject: [PATCH 5/5] Use import Matchers._ instead in dataTables.scala, removed the scaslatest-class.scala which is no longer required. --- dataTables.scala | 17 +++++------------ scalatest-class.scala | 3 --- 2 files changed, 5 insertions(+), 15 deletions(-) delete mode 100644 scalatest-class.scala diff --git a/dataTables.scala b/dataTables.scala index df7be13..08d45ed 100644 --- a/dataTables.scala +++ b/dataTables.scala @@ -62,9 +62,10 @@ def generateSourceFile(testCount: Int, targetDir: File): File = { targetOut.write("package WordSpec\n\n") targetOut.write("import org.scalatest._\n") + targetOut.write("import Matchers._\n") targetOut.write("import prop.TableDrivenPropertyChecks._\n\n") - targetOut.write("class ExampleSpec extends UnitSpec {\n\n") + targetOut.write("class ExampleSpec extends WordSpec {\n\n") targetOut.write(" \"Scala\" can {\n") targetOut.write(" \"increment integers\" in {\n\n") @@ -108,10 +109,11 @@ def generateShapelessSourceFile(testCount: Int, targetDir: File): File = { targetOut.write("package shapelessTables\n\n") targetOut.write("import org.scalatest._\n") + targetOut.write("import Matchers._\n") targetOut.write("import shapeless.TableChecker._\n") targetOut.write("import shapelessTable._\n\n") - targetOut.write("class ExampleSpec extends UnitSpec {\n\n") + targetOut.write("class ExampleSpec extends WordSpec {\n\n") targetOut.write(" \"Scala\" can {\n") targetOut.write(" \"increment integers\" in {\n\n") @@ -295,15 +297,6 @@ if (scalaVersion != "unknown") { compile(shapelessTableSource.getAbsolutePath, shapelessJar.getName, shapelessTableClassDir.getAbsolutePath) jar(shapelessTableJar.getName, shapelessTableClassDir.getAbsolutePath) } - - val scalatestClassJar = new File("scalatest-class.jar") - if (!scalatestClassJar.exists || scalatestClassJar.lastModified < new File("scalatest-class.scala").lastModified) { - val scalatestClassSource = new File("scalatest-class.scala") - val scalatestClassDir = new File(baseDir, "scalatest-class") - scalatestClassDir.mkdirs() - compile(scalatestClassSource.getAbsolutePath, scalatestJar.getName, scalatestClassDir.getAbsolutePath) - jar(scalatestClassJar.getName, scalatestClassDir.getAbsolutePath) - } val statDir = new File(baseDir, "stat") statDir.mkdirs() @@ -312,7 +305,7 @@ if (scalaVersion != "unknown") { val fileCountFile = new FileWriter(new File(statDir, "filecount.csv")) val fileSizeFile = new FileWriter(new File(statDir, "filesize.csv")) - val scalaTestClasspath = scalatestJar.getName + File.pathSeparator + scalatestClassJar.getName + val scalaTestClasspath = scalatestJar.getName val specs2Classpath = specs2Jar.getName + File.pathSeparator + specs2ScalazJar.getName diff --git a/scalatest-class.scala b/scalatest-class.scala deleted file mode 100644 index 09823c0..0000000 --- a/scalatest-class.scala +++ /dev/null @@ -1,3 +0,0 @@ -package org.scalatest - -class UnitSpec extends WordSpec with Matchers \ No newline at end of file