(input: string, expected: any, expectedErrors: number[] = [], options?: ParseOptions)
| 41 | } |
| 42 | |
| 43 | function assertTree(input: string, expected: any, expectedErrors: number[] = [], options?: ParseOptions): void { |
| 44 | const errors: ParseError[] = []; |
| 45 | const actual = parseTree(input, errors, options); |
| 46 | |
| 47 | assert.deepStrictEqual(errors.map(e => e.error, expected), expectedErrors); |
| 48 | const checkParent = (node: Node) => { |
| 49 | if (node.children) { |
| 50 | for (const child of node.children) { |
| 51 | assert.strictEqual(node, child.parent); |
| 52 | // eslint-disable-next-line local/code-no-any-casts |
| 53 | delete (<any>child).parent; // delete to avoid recursion in deep equal |
| 54 | checkParent(child); |
| 55 | } |
| 56 | } |
| 57 | }; |
| 58 | checkParent(actual); |
| 59 | |
| 60 | assert.deepStrictEqual(actual, expected); |
| 61 | } |
| 62 | |
| 63 | suite('JSON', () => { |
| 64 |
no test coverage detected
searching dependent graphs…