fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
4ce8037e7
master
1# RUN: %fish %s 2# musl currently does not have a `locale` command, so we skip this test there. 3# REQUIRES: command -v locale 4# We need a comma-using locale we know. 5# REQUIRES: locale -a | grep -Ei '(bg_BG|de_DE|es_ES|fr_FR|ru_RU)\.(UTF-8|utf8)' 6# OpenBSD does not use LC_NUMERIC, this test is pointless there. 7# REQUIRES: test "$(uname)" != OpenBSD 8 9set -l locales( locale -a) 10set -l acceptable_locales bg_BG de_DE es_ES fr_FR ru_RU 11set -l numeric_locale 12for localein { $acceptable_locales } .{ UTF-8, UTF8} 13if string match -i -q$locale $locales 14set numeric_locale$locale 15break 16end 17end 18 19if not set -q numeric_locale[ 1 ] 20# Note we tried to check for a locale above, 21# but in case this fails because of e.g. case issues, 22# let's error again. 23echo Please install one of the following locales:>&2 24printf '%s\n' $acceptable_locales ".utf-8" >&2 25exit 127 26end 27 28begin 29set -x LC_NUMERIC$numeric_locale 30printf '%e\n' "3,45" # should succeed, output should be 3,450000e+00 31# CHECK: 3,450000e+00 32printf '%e\n' "4.56" # should succeed, output should be 4,560000e+00 33# CHECK: 4,560000e+00 34 35# This should succeed without output 36test 42.5 -gt 37.2 37end