aboutsummaryrefslogtreecommitdiff
path: root/editors/code/tests/unit/launch_config.test.ts
blob: 68794d53ede11b9c1f062500460d24f7b2f99470 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import * as assert from 'assert';
import { Cargo } from '../../src/toolchain';

suite('Launch configuration', () => {

    suite('Lens', () => {
        test('A binary', async () => {
            const args = Cargo.artifactSpec(["build", "--package", "pkg_name", "--bin", "pkg_name"]);

            assert.deepEqual(args.cargoArgs, ["build", "--package", "pkg_name", "--bin", "pkg_name", "--message-format=json"]);
            assert.deepEqual(args.filter, undefined);
        });

        test('One of Multiple Binaries', async () => {
            const args = Cargo.artifactSpec(["build", "--package", "pkg_name", "--bin", "bin1"]);

            assert.deepEqual(args.cargoArgs, ["build", "--package", "pkg_name", "--bin", "bin1", "--message-format=json"]);
            assert.deepEqual(args.filter, undefined);
        });

        test('A test', async () => {
            const args = Cargo.artifactSpec(["test", "--package", "pkg_name", "--lib", "--no-run"]);

            assert.deepEqual(args.cargoArgs, ["test", "--package", "pkg_name", "--lib", "--no-run", "--message-format=json"]);
            assert.notDeepEqual(args.filter, undefined);
        });
    });

    suite('QuickPick', () => {
        test('A binary', async () => {
            const args = Cargo.artifactSpec(["run", "--package", "pkg_name", "--bin", "pkg_name"]);

            assert.deepEqual(args.cargoArgs, ["build", "--package", "pkg_name", "--bin", "pkg_name", "--message-format=json"]);
            assert.deepEqual(args.filter, undefined);
        });


        test('One of Multiple Binaries', async () => {
            const args = Cargo.artifactSpec(["run", "--package", "pkg_name", "--bin", "bin2"]);

            assert.deepEqual(args.cargoArgs, ["build", "--package", "pkg_name", "--bin", "bin2", "--message-format=json"]);
            assert.deepEqual(args.filter, undefined);
        });

        test('A test', async () => {
            const args = Cargo.artifactSpec(["test", "--package", "pkg_name", "--lib"]);

            assert.deepEqual(args.cargoArgs, ["test", "--package", "pkg_name", "--lib", "--message-format=json", "--no-run"]);
            assert.notDeepEqual(args.filter, undefined);
        });
    });
});