MCPcopy
hub / github.com/microsoft/vscode / assertTree

Function assertTree

src/vs/base/test/common/json.test.ts:43–61  ·  view source on GitHub ↗
(input: string, expected: any, expectedErrors: number[] = [], options?: ParseOptions)

Source from the content-addressed store, hash-verified

41}
42
43function 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
63suite('JSON', () => {
64

Callers 1

json.test.tsFile · 0.85

Calls 3

parseTreeFunction · 0.90
checkParentFunction · 0.85
mapMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…