From 9af512eaf8b4946b32b79e1f5daf485aba795127 Mon Sep 17 00:00:00 2001 From: krzesi Date: Tue, 17 Aug 2021 19:07:19 +0200 Subject: [PATCH] Fix tests failing when LANG="en_US.UTF-8" environment variable not set --- README.md | 22 ---------------------- build.sbt | 4 ++++ 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 37f66372..3d7cee6d 100644 --- a/README.md +++ b/README.md @@ -169,28 +169,6 @@ HELLO WORLD! $ ``` -### Build Troubleshooting - -Here are tips for issues users have reported. - -#### Internationalization - -I didn't check that the tests pass or the scripts work if your language environment isn't English. So, no surprise I guess, a German user reported that three tests failed when running `sbt test` while the `LANG` was set to `de_DE.UTF-8`: - -``` -[info] Passed: Total 7, Failed 0, Errors 0, Passed 7 -[error] Failed: Total 233, Failed 7, Errors 0, Passed 226 -[error] Failed tests: -[error] progscala3.fp.combinators.PayrollSuite -[error] progscala3.fp.curry.TupledFuncSuite -[error] progscala3.dsls.payroll.PayrollSuite -[error] (Test / test) sbt.TestsFailedException: Tests unsuccessful -[error] Total time: 2 s, completed 31.07.2021, 16:56:39 -``` - - -Setting `export LANG="en_US.UTF-8"; sbt test` works. A PR for this is welcome ;) As an interim step, you could wrap this logic (or the more concise single command `LANG="en_US.UTF-8" sbt test`) in a script or just ignore the three failing tests. - ## Feedback I welcome feedback on the Book and these examples. Please post comments, corrections, etc. to one of the following places: diff --git a/build.sbt b/build.sbt index 70e884e5..8cc00b5c 100644 --- a/build.sbt +++ b/build.sbt @@ -58,6 +58,10 @@ lazy val root = project // "-Yexplicit-nulls", // For explicit nulls behavior. ), Compile / console / scalacOptions := scalacOptions.value, + fork := true, + javaOptions ++= Seq( + "-Duser.language=en_US" + ), javacOptions ++= Seq( "-Xlint:unchecked", "-Xlint:deprecation") // Java 8: "-Xdiags:verbose"), )