diff options
| author | Abdelrahman Farid <abdelrahman.farid@gmail.com> | 2023-09-19 22:18:23 +0300 |
|---|---|---|
| committer | Abdelrahman Farid <abdelrahman.farid@gmail.com> | 2023-09-19 22:18:23 +0300 |
| commit | 9ed36445b924c028acf72854e6ca735abf5838cc (patch) | |
| tree | 1e63477c9aa14b7a9b53fd463543a3b7d3f9fb29 /tests | |
| parent | ecde06e3a31179bd8f86383fd65cfbce31ab6d9a (diff) | |
Add test for utf8 multibyte strings
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/core/encoding/json/test_core_json.odin | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/core/encoding/json/test_core_json.odin b/tests/core/encoding/json/test_core_json.odin index 937d1c738..23361d694 100644 --- a/tests/core/encoding/json/test_core_json.odin +++ b/tests/core/encoding/json/test_core_json.odin @@ -33,6 +33,7 @@ main :: proc() { marshal_json(&t) unmarshal_json(&t) surrogate(&t) + utf8_string_of_multibyte_characters(&t) fmt.printf("%v/%v tests successful.\n", TEST_count - TEST_fail, TEST_count) if TEST_fail > 0 { @@ -359,3 +360,10 @@ surrogate :: proc(t: ^testing.T) { expect(t, uerr == nil, fmt.tprintf("Expected `json.unmarshal(%q)` to return a nil error, got %v", string(out), uerr)) expect(t, back == input, fmt.tprintf("Expected `json.unmarshal(%q)` to return %q, got %v", string(out), input, uerr)) } + +@test +utf8_string_of_multibyte_characters :: proc(t: ^testing.T) { + _, err := json.parse_string(`"🐛✅"`) + msg := fmt.tprintf("Expected `json.parse` to return nil, got %v", err) + expect(t, err == nil, msg) +} |