v/vlib/x/json2/decoder2/tests/decode_escaped_string_test.v
Larsimusrex 54c6daab54
decoder2: fix checking and decoding of escape characters (fix #24834) (#24915)
Co-authored-by: Lars Dumke <lars-luis.dumke@keysight.com>
2025-07-17 08:34:05 +03:00

13 lines
372 B
V

import x.json2
import x.json2.decoder2
fn test_decode_escaped_string() {
escaped_strings := ['test', 'test\\sd', 'test\nsd', '\ntest', 'test\\"', 'test\\', 'test\u1234ps',
'test\u1234', '\u1234\\\t"', '']
json_string := json2.encode[[]string](escaped_strings)
decoded_strings := decoder2.decode[[]string](json_string)!
assert escaped_strings == decoded_strings
}