aboutsummaryrefslogtreecommitdiffstats
path: root/community/lua-lpeg/test-fix-setlocale.patch
blob: 028c18cf4fe318842769300d6bcbdcd5fbfd24e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
os.setlocale just calls setlocale() from libc and musl's implementation
behaves a bit differently in comparison with BSD libc or glibc.

When particular locales for all categories are the same, e.g. "C",
`setlocale(LC_ALL, "")` returns just "C" on BSD libc (tested on macOS)
and glibc, but musl returns "C;C;C;C;C;C". When some locale is different,
e.g. LC_CTYPE, then on macOS you get "C/en_US.UTF-8/C/C/C/C", on glibc
"LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;...", on musl "en_US.UTF-8;C;C;C;C;C".

--- a/test.lua
+++ b/test.lua
@@ -1428,7 +1428,7 @@
 
 
 -- testing pre-defined names
-assert(os.setlocale("C") == "C")
+assert(os.setlocale("C"):sub(1, 1) == "C")
 
 function eqlpeggsub (p1, p2)
   local s1 = cs2str(re.compile(p1))