Also simplify the test so we call `utf16_iterate` directly. Calling
`utf16_iterate` via `SpyInput` and `ts_document_parse` doesn't seem to reliably
trigger the problem using valgrind.
valgrind also doesn't detect the problem if we use a string literal like:
`utf16_iterate("", 1, &code_point);`
18 lines
325 B
C++
18 lines
325 B
C++
#include "test_helper.h"
|
|
#include "runtime/utf16.h"
|
|
|
|
START_TEST
|
|
|
|
describe("Lexer", [&]() {
|
|
it("handles truncated UTF16 data", [&]() {
|
|
uint8_t *content = new uint8_t[1];
|
|
*content = 'A';
|
|
|
|
int32_t code_point = 0;
|
|
utf16_iterate(content, 1, &code_point);
|
|
|
|
delete[] content;
|
|
});
|
|
});
|
|
|
|
END_TEST
|