2022-05-17 12:15:06 -05:00
|
|
|
import * as assert from "assert";
|
|
|
|
import { Cargo } from "../../src/toolchain";
|
2023-07-10 16:10:00 -05:00
|
|
|
import type { Context } from ".";
|
2020-05-20 13:03:49 -05:00
|
|
|
|
2021-12-02 00:20:10 -06:00
|
|
|
export async function getTests(ctx: Context) {
|
2022-05-17 12:15:06 -05:00
|
|
|
await ctx.suite("Launch configuration/Lens", (suite) => {
|
|
|
|
suite.addTest("A binary", async () => {
|
|
|
|
const args = Cargo.artifactSpec([
|
|
|
|
"build",
|
|
|
|
"--package",
|
|
|
|
"pkg_name",
|
|
|
|
"--bin",
|
|
|
|
"pkg_name",
|
|
|
|
]);
|
2020-05-20 13:03:49 -05:00
|
|
|
|
2022-05-17 12:15:06 -05:00
|
|
|
assert.deepStrictEqual(args.cargoArgs, [
|
|
|
|
"build",
|
|
|
|
"--package",
|
|
|
|
"pkg_name",
|
|
|
|
"--bin",
|
|
|
|
"pkg_name",
|
|
|
|
"--message-format=json",
|
|
|
|
]);
|
2021-11-07 02:00:58 -06:00
|
|
|
assert.deepStrictEqual(args.filter, undefined);
|
2020-05-20 13:03:49 -05:00
|
|
|
});
|
|
|
|
|
2022-05-17 12:15:06 -05:00
|
|
|
suite.addTest("One of Multiple Binaries", async () => {
|
2020-05-30 21:13:08 -05:00
|
|
|
const args = Cargo.artifactSpec(["build", "--package", "pkg_name", "--bin", "bin1"]);
|
2020-05-20 13:03:49 -05:00
|
|
|
|
2022-05-17 12:15:06 -05:00
|
|
|
assert.deepStrictEqual(args.cargoArgs, [
|
|
|
|
"build",
|
|
|
|
"--package",
|
|
|
|
"pkg_name",
|
|
|
|
"--bin",
|
|
|
|
"bin1",
|
|
|
|
"--message-format=json",
|
|
|
|
]);
|
2021-11-07 02:00:58 -06:00
|
|
|
assert.deepStrictEqual(args.filter, undefined);
|
2020-05-20 13:03:49 -05:00
|
|
|
});
|
|
|
|
|
2022-05-17 12:15:06 -05:00
|
|
|
suite.addTest("A test", async () => {
|
2020-05-30 21:13:08 -05:00
|
|
|
const args = Cargo.artifactSpec(["test", "--package", "pkg_name", "--lib", "--no-run"]);
|
2020-05-20 13:03:49 -05:00
|
|
|
|
2022-05-17 12:15:06 -05:00
|
|
|
assert.deepStrictEqual(args.cargoArgs, [
|
|
|
|
"test",
|
|
|
|
"--package",
|
|
|
|
"pkg_name",
|
|
|
|
"--lib",
|
|
|
|
"--no-run",
|
|
|
|
"--message-format=json",
|
|
|
|
]);
|
2021-11-07 02:00:58 -06:00
|
|
|
assert.notDeepStrictEqual(args.filter, undefined);
|
2020-05-20 13:03:49 -05:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2022-05-17 12:15:06 -05:00
|
|
|
await ctx.suite("Launch configuration/QuickPick", (suite) => {
|
|
|
|
suite.addTest("A binary", async () => {
|
2020-05-30 21:13:08 -05:00
|
|
|
const args = Cargo.artifactSpec(["run", "--package", "pkg_name", "--bin", "pkg_name"]);
|
2020-05-20 13:03:49 -05:00
|
|
|
|
2022-05-17 12:15:06 -05:00
|
|
|
assert.deepStrictEqual(args.cargoArgs, [
|
|
|
|
"build",
|
|
|
|
"--package",
|
|
|
|
"pkg_name",
|
|
|
|
"--bin",
|
|
|
|
"pkg_name",
|
|
|
|
"--message-format=json",
|
|
|
|
]);
|
2021-11-07 02:00:58 -06:00
|
|
|
assert.deepStrictEqual(args.filter, undefined);
|
2020-05-20 13:03:49 -05:00
|
|
|
});
|
|
|
|
|
2022-05-17 12:15:06 -05:00
|
|
|
suite.addTest("One of Multiple Binaries", async () => {
|
2020-05-30 21:13:08 -05:00
|
|
|
const args = Cargo.artifactSpec(["run", "--package", "pkg_name", "--bin", "bin2"]);
|
2020-05-20 13:03:49 -05:00
|
|
|
|
2022-05-17 12:15:06 -05:00
|
|
|
assert.deepStrictEqual(args.cargoArgs, [
|
|
|
|
"build",
|
|
|
|
"--package",
|
|
|
|
"pkg_name",
|
|
|
|
"--bin",
|
|
|
|
"bin2",
|
|
|
|
"--message-format=json",
|
|
|
|
]);
|
2021-11-07 02:00:58 -06:00
|
|
|
assert.deepStrictEqual(args.filter, undefined);
|
2020-05-20 13:03:49 -05:00
|
|
|
});
|
|
|
|
|
2022-05-17 12:15:06 -05:00
|
|
|
suite.addTest("A test", async () => {
|
2020-05-30 21:13:08 -05:00
|
|
|
const args = Cargo.artifactSpec(["test", "--package", "pkg_name", "--lib"]);
|
2020-05-20 13:03:49 -05:00
|
|
|
|
2022-05-17 12:15:06 -05:00
|
|
|
assert.deepStrictEqual(args.cargoArgs, [
|
|
|
|
"test",
|
|
|
|
"--package",
|
|
|
|
"pkg_name",
|
|
|
|
"--lib",
|
|
|
|
"--message-format=json",
|
|
|
|
"--no-run",
|
|
|
|
]);
|
2021-11-07 02:00:58 -06:00
|
|
|
assert.notDeepStrictEqual(args.filter, undefined);
|
2020-05-20 13:03:49 -05:00
|
|
|
});
|
|
|
|
});
|
2021-12-02 00:20:10 -06:00
|
|
|
}
|