()
| 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() { |
nothing calls this directly
no test coverage detected