bats-assert icon indicating copy to clipboard operation
bats-assert copied to clipboard

bats-assert testsuite fails in non English locales (+ no longer builds reproducibly)

Open gioele opened this issue 3 months ago • 0 comments

Hi, after #89 (thanks!) bats-assert's tests run flawlessly in English-based, but fails in locales based in other languages.

The issue is that the various assert_line() --regexp tests check for the presence of a specific string that Bash produces only when run in an English-based locale.

This issue also breaks the reproducibility of the Debian packages (reproducible packages are supposed to successfully build under different locales).

There are two possible approaches to fix this issue:

  1. Force the language inside the testsuite. This is what I'm doing in Debian. Regardless of the locale set in the environment, inside the testsuite everything will be run in English. In Debian I'm using LC_ALL=C.UTF-8, but C.UTF-8 may not be available in other systems (mac? win? musl?), so perhaps LC_ALL=C works better for you.

  2. Change the regexp tests to check something else than the text of the output.

Approach 2 is surely more robust, but I would suggest going for approach 1 because I don't see the a big advantage for bats-assert to extend its internal test coverage to non-English locales.

gioele avatar Oct 14 '25 18:10 gioele