Skip to content

Commit e0dcbf9

Browse files
authored
Merge pull request #170 from vim-denops/fix-test
🌿 Fix performance of tests on Windows
2 parents 2bd6c4c + c095020 commit e0dcbf9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+2877
-2743
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ jobs:
2424
runner:
2525
- ubuntu-latest
2626
version:
27-
- "1.17.1"
2827
- "1.x"
2928
runs-on: ${{ matrix.runner }}
3029
steps:
@@ -97,8 +96,7 @@ jobs:
9796
- name: Test
9897
run: make test
9998
env:
100-
DENOPS_PATH: "../denops.vim"
101-
DENOPS_TEST_VIM: ${{ steps.vim.outputs.executable_path }}
102-
DENOPS_TEST_NVIM: ${{ steps.nvim.outputs.executable_path }}
103-
timeout-minutes: 10
99+
DENOPS_TEST_DENOPS_PATH: "../denops.vim"
100+
DENOPS_TEST_VIM_EXECUTABLE: ${{ steps.vim.outputs.executable_path }}
101+
DENOPS_TEST_NVIM_EXECUTABLE: ${{ steps.nvim.outputs.executable_path }}
104102
working-directory: ./repo

denops_std/anonymous/mod.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Denops } from "https://deno.land/x/denops_core@v3.3.0/mod.ts";
1+
import type { Denops } from "https://deno.land/x/denops_core@v3.4.1/mod.ts";
22

33
// https://github.com/microsoft/TypeScript/issues/26223#issuecomment-674500430
44
export type TupleOf<T, N extends number> = N extends N

denops_std/anonymous/mod_test.ts

Lines changed: 83 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,97 +1,98 @@
11
import {
22
assertEquals,
33
assertRejects,
4-
} from "https://deno.land/std@0.167.0/testing/asserts.ts";
5-
import { test } from "../test/mod.ts";
4+
} from "https://deno.land/std@0.170.0/testing/asserts.ts";
5+
import { test } from "https://deno.land/x/denops_test@v1.0.1/mod.ts";
66
import * as anonymous from "./mod.ts";
77

