Skip to content
This repository was archived by the owner on Nov 18, 2022. It is now read-only.

Commit 001d117

Browse files
committed
Test that we detect and start RLS for multiple folders
1 parent 7a35fe7 commit 001d117

File tree

3 files changed

+32
-5
lines changed

3 files changed

+32
-5
lines changed
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[package]
2+
name = "bare-lib-project"
3+
version = "0.1.0"
4+
authors = ["Example <[email protected]>"]
5+
edition = "2018"
6+
7+
[dependencies]
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#[cfg(test)]
2+
mod tests {
3+
#[test]
4+
fn it_works() {
5+
assert_eq!(2 + 2, 4);
6+
}
7+
}

test/suite/extension.test.ts

+18-5
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,24 @@ const fixtureDir = path.resolve(
1010

1111
suite('Extension Tests', () => {
1212
test('cargo tasks are auto-detected', async () => {
13-
const projectPath = path.join(fixtureDir, 'bare-lib-project');
13+
const projectPath = fixtureDir;
1414
const projectUri = Uri.file(projectPath);
15+
const projects = [
16+
path.join(projectPath, 'bare-lib-project'),
17+
path.join(projectPath, 'another-lib-project'),
18+
];
1519

1620
await vscode.commands.executeCommand('vscode.openFolder', projectUri);
1721
await vscode.workspace.openTextDocument(
18-
Uri.file(path.join(projectPath, 'src', 'lib.rs')),
22+
Uri.file(path.join(projects[0], 'src', 'lib.rs')),
23+
);
24+
await vscode.workspace.openTextDocument(
25+
Uri.file(path.join(projects[1], 'src', 'lib.rs')),
1926
);
2027

2128
const expected = [
22-
{ subcommand: 'build', group: vscode.TaskGroup.Build },
29+
{ subcommand: 'build', group: vscode.TaskGroup.Build, cwd: projects[0] },
30+
{ subcommand: 'build', group: vscode.TaskGroup.Build, cwd: projects[1] },
2331
{ subcommand: 'check', group: vscode.TaskGroup.Build },
2432
{ subcommand: 'test', group: vscode.TaskGroup.Test },
2533
{ subcommand: 'clean', group: vscode.TaskGroup.Clean },
@@ -28,13 +36,18 @@ suite('Extension Tests', () => {
2836

2937
const tasks = await vscode.tasks.fetchTasks();
3038

31-
for (const { subcommand, group } of expected) {
39+
for (const { subcommand, group, cwd } of expected) {
3240
assert(
3341
tasks.some(
3442
task =>
3543
task.definition.type === 'cargo' &&
3644
task.definition.subcommand === subcommand &&
37-
task.group === group,
45+
task.group === group &&
46+
(!cwd ||
47+
cwd ===
48+
(task.execution &&
49+
task.execution.options &&
50+
task.execution.options.cwd)),
3851
),
3952
);
4053
}

0 commit comments

Comments
 (0)