mirror of
https://github.com/odin-lang/Odin.git
synced 2026-06-01 08:21:12 +00:00
Add comment explaining #4515 test.
This commit is contained in:
committed by
flysand7
parent
66c57e380a
commit
7e4aafe239
@@ -112,9 +112,14 @@ out_of_memory_in_unmarshal :: proc(t: ^testing.T) {
|
||||
err := json.unmarshal(transmute([]u8)json_data, &test_result)
|
||||
testing.expectf(t, err == nil, "Expected `json.unmarshal` to succeed, got error %v", err)
|
||||
|
||||
err = json.unmarshal(transmute([]u8)json_data, &test_result)
|
||||
expected_error := json.Error.Out_Of_Memory
|
||||
testing.expectf(t, err == json.Error.Out_Of_Memory, "Expected `json.unmarshal` to fail with %v, got %v", expected_error, err)
|
||||
// Test #4515 fix.
|
||||
// Without `or_return` in `unmarshal_object`'s struct_loop, `json.unmarshal` would return OOM a few times and then return `Unsupported_Type_Error`.
|
||||
// With the fix we expect it to return OOM every time, so if this ever fails, it means we have a regression.
|
||||
for _ in 0..<8 {
|
||||
err = json.unmarshal(transmute([]u8)json_data, &test_result)
|
||||
expected_error := json.Error.Out_Of_Memory
|
||||
testing.expectf(t, err == json.Error.Out_Of_Memory, "Expected `json.unmarshal` to fail with %v, got %v", expected_error, err)
|
||||
}
|
||||
}
|
||||
|
||||
@test
|
||||
|
||||
Reference in New Issue
Block a user