88
test({
99
mode: "all",
10-
name: "add() registers anonymous functions",
11-
fn: async (denops) => {
12-
const ids = anonymous.add(
13-
denops,
14-
() => Promise.resolve("0"),
15-
() => Promise.resolve("1"),
16-
() => Promise.resolve("2"),
17-
);
18-
assertEquals(await denops.dispatch(denops.name, ids[0]), "0");
19-
assertEquals(await denops.dispatch(denops.name, ids[1]), "1");
20-
assertEquals(await denops.dispatch(denops.name, ids[2]), "2");
21-
assertEquals(await denops.dispatch(denops.name, ids[0]), "0");
22-
assertEquals(await denops.dispatch(denops.name, ids[1]), "1");
23-
assertEquals(await denops.dispatch(denops.name, ids[2]), "2");
24-
},
25-
});
10+
name: "anonymous",
11+
fn: async (denops, t) => {
12+
await t.step({
13+
name: "add() registers anonymous functions",
14+
fn: async () => {
15+
const ids = anonymous.add(
16+
denops,
17+
() => Promise.resolve("0"),
18+
() => Promise.resolve("1"),
19+
() => Promise.resolve("2"),
20+
);
21+
assertEquals(await denops.dispatch(denops.name, ids[0]), "0");
22+
assertEquals(await denops.dispatch(denops.name, ids[1]), "1");
23+
assertEquals(await denops.dispatch(denops.name, ids[2]), "2");
24+
assertEquals(await denops.dispatch(denops.name, ids[0]), "0");
25+
assertEquals(await denops.dispatch(denops.name, ids[1]), "1");
26+
assertEquals(await denops.dispatch(denops.name, ids[2]), "2");
27+
},
28+
});
2629

27-
test({
28-
mode: "all",
29-
name: "once() registers oneshot anonymous functions",
30-
fn: async (denops) => {
31-
const ids = anonymous.once(
32-
denops,
33-
() => Promise.resolve("0"),
34-
() => Promise.resolve("1"),
35-
() => Promise.resolve("2"),
36-
);
37-
assertEquals(await denops.dispatch(denops.name, ids[0]), "0");
38-
assertEquals(await denops.dispatch(denops.name, ids[1]), "1");
39-
assertEquals(await denops.dispatch(denops.name, ids[2]), "2");
30+
await t.step({
31+
name: "once() registers oneshot anonymous functions",
32+
fn: async () => {
33+
const ids = anonymous.once(
34+
denops,
35+
() => Promise.resolve("0"),
36+
() => Promise.resolve("1"),
37+
() => Promise.resolve("2"),
38+
);
39+
assertEquals(await denops.dispatch(denops.name, ids[0]), "0");
40+
assertEquals(await denops.dispatch(denops.name, ids[1]), "1");
41+
assertEquals(await denops.dispatch(denops.name, ids[2]), "2");
4042

41-
// The method will be removed
42-
await assertRejects(
43-
async () => {
44-
await denops.dispatch(denops.name, ids[0]);
45-
},
46-
`No method '${ids[0]}' exists`,
47-
);
48-
await assertRejects(
49-
async () => {
50-
await denops.dispatch(denops.name, ids[1]);
51-
},
52-
`No method '${ids[1]}' exists`,
53-
);
54-
await assertRejects(
55-
async () => {
56-
await denops.dispatch(denops.name, ids[2]);
43+
// The method will be removed
44+
await assertRejects(
45+
async () => {
46+
await denops.dispatch(denops.name, ids[0]);
47+
},
48+
`No method '${ids[0]}' exists`,
49+
);
50+
await assertRejects(
51+
async () => {
52+
await denops.dispatch(denops.name, ids[1]);
53+
},
54+
`No method '${ids[1]}' exists`,
55+
);
56+
await assertRejects(
57+
async () => {
58+
await denops.dispatch(denops.name, ids[2]);
59+
},
60+
`No method '${ids[2]}' exists`,
61+
);
5762
},
58-
`No method '${ids[2]}' exists`,
59-
);
60-
},
61-
prelude: ["let g:denops#enable_workaround_vim_before_8_2_3081 = 1"],
62-
});
63+
});
6364

64-
test({
65-
mode: "all",
66-
name: "remove() unregisters anonymous functions identified by ids",
67-
fn: async (denops) => {
68-
const ids = anonymous.add(
69-
denops,
70-
() => Promise.resolve("0"),
71-
() => Promise.resolve("1"),
72-
() => Promise.resolve("2"),
73-
);
74-
assertEquals(anonymous.remove(denops, ...ids), [true, true, true]);
65+
await t.step({
66+
name: "remove() unregisters anonymous functions identified by ids",
67+
fn: async () => {
68+
const ids = anonymous.add(
69+
denops,
70+
() => Promise.resolve("0"),
71+
() => Promise.resolve("1"),
72+
() => Promise.resolve("2"),
73+
);
74+
assertEquals(anonymous.remove(denops, ...ids), [true, true, true]);
7575

76-
// The method is removed
77-
await assertRejects(
78-
async () => {
79-
await denops.dispatch(denops.name, ids[0]);
80-
},
81-
`No method '${ids[0]}' exists`,
82-
);
83-
await assertRejects(
84-
async () => {
85-
await denops.dispatch(denops.name, ids[1]);
86-
},
87-
`No method '${ids[1]}' exists`,
88-
);
89-
await assertRejects(
90-
async () => {
91-
await denops.dispatch(denops.name, ids[2]);
76+
// The method is removed
77+
await assertRejects(
78+
async () => {
79+
await denops.dispatch(denops.name, ids[0]);
80+
},
81+
`No method '${ids[0]}' exists`,
82+
);
83+
await assertRejects(
84+
async () => {
85+
await denops.dispatch(denops.name, ids[1]);
86+
},
87+
`No method '${ids[1]}' exists`,
88+
);
89+
await assertRejects(
90+
async () => {
91+
await denops.dispatch(denops.name, ids[2]);
92+
},
93+
`No method '${ids[2]}' exists`,
94+
);
9295
},
93-
`No method '${ids[2]}' exists`,
94-
);
96+
});
9597
},
96-
prelude: ["let g:denops#enable_workaround_vim_before_8_2_3081 = 1"],
9798
});

denops_std/argument/flags_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { assertEquals } from "https://deno.land/std@0.167.0/testing/asserts.ts";
1+
import { assertEquals } from "https://deno.land/std@0.170.0/testing/asserts.ts";
22
import { parseFlags } from "./flags.ts";
33

44
Deno.test("parseFlags", () => {

denops_std/argument/mod_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { assertEquals } from "https://deno.land/std@0.167.0/testing/asserts.ts";
1+
import { assertEquals } from "https://deno.land/std@0.170.0/testing/asserts.ts";
22
import { parse } from "./mod.ts";
33

44
Deno.test("parse", () => {

denops_std/argument/opts_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { assertEquals } from "https://deno.land/std@0.167.0/testing/asserts.ts";
1+
import { assertEquals } from "https://deno.land/std@0.170.0/testing/asserts.ts";
22
import { parseOpts } from "./opts.ts";
33

44
Deno.test("parseOpts", () => {

denops_std/autocmd/common.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Denops } from "https://deno.land/x/denops_core@v3.3.0/mod.ts";
1+
import { Denops } from "https://deno.land/x/denops_core@v3.4.1/mod.ts";
22
import { AutocmdEvent } from "./types.ts";
33

44
type CommonOptions = {

0 commit comments

Comments
 (0)