From 3002c88f44de61729335b626df9273438cb24d3d Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Mon, 28 Sep 2020 17:53:27 +0200 Subject: [PATCH] Set fish_emoji_width in test to guard against older wcwidth See #7340 --- tests/checks/string.fish | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/tests/checks/string.fish b/tests/checks/string.fish index 57bc5bae8..54c22ee5c 100644 --- a/tests/checks/string.fish +++ b/tests/checks/string.fish @@ -54,19 +54,21 @@ string pad --width 7 -c '=' foo echo \|(string pad --width 10 --right foo)\| # CHECK: |foo | -# Pad string with multi-width emoji. -string pad -w 4 -c . 🐟 -# NOTE: These are regex'd because the testing system might have an older/newer wcwidth. -# CHECK: .{{.*}}🐟 +begin + set -l fish_emoji_width 2 + # Pad string with multi-width emoji. + string pad -w 4 -c . 🐟 + # CHECK: ..🐟 -# Pad with multi-width character. -string pad -w 3 -c 🐟 . -# CHECK: {{🐟+}}. + # Pad with multi-width character. + string pad -w 3 -c 🐟 . + # CHECK: 🐟. -# Multi-width pad with remainder, complemented with a space. -string pad -w 4 -c 🐟 k kk -# CHECK: {{🐟+}} k -# CHECK: {{🐟+}}kk + # Multi-width pad with remainder, complemented with a space. + string pad -w 4 -c 🐟 . .. + # CHECK: 🐟 . + # CHECK: 🐟.. +end # Pad to the maximum length. string pad -c . long longer longest