summaryrefslogtreecommitdiff
path: root/test/json.c
diff options
context:
space:
mode:
authorAlbert Cervin <albert@acervin.com>2025-11-26 23:34:08 +0100
committerAlbert Cervin <albert@acervin.com>2025-11-26 23:34:08 +0100
commitf06d8923e86a2af70f9c97f8484dc9e645dcefdb (patch)
treea2fce0ab790dda09bfb33544622f65d7953fc898 /test/json.c
parentb8f2c54675cfd4c89c13941503fb23eda0ad082d (diff)
downloaddged-f06d8923e86a2af70f9c97f8484dc9e645dcefdb.tar.gz
dged-f06d8923e86a2af70f9c97f8484dc9e645dcefdb.tar.xz
dged-f06d8923e86a2af70f9c97f8484dc9e645dcefdb.zip
Handle unicode chars when unescaping JSON
The python LSP used some nbsp unicode chars when sending back documentation.
Diffstat (limited to 'test/json.c')
-rw-r--r--test/json.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/json.c b/test/json.c
index 0243ee3..720ebfc 100644
--- a/test/json.c
+++ b/test/json.c
@@ -190,6 +190,12 @@ static void test_str_escape(void) {
struct s8 res2 = unescape_json_string(s8(" \\\\\\n"));
ASSERT(s8eq(res2, s8(" \\\n")), "Expected \\ and \\n to not be removed");
s8delete(res2);
+
+ struct s8 res3 = unescape_json_string(
+ s8("\\n \\u26f0 \\u2702 \\u00a0\\u00a0\\u00a0\\u00a0"));
+ ASSERT(s8eq(res3, s8("\n ⛰ ✂ \u00a0\u00a0\u00a0\u00a0")),
+ "Expected unicode decoding to work.");
+ s8delete(res3);
}
void run_json_tests(void) {