MCPcopy Create free account
hub / github.com/hashintel/hash / missing_comma

Function missing_comma

libs/@local/hashql/syntax-jexpr/src/parser/array/visit.rs:281–308  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

279
280 #[test]
281 fn missing_comma() {
282 bind_context!(let context = "[1 2]");
283 bind_state!(let mut state from context);
284
285 let token = state
286 .advance(SyntaxKind::LBracket)
287 .expect("should have at least one token");
288
289 let mut callback_count = 0;
290 let result: Result<_, ArrayDiagnostic> = visit_array(&mut state, token, |state| {
291 state
292 .advance(SyntaxKindSet::COMPLETE)
293 .expect("should have at least one token");
294 callback_count += 1;
295 Ok(())
296 });
297
298 let diagnostic = result.expect_err("should not be able to parse array with missing comma");
299 let report = render_diagnostic(context.input, &diagnostic, &context.spans);
300
301 with_settings!({
302 description => "Array with missing comma should fail"
303 }, {
304 assert_snapshot!(insta::_macro_support::AutoName, report, &context.input);
305 });
306
307 assert_eq!(callback_count, 1);
308 }
309
310 #[test]
311 fn error_in_callback() {

Callers

nothing calls this directly

Calls 5

visit_arrayFunction · 0.85
OkInterface · 0.85
render_diagnosticFunction · 0.50
expectMethod · 0.45
advanceMethod · 0.45

Tested by

no test coverage detected