diff --git a/build.sc b/build.sc index 6dca4a449..d262178c6 100644 --- a/build.sc +++ b/build.sc @@ -153,6 +153,7 @@ object upack extends Module { def moduleDeps = Seq(upickle.core.jvm()) object test extends CommonTestModule{ def moduleDeps = super.moduleDeps ++ Seq(ujson.jvm().test, upickle.core.jvm().test) + def forkEnv = super.forkEnv() ++ Map("EXAMPLE_JSON" -> exampleJson().path.toString) } } @@ -182,6 +183,7 @@ object ujson extends Module{ object test extends CommonTestModule{ def moduleDeps = super.moduleDeps ++ Seq(upickle.core.jvm().test) + def forkEnv = super.forkEnv() ++ Map("EXAMPLE_JSON" -> exampleJson().path.toString) } } diff --git a/mill b/mill index 8f7ce715d..d03a045cb 100755 --- a/mill +++ b/mill @@ -7,7 +7,7 @@ set -e if [ -z "${DEFAULT_MILL_VERSION}" ] ; then - DEFAULT_MILL_VERSION=0.11.2 + DEFAULT_MILL_VERSION=0.11.12 fi if [ -z "$MILL_VERSION" ] ; then @@ -53,7 +53,9 @@ if [ -z "$MILL_MAIN_CLI" ] ; then fi MILL_FIRST_ARG="" -if [ "$1" = "--bsp" ] || [ "$1" = "-i" ] || [ "$1" = "--interactive" ] || [ "$1" = "--no-server" ] || [ "$1" = "--repl" ] || [ "$1" = "--help" ] ; then + + # first arg is a long flag for "--interactive" or starts with "-i" +if [ "$1" = "--bsp" ] || [ "${1#"-i"}" != "$1" ] || [ "$1" = "--interactive" ] || [ "$1" = "--no-server" ] || [ "$1" = "--repl" ] || [ "$1" = "--help" ] ; then # Need to preserve the first position of those listed options MILL_FIRST_ARG=$1 shift diff --git a/ujson/test/src-jvm/ujson/ExampleJsonTests.scala b/ujson/test/src-jvm/ujson/ExampleJsonTests.scala index 585f2d469..ee4ce7f60 100644 --- a/ujson/test/src-jvm/ujson/ExampleJsonTests.scala +++ b/ujson/test/src-jvm/ujson/ExampleJsonTests.scala @@ -5,9 +5,10 @@ import java.nio.file.{Files, Paths} import utest._ object ExampleJsonTests extends TestSuite { - def check(name: String) = { - TestUtil.checkParse(new String(Files.readAllBytes(Paths.get("exampleJson", name))), true) - } + def check(name: String) = TestUtil.checkParse( + new String(Files.readAllBytes(Paths.get(sys.env("EXAMPLE_JSON"), name))), + true + ) val tests = Tests { test - check("australia-abc.json") test - check("bitcoin.json") diff --git a/upack/test/src-jvm/upack/ExampleJsonTests.scala b/upack/test/src-jvm/upack/ExampleJsonTests.scala index 421e9c7aa..17c3a2d01 100644 --- a/upack/test/src-jvm/upack/ExampleJsonTests.scala +++ b/upack/test/src-jvm/upack/ExampleJsonTests.scala @@ -7,7 +7,7 @@ import utest._ object ExampleJsonTests extends TestSuite { def check(name: String) = { val msgPack = ujson - .read(Files.readAllBytes(Paths.get("exampleJson", name))) + .read(Files.readAllBytes(Paths.get(sys.env("EXAMPLE_JSON"), name))) .transform(new MsgPackWriter(new java.io.ByteArrayOutputStream)) .toByteArray TestUtil.checkParse(msgPack, true) diff --git a/upack/test/src-jvm/upack/MsgPackJvmTests.scala b/upack/test/src-jvm/upack/MsgPackJvmTests.scala index 71a931c13..d5383e0ef 100644 --- a/upack/test/src-jvm/upack/MsgPackJvmTests.scala +++ b/upack/test/src-jvm/upack/MsgPackJvmTests.scala @@ -22,9 +22,10 @@ object MsgPackJvmTests extends TestSuite{ // Taken from: // https://github.com/msgpack/msgpack-ruby/tree/a22d8268f82e0f2ae95f038285af43ce5971810e/spec - val casesJson = "upack/test/resources/cases.json" - val casesMsg = "upack/test/resources/cases.msg" - val casesCompactMsg = "upack/test/resources/cases_compact.msg" + val resources = sys.env("MILL_TEST_RESOURCE_FOLDER") + val casesJson = resources + "/cases.json" + val casesMsg = resources + "/cases.msg" + val casesCompactMsg = resources + "/cases_compact.msg" val expectedJson = ujson.read(readBytes(casesJson)) // println("---msgs---") val msg = readMsgs(casesMsg)