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

Function unclosed_array

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

Source from the content-addressed store, hash-verified

346
347 #[test]
348 fn unclosed_array() {
349 bind_context!(let context = "[1, 2");
350 bind_state!(let mut state from context);
351
352 let token = state
353 .advance(SyntaxKind::LBracket)
354 .expect("should have at least one token");
355
356 let result: Result<_, ArrayDiagnostic> = visit_array(&mut state, token, |state| {
357 state
358 .advance(SyntaxKindSet::COMPLETE)
359 .expect("should have at least one token");
360 Ok(())
361 });
362
363 let diagnostic = result.expect_err("should fail with unclosed array");
364 let report = render_diagnostic(context.input, &diagnostic, &context.spans);
365
366 with_settings!({
367 description => "Unclosed array should fail"
368 }, {
369 assert_snapshot!(insta::_macro_support::AutoName, report, &context.input);
370 });
371 }
372
373 #[test]
374 fn empty_array_with_whitespace() {

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