From 49d85750afb271a552c034984273dc7d6bf92a91 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Thu, 14 Dec 2017 00:09:56 -0500 Subject: [PATCH] add test --- .appveyor.yml | 6 ++++-- citest/build.sbt | 31 +++++++++++++++++++++++++++++++ citest/project/build.properties | 1 + citest/test.bat | 12 +++++++++++- citest/test1.bat | 11 +++++++++++ citest/test2.bat | 11 +++++++++++ 6 files changed, 69 insertions(+), 3 deletions(-) create mode 100644 citest/build.sbt create mode 100644 citest/project/build.properties create mode 100644 citest/test1.bat create mode 100644 citest/test2.bat diff --git a/.appveyor.yml b/.appveyor.yml index 6fe1b8bc8..a467cd4a4 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -23,5 +23,7 @@ install: test_script: - sbt "-Dsbt.build.version=1.0.4" universal:packageBin - - unzip target\universal\sbt.zip -d target\freshly-baked\ - - citest\test.bat + - cd citest + - test.bat + - test1.bat + - test2.bat diff --git a/citest/build.sbt b/citest/build.sbt new file mode 100644 index 000000000..63168c406 --- /dev/null +++ b/citest/build.sbt @@ -0,0 +1,31 @@ +lazy val check = taskKey[Unit]("") + +lazy val root = (project in file(".")) + .settings( + scalaVersion := "2.12.4", + name := "Hello", + check := { + val xs = IO.readLines(file("output.txt")).toVector + + println(xs) + + assert(xs(0) startsWith "Copying runtime jar.") + // echo of jar name + assert(xs(2) startsWith "[info] Loading project definition") + assert(xs(3) startsWith "[info] Loading settings from build.sbt") + assert(xs(4) startsWith "[info] Set current project to Hello") + assert(xs(5) startsWith "[info] This is sbt") + assert(xs(6) startsWith "[info] The current project") + assert(xs(7) startsWith "[info] The current project is built against Scala 2.12.4") + + val ys = IO.readLines(file("err.txt")).toVector + + println(ys) + + assert(ys.size == 4) + assert(ys(0) startsWith "Error: Unable to access jarfile") + assert(ys(1) startsWith "The filename, directory name, or volume label syntax is incorrect.") + assert(ys(2) startsWith "Error: Unable to access jarfile") + assert(ys(3) startsWith "Java HotSpot(TM) 64-Bit Server VM warning") + } + ) diff --git a/citest/project/build.properties b/citest/project/build.properties new file mode 100644 index 000000000..394cb75cf --- /dev/null +++ b/citest/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.0.4 diff --git a/citest/test.bat b/citest/test.bat index 30365c99d..609959707 100644 --- a/citest/test.bat +++ b/citest/test.bat @@ -1,6 +1,16 @@ +@echo on + cd "%~dp0" +mkdir freshly-baked +unzip ..\target\universal\sbt.zip -d freshly-baked + +SETLOCAL + SET JAVA_HOME=C:\jdk9 SET PATH=C:\jdk9\bin;%PATH% +SET SBT_OPTS=-Xmx4g -Dfile.encoding=UTF8 -"..\target\freshly-baked\sbt\bin\sbt" about +"freshly-baked\sbt\bin\sbt" about + +ENDLOCAL diff --git a/citest/test1.bat b/citest/test1.bat new file mode 100644 index 000000000..b02954cd9 --- /dev/null +++ b/citest/test1.bat @@ -0,0 +1,11 @@ +@echo on + +SETLOCAL + +SET JAVA_HOME=C:\jdk9 +SET PATH=C:\jdk9\bin;%PATH% +SET SBT_OPTS=-Xmx4g -Dfile.encoding=UTF8 + +"freshly-baked\sbt\bin\sbt" about 1> output.txt 2> err.txt + +ENDLOCAL diff --git a/citest/test2.bat b/citest/test2.bat new file mode 100644 index 000000000..b02598217 --- /dev/null +++ b/citest/test2.bat @@ -0,0 +1,11 @@ +@echo on + +SETLOCAL + +SET JAVA_HOME=C:\jdk9 +SET PATH=C:\jdk9\bin;%PATH% +SET SBT_OPTS=-Xmx4g -Dfile.encoding=UTF8 + +"freshly-baked\sbt\bin\sbt" check + +ENDLOCAL