Skip to content

Fix tests failing when LANG="en_US.UTF-8" environment variable not set #42

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 2 commits into from
Nov 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
)