Prevent string assertion failures from creating later memory leak errors
This commit is contained in:
parent
e0c24e3be6
commit
e7abfdd373
2 changed files with 6 additions and 4 deletions
|
|
@ -26,9 +26,10 @@ describe("Document", [&]() {
|
|||
});
|
||||
|
||||
auto assert_node_string_equals = [&](TSNode node, const string &expected) {
|
||||
char *actual = ts_node_string(node, doc);
|
||||
char *str = ts_node_string(node, doc);
|
||||
string actual(str);
|
||||
ts_free(str);
|
||||
AssertThat(actual, Equals(expected));
|
||||
ts_free(actual);
|
||||
};
|
||||
|
||||
describe("set_input(input)", [&]() {
|
||||
|
|
|
|||
|
|
@ -77,9 +77,10 @@ describe("Parser", [&]() {
|
|||
|
||||
auto assert_root_node = [&](const string &expected) {
|
||||
TSNode node = ts_document_root_node(doc);
|
||||
char *actual = ts_node_string(node, doc);
|
||||
char *str = ts_node_string(node, doc);
|
||||
string actual(str);
|
||||
ts_free(str);
|
||||
AssertThat(actual, Equals(expected));
|
||||
ts_free(actual);
|
||||
};
|
||||
|
||||
describe("handling errors", [&]() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue