From 1298e55866eabe182ccbb9f2c739199a4fa176b0 Mon Sep 17 00:00:00 2001 From: Etienne Kneuss <colder@php.net> Date: Mon, 2 Sep 2013 12:53:41 +0200 Subject: [PATCH] Remove TestUtils, don't look in innexistent directories --- src/test/scala/leon/test/LeonTestSuite.scala | 18 +++++++++++++ src/test/scala/leon/test/TestUtils.scala | 25 ------------------- .../synthesis/SynthesisRegressionSuite.scala | 14 +++++------ .../PureScalaVerificationRegression.scala | 2 -- .../XLangVerificationRegression.scala | 2 -- 5 files changed, 24 insertions(+), 37 deletions(-) delete mode 100644 src/test/scala/leon/test/TestUtils.scala diff --git a/src/test/scala/leon/test/LeonTestSuite.scala b/src/test/scala/leon/test/LeonTestSuite.scala index 2dd0a92eb..f802d73b2 100644 --- a/src/test/scala/leon/test/LeonTestSuite.scala +++ b/src/test/scala/leon/test/LeonTestSuite.scala @@ -2,6 +2,8 @@ package leon.test import scala.io.Source import org.scalatest._ +import java.io.File + trait LeonTestSuite extends FunSuite { def now() = { System.currentTimeMillis @@ -83,4 +85,20 @@ trait LeonTestSuite extends FunSuite { storeStats(id, stats.withValue(total)) } } + + private val all : String=>Boolean = (s : String) => true + + def filesInResourceDir(dir : String, filter : String=>Boolean = all) : Iterable[File] = { + import scala.collection.JavaConversions._ + + val d = this.getClass.getClassLoader.getResource(dir) + + if(d == null || d.getProtocol != "file") { + assert(false, "Tests have to be run from within `sbt`, for otherwise the test files will be harder to access (and we dislike that).") + } + + val asFile = new File(d.toURI()) + + asFile.listFiles().filter(f => filter(f.getPath())) + } } diff --git a/src/test/scala/leon/test/TestUtils.scala b/src/test/scala/leon/test/TestUtils.scala deleted file mode 100644 index 376d6e402..000000000 --- a/src/test/scala/leon/test/TestUtils.scala +++ /dev/null @@ -1,25 +0,0 @@ -/* Copyright 2009-2013 EPFL, Lausanne */ - -package leon -package test - -import java.io.File - -object TestUtils { - private val all : String=>Boolean = (s : String) => true - - def filesInResourceDir(dir : String, filter : String=>Boolean = all) : Iterable[File] = { - import scala.collection.JavaConversions._ - - val d = this.getClass.getClassLoader.getResource(dir) - - if(d == null || d.getProtocol != "file") { - assert(false, "Tests have to be run from within `sbt`, for otherwise the test files will be harder to access (and we dislike that).") - } - - val asFile = new File(d.toURI()) - - asFile.listFiles().filter(f => filter(f.getPath())) - } - -} diff --git a/src/test/scala/leon/test/synthesis/SynthesisRegressionSuite.scala b/src/test/scala/leon/test/synthesis/SynthesisRegressionSuite.scala index eda49bbcf..46283db48 100644 --- a/src/test/scala/leon/test/synthesis/SynthesisRegressionSuite.scala +++ b/src/test/scala/leon/test/synthesis/SynthesisRegressionSuite.scala @@ -15,8 +15,6 @@ import leon.synthesis.utils._ import java.io.File -import TestUtils._ - class SynthesisRegressionSuite extends LeonTestSuite { private def forEachFileIn(path : String)(block : File => Unit) { val fs = filesInResourceDir(path, _.endsWith(".scala")) @@ -63,11 +61,11 @@ class SynthesisRegressionSuite extends LeonTestSuite { testSynthesis("List", f, 200) } - forEachFileIn("regression/synthesis/SortedList/") { f => - testSynthesis("SortedList", f, 400) - } + //forEachFileIn("regression/synthesis/SortedList/") { f => + // testSynthesis("SortedList", f, 400) + //} - forEachFileIn("regression/synthesis/StrictSortedList/") { f => - testSynthesis("StrictSortedList", f, 400) - } + //forEachFileIn("regression/synthesis/StrictSortedList/") { f => + // testSynthesis("StrictSortedList", f, 400) + //} } diff --git a/src/test/scala/leon/test/verification/PureScalaVerificationRegression.scala b/src/test/scala/leon/test/verification/PureScalaVerificationRegression.scala index 45374ca5e..ea7cc272b 100644 --- a/src/test/scala/leon/test/verification/PureScalaVerificationRegression.scala +++ b/src/test/scala/leon/test/verification/PureScalaVerificationRegression.scala @@ -8,8 +8,6 @@ import leon.verification.{AnalysisPhase,VerificationReport} import java.io.File -import TestUtils._ - class PureScalaVerificationRegression extends LeonTestSuite { private var counter : Int = 0 private def nextInt() : Int = { diff --git a/src/test/scala/leon/test/verification/XLangVerificationRegression.scala b/src/test/scala/leon/test/verification/XLangVerificationRegression.scala index 64b523de9..733cafce4 100644 --- a/src/test/scala/leon/test/verification/XLangVerificationRegression.scala +++ b/src/test/scala/leon/test/verification/XLangVerificationRegression.scala @@ -8,8 +8,6 @@ import leon.verification.{AnalysisPhase,VerificationReport} import java.io.File -import TestUtils._ - class XLangVerificationRegression extends LeonTestSuite { private var counter : Int = 0 private def nextInt() : Int = { -- GitLab