Skip to content

Commit b5526ba

Browse files
committed
Merge branch 'topic/gnattest-tests' into 'master'
Implement GNATtest vscode integration tests See merge request eng/ide/ada_language_server!1506
2 parents 16eb5cb + 9cb5ede commit b5526ba

17 files changed

+789
-21
lines changed

integration/vscode/ada/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -881,8 +881,8 @@
881881
"compile": "node ./node_modules/typescript/bin/tsc",
882882
"watch": "node ./node_modules/typescript/bin/tsc -watch",
883883
"pretest": "npm run compile",
884-
"lint": "eslint \"./src/**/*.{js,ts,tsx}\" --quiet --fix",
885-
"cilint": "eslint \"./src/**/*.{js,ts,tsx}\"",
884+
"lint": "eslint \"./src/**/*.{js,ts,tsx}\" \"./test/**/*.{js,ts,tsx}\" --quiet --fix",
885+
"cilint": "eslint \"./src/**/*.{js,ts,tsx}\" \"./test/**/*.{js,ts,tsx}\"",
886886
"test": "vscode-test",
887887
"resolve-backtrace": "npx stacktracify",
888888
"clean": "node -e \"fs.rmSync('out',{force:true,recursive:true})\""

integration/vscode/ada/src/gnattest.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export function initializeTesting(context: vscode.ExtensionContext): vscode.Test
123123
/**
124124
* Reset and recreate the tree of TestItems based on the GNATtest XML.
125125
*/
126-
async function refreshTestItemTree() {
126+
export async function refreshTestItemTree() {
127127
controller.items.replace([]);
128128
testData.clear();
129129
await addTestsRootLevel();
@@ -142,7 +142,7 @@ async function getGnatTestXmlPath(): Promise<string> {
142142
*
143143
* @returns the full path to the GNATtest test driver GPR project.
144144
*/
145-
async function getGnatTestDriverProjectPath(): Promise<string> {
145+
export async function getGnatTestDriverProjectPath(): Promise<string> {
146146
const objDir = await getObjectDir();
147147
const testDriverPath = path.join(objDir, 'gnattest', 'harness', 'test_driver.gpr');
148148
return testDriverPath;
@@ -152,7 +152,7 @@ async function getGnatTestDriverProjectPath(): Promise<string> {
152152
*
153153
* @returns the full path to the GNATtest test driver executable.
154154
*/
155-
async function getGnatTestDriverExecPath(): Promise<string> {
155+
export async function getGnatTestDriverExecPath(): Promise<string> {
156156
const objDir = await getObjectDir();
157157
const testDriverPath = path.join(objDir, 'gnattest', 'harness', 'test_runner' + exe);
158158
return testDriverPath;
@@ -399,7 +399,7 @@ export function pathIsReadable(p: string): boolean {
399399
* @param item - the TestItem whose children must be computed, or `undefined` if
400400
* we should compute the root items of the tree.
401401
*/
402-
async function resolveHandler(
402+
export async function resolveHandler(
403403
item: TestItem | undefined,
404404
recursive = false,
405405
token?: CancellationToken
@@ -470,7 +470,7 @@ function configureTestExecution(controller: vscode.TestController) {
470470
* @param request - the request based on the User selections
471471
* @param token - a cancellation token
472472
*/
473-
async function runHandler(request: vscode.TestRunRequest, token: vscode.CancellationToken) {
473+
export async function runHandler(request: vscode.TestRunRequest, token?: vscode.CancellationToken) {
474474
if ((request.include?.length ?? 0) === 0 && (request.exclude?.length ?? 0) === 0) {
475475
/**
476476
* Run all tests. This ignores request.exclude which is why we only use
@@ -490,7 +490,7 @@ async function runHandler(request: vscode.TestRunRequest, token: vscode.Cancella
490490
* controller.items) and request.exclude. It then runs the test driver for each
491491
* test, using the --routines argument at each run to select a specific test.
492492
*/
493-
async function handleRunRequestedTests(request: vscode.TestRunRequest, token: CancellationToken) {
493+
async function handleRunRequestedTests(request: vscode.TestRunRequest, token?: CancellationToken) {
494494
const run = controller.createTestRun(request, undefined, false);
495495
try {
496496
const requestedRootTests = [];
@@ -580,7 +580,7 @@ function prepareAndAppendOutput(run: vscode.TestRun, out: string) {
580580
* in {@link handleRunRequestedTests} fails because of GNATtest shortcomings, we
581581
* still have this approach of running all tests as a backup.
582582
*/
583-
async function handleRunAll(request: vscode.TestRunRequest, token: CancellationToken) {
583+
async function handleRunAll(request: vscode.TestRunRequest, token?: CancellationToken) {
584584
const run = controller.createTestRun(request, undefined, false);
585585
try {
586586
/**
@@ -687,7 +687,7 @@ async function buildTestDriver(run: vscode.TestRun) {
687687
* @param duration - the duration of execution of the test to be reported along
688688
* with the outcome, if the information is available.
689689
*/
690-
function determineTestOutcome(
690+
export function determineTestOutcome(
691691
test: vscode.TestItem,
692692
driverOutput: string,
693693
run: vscode.TestRun,
@@ -763,7 +763,7 @@ function determineTestOutcome(
763763
* @param token - a cancellation token to stop the traversal
764764
* @returns the array of leaf TestItems reachable from the given collection.
765765
*/
766-
function collectLeafsFromCollection(
766+
export function collectLeafsFromCollection(
767767
items: vscode.TestItemCollection,
768768
token?: CancellationToken
769769
): vscode.TestItem[] {
@@ -783,7 +783,7 @@ function collectLeafsFromCollection(
783783
* @param token - a cancellation token to stop the traversal
784784
* @returns the array of leaf TestItems reachable from the given TestItem
785785
*/
786-
function collectLeafItems(item: TestItem, token?: CancellationToken): vscode.TestItem[] {
786+
export function collectLeafItems(item: TestItem, token?: CancellationToken): vscode.TestItem[] {
787787
if (item.children.size > 0) {
788788
const res: vscode.TestItem[] = [];
789789
item.children.forEach((i) => {

integration/vscode/ada/src/taskProviders.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
import assert from 'assert';
1919
import commandExists from 'command-exists';
2020
import * as vscode from 'vscode';
21-
import { adaExtState, logger } from './extension';
22-
import { AdaMain, getAdaMains, getProjectFile, getSymbols } from './helpers';
2321
import { SymbolKind } from 'vscode';
22+
import { adaExtState } from './extension';
23+
import { AdaMain, getAdaMains, getProjectFile, getSymbols } from './helpers';
2424

2525
export const ADA_TASK_TYPE = 'ada';
2626

0 commit comments

Comments
 (0)