|
| 1 | +/* eslint-disable max-len */ |
| 2 | +import assert from 'assert'; |
| 3 | +import path from 'path'; |
| 4 | +import { exe, getProjectFile } from '../../src/helpers'; |
| 5 | +import { createAdaTaskProvider } from '../../src/taskProviders'; |
| 6 | +import { activate, getCommandLines, isCoreTask } from '../utils'; |
| 7 | + |
| 8 | +suite('Aggregate Projects Support', function () { |
| 9 | + // Set timeout to 15 seconds unless already configured to more |
| 10 | + this.timeout(Math.max(this.timeout(), 15000)); |
| 11 | + |
| 12 | + let projectPath: string; |
| 13 | + |
| 14 | + this.beforeAll(async () => { |
| 15 | + await activate(); |
| 16 | + projectPath = await getProjectFile(); |
| 17 | + }); |
| 18 | + |
| 19 | + /** |
| 20 | + * Check that the list of offered Ada tasks is expected for |
| 21 | + * aggregate projects, in particular we should offer tasks to |
| 22 | + * build and run the mains of all aggregated projects. |
| 23 | + */ |
| 24 | + test('Ada tasks for aggregate projects', async () => { |
| 25 | + const expectedCmdLines = ` |
| 26 | +ada: Clean current project - gprclean -P ${projectPath} |
| 27 | +ada: Build current project - gprbuild -P ${projectPath} '-cargs:ada' -gnatef |
| 28 | +ada: Check current file - gprbuild -q -f -c -u -gnatc -P ${projectPath} \${fileBasename} '-cargs:ada' -gnatef |
| 29 | +ada: Compile current file - gprbuild -q -f -c -u -P ${projectPath} \${fileBasename} '-cargs:ada' -gnatef |
| 30 | +ada: Generate documentation from the project - gnatdoc -P ${projectPath} |
| 31 | +ada: Build main - src/main_1.adb - gprbuild -P ${projectPath} src/main_1.adb '-cargs:ada' -gnatef |
| 32 | +ada: Run main - src/main_1.adb - .${path.sep}main1exec${exe} |
| 33 | +ada: Build main - src/main_2.adb - gprbuild -P ${projectPath} src/main_2.adb '-cargs:ada' -gnatef |
| 34 | +ada: Run main - src/main_2.adb - .${path.sep}main2exec${exe} |
| 35 | +ada: Build main - src/main_3.adb - gprbuild -P ${projectPath} src/main_3.adb '-cargs:ada' -gnatef |
| 36 | +ada: Run main - src/main_3.adb - .${path.sep}main3exec${exe} |
| 37 | +`.trim(); |
| 38 | + |
| 39 | + const prov = createAdaTaskProvider(); |
| 40 | + /** |
| 41 | + * Exclude GNAT SAS tasks because they are tested in integration-testsuite. |
| 42 | + */ |
| 43 | + const actualCommandLines = await getCommandLines(prov, isCoreTask); |
| 44 | + assert.equal(actualCommandLines, expectedCmdLines); |
| 45 | + }); |
| 46 | +}); |
0 commit comments