| 1251 | |
| 1252 | /** Index `before`, write `after`, sync, and compare with a fresh index of `after`. */ |
| 1253 | const syncs = async (before: Record<string, string>, after: Record<string, string>, removed: string[] = []): Promise<string[]> => { |
| 1254 | const root = project(before); |
| 1255 | const cg = await opened(root); |
| 1256 | write(root, after); |
| 1257 | for (const file of removed) fs.rmSync(path.join(root, file)); |
| 1258 | await cg.sync(); |
| 1259 | const fresh = await indexed(Object.fromEntries( |
| 1260 | Object.entries({ ...before, ...after }).filter(([file]) => !removed.includes(file)))); |
| 1261 | expect(asText(cg)).toEqual(asText(fresh)); |
| 1262 | return reached(cg, 'Mixin::Add'); |
| 1263 | }; |
| 1264 | |
| 1265 | it('an instantiation added in a third file', async () => { |
| 1266 | expect(await syncs(BASE, { 'added.cc': lines('#include "mixin.h"', 'Mixin<FancyTxn> added;') })) |