Skip to content

Commit 8207047

Browse files
committed
Integration test to make sure search exclusion works
1 parent 6da80aa commit 8207047

File tree

4 files changed

+57
-1
lines changed

4 files changed

+57
-1
lines changed

assets/test/.vscode/settings.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,8 @@
1010
"lldb.verboseLogging": true,
1111
"lldb.launch.terminal": "external",
1212
"lldb-dap.detachOnError": true,
13-
"swift.sourcekit-lsp.backgroundIndexing": "off"
13+
"swift.sourcekit-lsp.backgroundIndexing": "off",
14+
"swift.exclude": {
15+
"**/excluded": true
16+
}
1417
}

assets/test/excluded/Package.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// swift-tools-version: 5.6
2+
// The swift-tools-version declares the minimum version of Swift required to build this package.
3+
4+
import PackageDescription
5+
6+
let package = Package(
7+
name: "excluded",
8+
products: [
9+
.library(name: "excluded", targets: ["excluded"]),
10+
],
11+
dependencies: [],
12+
targets: [
13+
.target(name: "excluded"),
14+
]
15+
)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
public struct excluded {
2+
public private(set) var text = "Hello, World!"
3+
4+
public init() {
5+
}
6+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// This source file is part of the VS Code Swift open source project
4+
//
5+
// Copyright (c) 2024 the VS Code Swift project authors
6+
// Licensed under Apache License v2.0
7+
//
8+
// See LICENSE.txt for license information
9+
// See CONTRIBUTORS.txt for the list of VS Code Swift project authors
10+
//
11+
// SPDX-License-Identifier: Apache-2.0
12+
//
13+
//===----------------------------------------------------------------------===//
14+
15+
import * as vscode from "vscode";
16+
import { searchForPackages } from "../../../src/utilities/workspace";
17+
import { expect } from "chai";
18+
19+
suite("Workspace Utilities Test Suite", () => {
20+
suite("searchForPackages", () => {
21+
test("ignores excluded file", async () => {
22+
const folders = await searchForPackages(
23+
(vscode.workspace.workspaceFolders ?? [])[0]!.uri,
24+
false,
25+
true
26+
);
27+
28+
expect(folders.find(f => f.fsPath.includes("defaultPackage"))).to.not.be.undefined;
29+
expect(folders.find(f => f.fsPath.includes("excluded"))).to.be.undefined;
30+
});
31+
});
32+
});

0 commit comments

Comments
 (0)