A closure of two symbols that call each other, which is where a naive walk never returns.
()
| 72 | |
| 73 | /** A closure of two symbols that call each other, which is where a naive walk never returns. */ |
| 74 | function cyclicClosure(): ClosureDocument { |
| 75 | const symbol = (name: string) => ({ |
| 76 | nodeId: `p.${name}`, |
| 77 | name, |
| 78 | qualifiedName: `p.${name}`, |
| 79 | kind: 'function' as const, |
| 80 | uri: `file:///workspace/src/${name}.ts`, |
| 81 | range: { start: { line: 0, character: 0 }, end: { line: 4, character: 0 } }, |
| 82 | selectionRange: { start: { line: 0, character: 0 }, end: { line: 0, character: 0 } }, |
| 83 | }); |
| 84 | const ping = symbol('ping'); |
| 85 | const pong = symbol('pong'); |
| 86 | return { |
| 87 | root: ping, |
| 88 | symbols: [ping, pong], |
| 89 | edges: [ |
| 90 | { from: 'p.ping', to: 'p.pong', line: 2 }, |
| 91 | { from: 'p.pong', to: 'p.ping', line: 6 }, |
| 92 | ], |
| 93 | truncated: false, |
| 94 | visited: 2, |
| 95 | }; |
| 96 | } |
| 97 | |
| 98 | describe('unfolding a closure into a walk', () => { |
| 99 | const nodes = flowNodes(CLOSURE); |
no test coverage detected