From 7094c02f2e1ed11dc95835191858cee883f63def Mon Sep 17 00:00:00 2001 From: Nicolas Setton Date: Tue, 23 Jul 2024 08:14:42 +0000 Subject: [PATCH] Minor edit: remove eslint warnings Slightly refactor the testing code to avoid warnings of the form 40:44 warning Forbidden non-null assertion @typescript-eslint/no-non-null-assertion --- integration/vscode/ada/test/suite/general/helpers.test.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/integration/vscode/ada/test/suite/general/helpers.test.ts b/integration/vscode/ada/test/suite/general/helpers.test.ts index 535e034fb..20cb66367 100644 --- a/integration/vscode/ada/test/suite/general/helpers.test.ts +++ b/integration/vscode/ada/test/suite/general/helpers.test.ts @@ -29,13 +29,17 @@ suite('which and envHasExec', function () { suite('findAdaMain', function () { test('Find one main (simple case)', async function () { /* Test that findAdaMain works in a simple case */ - const uri = Uri.joinPath(workspace.workspaceFolders![0].uri, 'src', 'main1.adb'); + const folders = workspace.workspaceFolders; + assert(folders && folders.length > 0); + const uri = Uri.joinPath(folders[0].uri, 'src', 'main1.adb'); const adaMain = await findAdaMain(uri.fsPath); assert(adaMain); }); test('Find one main (case sensitivity)', async function () { /* Test the behavior of findAdaMain with respect to case sensitivity */ - const uri_uppercase = Uri.joinPath(workspace.workspaceFolders![0].uri, 'src', 'MAIN1.ADB'); + const folders = workspace.workspaceFolders; + assert(folders && folders.length > 0); + const uri_uppercase = Uri.joinPath(folders[0].uri, 'src', 'MAIN1.ADB'); const adaMain_from_uppercase = await findAdaMain(uri_uppercase.fsPath); /* On Windows we should have a main here, otherwise we should not */