Skip to content

Commit d2dd6a3

Browse files
authored
Enable tests for invalid documents starting with n (#94)
* Enable tests for invalid documents starting with n * Add test for invalid document with trailing text Oddly, `null trailing` gives an error, but `nully trailing` does not * Add workaround for scalar document is_null bug For now, we can just manually throw the exception until the next simdjson bugfix release: simdjson/simdjson#2258
1 parent 4a65dc5 commit d2dd6a3

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nully trailing

spec/compile_spec.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,11 @@ end
108108

109109
local invalid_files = {
110110
"bool_trailing.json",
111+
"nully_trailing.json",
111112
"nil_token.json",
112-
-- "nil_token_scalar.json",
113+
"nil_token_scalar.json",
113114
"nully_token.json",
114-
-- "nully_token_scalar.json"
115+
"nully_token_scalar.json"
115116
}
116117

117118
describe("Make sure invalid files are not accepted", function()

src/luasimdjson.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ void convert_ondemand_element_to_table(lua_State *L, T& element) {
124124
// calling is_null().value() will trigger an exception if the value is invalid
125125
if (element.is_null().value()) {
126126
lua_pushlightuserdata(L, NULL);
127+
} else {
128+
// workaround for simdjson 3.10.1
129+
throw simdjson_error(INCORRECT_TYPE);
127130
}
128131
break;
129132
}

0 commit comments

Comments
 (0)