From a00fce516e89c881214fad15bcb9e248b35b64aa Mon Sep 17 00:00:00 2001 From: Christoffer Lerno Date: Sun, 29 Sep 2024 11:23:40 +0200 Subject: [PATCH] Added test and releasenotes for #1498. --- releasenotes.md | 1 + test/unit/stdlib/encoding/json.c3 | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/releasenotes.md b/releasenotes.md index dd4c016dc..9fccf1088 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -64,6 +64,7 @@ - Bad error message aliasing an ident with a path. #1481. - Error when slicing a struct with an inline array #1488. - Improved error messages on `Foo a = foo { 1 };` #1496 +- Bug in json decoder escape handling. ### Stdlib changes - Additional init functions for hashmap. diff --git a/test/unit/stdlib/encoding/json.c3 b/test/unit/stdlib/encoding/json.c3 index 811df74fd..67e4bb2e9 100644 --- a/test/unit/stdlib/encoding/json.c3 +++ b/test/unit/stdlib/encoding/json.c3 @@ -6,14 +6,14 @@ import std::encoding::json; fn void! simple_test() { ByteReader reader; - reader.init(`{ "b": 123, "c": [ { "d": 66 }, null, "hello", false, { "id": "xyz" } ] }`); + reader.init(`{ "b": 123, "c": [ { "d": 66 }, null, "hello\tworld", false, { "id": "xyz" } ] }`); Object* o = json::parse(&reader)!; defer o.free(); assert(o.get_int("b")! == 123); assert(o.get("c").get_len()! == 5); assert(o.get("c").get_at(0).get_int("d")! == 66); assert(o.get("c").get_at(1).is_null()!); - assert(o.get("c").get_string_at(2)! == "hello"); + assert(o.get("c").get_string_at(2)! == "hello\tworld"); assert(o.get("c").get_bool_at(3)! == false); assert(o.get("c").get_at(4).get_string("id")! == "xyz"); }