Assert ts_parser_set_language in fuzz driver
#include <string.h>
+#include <cassert>
#include "tree_sitter/runtime.h"
void test_log(void *payload, TSLogType type, const char *string) { }
@@ -13,7 +14,11 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
const char *str = reinterpret_cast<const char *>(data);
TSParser *parser = ts_parser_new();
- ts_parser_set_language(parser, TS_LANG());
+
+ // This can fail if the language version doesn't match the runtime version
+ bool language_ok = ts_parser_set_language(parser, TS_LANG());
+ assert(language_ok);
+
ts_parser_halt_on_error(parser, TS_HALT_ON_ERROR);
TSTree *tree = ts_parser_parse_string(parser, NULL, str, size);
