From 09b8471f5c8a2abb0ba582f045aa33daa32ad67c Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Thu, 29 Jul 2021 16:58:04 +0200 Subject: [PATCH] Test numeric locale This allows us to test that `test` takes numbers with decimal point even in comma-using locales, to stop those pesky americans from breaking everything again. (and yes, we use french to keep myself honest) --- tests/checks/test.fish | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/checks/test.fish b/tests/checks/test.fish index b6ecbb554..cda8d7fc6 100644 --- a/tests/checks/test.fish +++ b/tests/checks/test.fish @@ -52,3 +52,19 @@ t 5,2 # CHECKERR: in function 't' with arguments '5,2' # CHECKERR: called on line {{\d+}} of file {{.*}}test.fish +if command -q locale + # Try to get a comma-using locale. + # We have a cheesy list hardcoded, and try to get it in the spelling + # that "locale" uses. + set -l locales (locale -a) + set -l use + for locale in de_de fr_fr nl_NL pt_BR + set use (string match -ri "$locale.utf.?8" -- $locales) + and break + end + if set -q use[1] + set -gx LC_ALL $use + # This should succeed without output + test 42.5 -gt 37.2 + end +end