aboutsummaryrefslogtreecommitdiffstats
path: root/community/lua-lpeg/test-fix-setlocale.patch
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2017-05-12 21:51:54 +0200
committerJakub Jirutka <jakub@jirutka.cz>2017-05-12 22:23:07 +0200
commit04170b314686f4117edf1052d5ef951f570de158 (patch)
treebf6c3c1cfea640230914543366313a66488a0dd8 /community/lua-lpeg/test-fix-setlocale.patch
parent1f89c5f7ea9a5188e5d6a5352ae1fd6bf74fa8d5 (diff)
community/lua-lpeg: run tests on check
Diffstat (limited to 'community/lua-lpeg/test-fix-setlocale.patch')
-rw-r--r--community/lua-lpeg/test-fix-setlocale.patch20
1 files changed, 20 insertions, 0 deletions
diff --git a/community/lua-lpeg/test-fix-setlocale.patch b/community/lua-lpeg/test-fix-setlocale.patch
new file mode 100644
index 00000000000..028c18cf4fe
--- /dev/null
+++ b/community/lua-lpeg/test-fix-setlocale.patch
@@ -0,0 +1,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))