mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Add test for utf8 multibyte strings
This commit is contained in:
@@ -33,6 +33,7 @@ main :: proc() {
|
|||||||
marshal_json(&t)
|
marshal_json(&t)
|
||||||
unmarshal_json(&t)
|
unmarshal_json(&t)
|
||||||
surrogate(&t)
|
surrogate(&t)
|
||||||
|
utf8_string_of_multibyte_characters(&t)
|
||||||
|
|
||||||
fmt.printf("%v/%v tests successful.\n", TEST_count - TEST_fail, TEST_count)
|
fmt.printf("%v/%v tests successful.\n", TEST_count - TEST_fail, TEST_count)
|
||||||
if TEST_fail > 0 {
|
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, 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))
|
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)
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user