Skip to content

Commit 226e1f8

Browse files
authored
Remove Expand Macro Test (#1324)
Currently, it seems like the Expand Macros test has some issues that makes it fail intermittently when run on GitHub actions. These issues seem to be hard to reproduce and likely require simplifying the dependencies the test depends on. Remove the test until there is a better way to test this to avoid noise. Issue: #1315
1 parent 9b72ee5 commit 226e1f8

File tree

5 files changed

+2
-171
lines changed

5 files changed

+2
-171
lines changed

assets/test/swift-macro/Package.swift

Lines changed: 0 additions & 42 deletions
This file was deleted.

assets/test/swift-macro/Sources/swift-macro/swift_macro.swift

Lines changed: 0 additions & 11 deletions
This file was deleted.

assets/test/swift-macro/Sources/swift-macroClient/main.swift

Lines changed: 0 additions & 8 deletions
This file was deleted.

assets/test/swift-macro/Sources/swift-macroMacros/swift_macroMacro.swift

Lines changed: 0 additions & 33 deletions
This file was deleted.

test/integration-tests/language/LanguageClientIntegration.test.ts

Lines changed: 2 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,8 @@ import { WorkspaceContext } from "../../../src/WorkspaceContext";
2020
import { testAssetUri } from "../../fixtures";
2121
import { executeTaskAndWaitForResult, waitForNoRunningTasks } from "../../utilities/tasks";
2222
import { getBuildAllTask, SwiftTask } from "../../../src/tasks/SwiftTaskProvider";
23-
import { Version } from "../../../src/utilities/version";
2423
import { activateExtensionForSuite, folderInRootWorkspace } from "../utilities/testutilities";
25-
import { FolderContext } from "../../../src/FolderContext";
26-
import { waitForClientState, waitForCodeActions, waitForIndex } from "../utilities/lsputilities";
24+
import { waitForClientState, waitForIndex } from "../utilities/lsputilities";
2725

2826
async function buildProject(ctx: WorkspaceContext, name: string) {
2927
await waitForNoRunningTasks();
@@ -35,20 +33,15 @@ async function buildProject(ctx: WorkspaceContext, name: string) {
3533
}
3634

3735
suite("Language Client Integration Suite @slow", function () {
38-
this.timeout(5 * 60 * 1000);
36+
this.timeout(2 * 60 * 1000);
3937

4038
let clientManager: LanguageClientManager;
4139
let workspaceContext: WorkspaceContext;
42-
let macroFolderContext: FolderContext;
4340

4441
activateExtensionForSuite({
4542
async setup(ctx) {
4643
workspaceContext = ctx;
4744

48-
// Wait for a clean starting point, and build all tasks for the fixture
49-
if (workspaceContext.swiftVersion.isGreaterThanOrEqual(new Version(6, 1, 0))) {
50-
macroFolderContext = await buildProject(ctx, "swift-macro");
51-
}
5245
await buildProject(ctx, "defaultPackage");
5346

5447
// Ensure lsp client is ready
@@ -61,74 +54,6 @@ suite("Language Client Integration Suite @slow", function () {
6154
await waitForIndex(workspaceContext.languageClientManager);
6255
});
6356

64-
test("Expand Macro", async function () {
65-
// Expand Macro support in Swift started from 6.1
66-
if (workspaceContext.swiftVersion.isLessThan(new Version(6, 1, 0))) {
67-
this.skip();
68-
}
69-
70-
// Focus on the file of interest
71-
const uri = testAssetUri("swift-macro/Sources/swift-macroClient/main.swift");
72-
await vscode.window.showTextDocument(uri);
73-
await workspaceContext.focusFolder(macroFolderContext);
74-
75-
// Beginning of macro, #
76-
const position = new vscode.Position(5, 21);
77-
78-
// Create a range starting and ending at the specified position
79-
const range = new vscode.Selection(position, position.with({ character: 22 }));
80-
81-
await waitForCodeActions(workspaceContext.languageClientManager, uri, range);
82-
83-
// Execute the code action provider command
84-
const codeActions = await vscode.commands.executeCommand<vscode.CodeAction[]>(
85-
"vscode.executeCodeActionProvider",
86-
uri,
87-
range
88-
);
89-
90-
// Find the "expand.macro.command" action
91-
const expandMacroAction = codeActions.find(
92-
action => action.command?.command === "expand.macro.command"
93-
);
94-
95-
// Assert that the expand macro command is available
96-
expect(expandMacroAction).is.not.undefined;
97-
98-
// Set up a promise that resolves when the expected document is opened
99-
const expandedMacroUriPromise = new Promise<vscode.TextDocument>((resolve, reject) => {
100-
const disposable = vscode.workspace.onDidOpenTextDocument(openedDocument => {
101-
if (openedDocument.uri.scheme === "sourcekit-lsp") {
102-
disposable.dispose(); // Stop listening once we find the desired document
103-
resolve(openedDocument);
104-
}
105-
});
106-
107-
// Set a timeout to reject the promise if the document is not found
108-
setTimeout(() => {
109-
disposable.dispose();
110-
reject(new Error("Timed out waiting for sourcekit-lsp document to be opened."));
111-
}, 10000); // Wait up to 10 seconds for the document
112-
});
113-
114-
// Run expand macro action
115-
const command = expandMacroAction!.command!;
116-
expect(command.arguments).is.not.undefined;
117-
const commandArgs = command.arguments!;
118-
await vscode.commands.executeCommand(command.command, ...commandArgs);
119-
120-
// Wait for the expanded macro document to be opened
121-
const referenceDocument = await expandedMacroUriPromise;
122-
123-
// Verify that the reference document was successfully opened
124-
expect(referenceDocument).to.not.be.undefined;
125-
126-
// Assert that the content contains the expected result
127-
const expectedMacro = '(a + b, "a + b")';
128-
const content = referenceDocument.getText();
129-
expect(content).to.include(expectedMacro);
130-
});
131-
13257
suite("Symbols", () => {
13358
const uri = testAssetUri("defaultPackage/Sources/PackageExe/main.swift");
13459
const expectedDefinitionUri = testAssetUri(

0 commit comments

Comments
 (0)