()
| 140 | |
| 141 | #[test] |
| 142 | fn empty_array() { |
| 143 | bind_context!(let context = "[]"); |
| 144 | bind_state!(let mut state from context); |
| 145 | |
| 146 | // Get the first token which should be the opening bracket |
| 147 | let token = state |
| 148 | .advance(SyntaxKind::LBracket) |
| 149 | .expect("should have at least one token"); |
| 150 | |
| 151 | let mut items_count = 0; |
| 152 | let result: Result<_, ArrayDiagnostic> = visit_array(&mut state, token, |_| { |
| 153 | // This callback should not be called for an empty array |
| 154 | items_count += 1; |
| 155 | Ok(()) |
| 156 | }); |
| 157 | |
| 158 | let range = result.expect("should be able to parse empty array"); |
| 159 | assert_eq!(range.start(), TextSize::new(0)); |
| 160 | assert_eq!(range.end(), TextSize::new(2)); |
| 161 | |
| 162 | assert_eq!(items_count, 0); |
| 163 | } |
| 164 | |
| 165 | #[test] |
| 166 | fn single_item_array() { |
nothing calls this directly
no test coverage detected