(path: string, content: string, changes: Change[])
| 26 | } |
| 27 | |
| 28 | function applyChanges(path: string, content: string, changes: Change[]): string { |
| 29 | const tree = new HostTree(); |
| 30 | tree.create(path, content); |
| 31 | const exportRecorder = tree.beginUpdate(path); |
| 32 | for (const change of changes) { |
| 33 | if (change instanceof InsertChange) { |
| 34 | exportRecorder.insertLeft(change.pos, change.toAdd); |
| 35 | } |
| 36 | } |
| 37 | tree.commitUpdate(exportRecorder); |
| 38 | |
| 39 | return tree.readText(path); |
| 40 | } |
| 41 | |
| 42 | describe('ast utils', () => { |
| 43 | let modulePath: string; |
no test coverage detected