Skip to content

Commit 2a07af4

Browse files
authored
Merge pull request #42 from krzesii/fix/fix-locale-build-issue
Fix tests failing when LANG="en_US.UTF-8" environment variable not set
2 parents 1826b66 + 6d5790b commit 2a07af4

File tree

2 files changed

+4
-22
lines changed

2 files changed

+4
-22
lines changed

README.md

-22
Original file line numberDiff line numberDiff line change
@@ -169,28 +169,6 @@ HELLO WORLD!
169169
$
170170
```
171171

172-
### Build Troubleshooting
173-
174-
Here are tips for issues users have reported.
175-
176-
#### Internationalization
177-
178-
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`:
179-
180-
```
181-
[info] Passed: Total 7, Failed 0, Errors 0, Passed 7
182-
[error] Failed: Total 233, Failed 7, Errors 0, Passed 226
183-
[error] Failed tests:
184-
[error] progscala3.fp.combinators.PayrollSuite
185-
[error] progscala3.fp.curry.TupledFuncSuite
186-
[error] progscala3.dsls.payroll.PayrollSuite
187-
[error] (Test / test) sbt.TestsFailedException: Tests unsuccessful
188-
[error] Total time: 2 s, completed 31.07.2021, 16:56:39
189-
```
190-
191-
192-
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.
193-
194172
## Feedback
195173

196174
I welcome feedback on the Book and these examples. Please post comments, corrections, etc. to one of the following places:

build.sbt

+4
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ lazy val root = project
5959
// "-Yexplicit-nulls", // For explicit nulls behavior.
6060
),
6161
Compile / console / scalacOptions := scalacOptions.value,
62+
fork := true,
63+
javaOptions ++= Seq(
64+
"-Duser.language=en_US"
65+
),
6266
javacOptions ++= Seq(
6367
"-Xlint:unchecked", "-Xlint:deprecation") // Java 8: "-Xdiags:verbose"),
6468
)

0 commit comments

Comments
 (0)