diff options
author | Christopher Vogt <oss.nsp@cvogt.org> | 2016-08-14 20:13:44 -0400 |
---|---|---|
committer | Christopher Vogt <oss.nsp@cvogt.org> | 2016-08-28 23:37:16 -0400 |
commit | 9022c5ffbe4aa993da436f71dd732567c64a6c24 (patch) | |
tree | b6e8f4a9c89645f79076963b85f6727e5e7d188b /test | |
parent | 2d291a4fe19330020d7c1845bbb1deee204c6d69 (diff) | |
download | cbt-9022c5ffbe4aa993da436f71dd732567c64a6c24.tar.gz cbt-9022c5ffbe4aa993da436f71dd732567c64a6c24.tar.bz2 cbt-9022c5ffbe4aa993da436f71dd732567c64a6c24.zip |
Add a bunch of options to try to allow safe usage of clean
try to make tests safer
(fixed tests don't have clean yet, nothing has nothing to delete, so
current test code would fail)
Diffstat (limited to 'test')
-rw-r--r-- | test/test.scala | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/test/test.scala b/test/test.scala index 13209ff..7bbf1d9 100644 --- a/test/test.scala +++ b/test/test.scala @@ -1,6 +1,7 @@ import cbt._ import java.util.concurrent.ConcurrentHashMap import java.io.File +import java.nio.file._ import java.net.URL // micro framework @@ -73,9 +74,22 @@ object Main{ } def clean(path: String)(implicit logger: Logger) = { - val res = runCbt(path, Seq("clean", "-f")) - val debugToken = "clean " ++ path ++ " " + val res = runCbt(path, Seq("clean", "dry-run", "force")) + val debugToken = "\n"++lib.red("Deleting") ++ " " ++ Paths.get("test/"++path++"/target").toAbsolutePath.toString++"\n" + val debugToken2 = "\n"++lib.red("Deleting") ++ " " ++ Paths.get("test/"++path).toAbsolutePath.toString++"\n" assertSuccess(res,debugToken) + assert(res.out == "", debugToken ++ " " ++ res.toString) + assert(res.err.contains(debugToken), debugToken ++ " " ++ res.toString) + assert( + !res.err.contains(debugToken2), + "Tried to delete too much: " ++ debugToken2 ++ " " ++ res.toString + ) + res.err.split("\n").filter(_.startsWith(lib.red("Deleting"))).foreach{ line => + assert( + line.size >= debugToken2.trim.size, + "Tried to delete too much: " ++ line + ) + } } logger.test( "Running tests " ++ _args.toList.toString ) @@ -156,7 +170,7 @@ object Main{ usage("nothing") compile("nothing") - clean("nothing") + //clean("nothing") usage("multi-build") compile("multi-build") clean("multi-build") @@ -165,7 +179,6 @@ object Main{ clean("simple") usage("simple-fixed") compile("simple-fixed") - clean("simple-fixed") compile("../plugins/sbt_layout") compile("../plugins/scalafmt") |