summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2024-03-26 12:18:50 -0400
committerTavian Barnes <tavianator@tavianator.com>2024-03-26 12:18:50 -0400
commit310bc847bca9e2457700598be99390867fd2a84e (patch)
tree7bb619ce83c0b397008605171fcaccb9ec9e6e01 /tests
parent7e25b9c6e718437ed45aa2592598c63f0f87e70a (diff)
downloadbfs-310bc847bca9e2457700598be99390867fd2a84e.tar.xz
bfstd: Escape ASCII tildes
The POSIX spec [1] lists some characters that may need to be escaped. Unfortunately, the document uses ˜ (U+02DC SMALL TILDE) instead of ~ (U+007E TILDE), and I copy-pasted from it. [1]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_02
Diffstat (limited to 'tests')
-rw-r--r--tests/bfstd.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/bfstd.c b/tests/bfstd.c
index 3ffab41..dc5ceaa 100644
--- a/tests/bfstd.c
+++ b/tests/bfstd.c
@@ -75,6 +75,7 @@ bool check_bfstd(void) {
ret &= check_wordesc("\"word's\"", "'\"word'\\''s\"'", WESC_SHELL);
ret &= check_wordesc("\033[1mbold's\033[0m", "$'\\e[1mbold\\'s\\e[0m'", WESC_SHELL | WESC_TTY);
ret &= check_wordesc("\x7F", "$'\\x7F'", WESC_SHELL | WESC_TTY);
+ ret &= check_wordesc("~user", "\"~user\"", WESC_SHELL);
const char *charmap = nl_langinfo(CODESET);
if (strcmp(charmap, "UTF-8") == 0) {
@@ -82,6 +83,7 @@ bool check_bfstd(void) {
ret &= check_wordesc("\xF0\x9F", "$'\\xF0\\x9F'", WESC_SHELL | WESC_TTY);
ret &= check_wordesc("\xF0\x9F\x98", "$'\\xF0\\x9F\\x98'", WESC_SHELL | WESC_TTY);
ret &= check_wordesc("\xF0\x9F\x98\x80", "\xF0\x9F\x98\x80", WESC_SHELL | WESC_TTY);
+ ret &= check_wordesc("\xCB\x9Cuser", "\xCB\x9Cuser", WESC_SHELL);
}
ret &= bfs_check(xstrwidth("Hello world") == 11);