|
1 | 1 | import { |
2 | 2 | assert, |
| 3 | + assertArrayIncludes, |
3 | 4 | assertEquals, |
4 | 5 | assertFalse, |
5 | 6 | assertRejects, |
@@ -27,12 +28,33 @@ Deno.test("test(mode:nvim) start nvim to test denops features", async () => { |
27 | 28 | for (const mode of ["vim", "nvim"] as const) { |
28 | 29 | Deno.test(`test(mode:${mode}) outputs ${mode} messages if 'verbose' option is true`, async () => { |
29 | 30 | using s = stub(console, "error"); |
30 | | - await withDenops("vim", async (denops: Denops) => { |
31 | | - await denops.cmd("echomsg 'foobar'"); |
| 31 | + await withDenops(mode, async (denops: Denops) => { |
| 32 | + await denops.cmd("echomsg 'Hello. Hello. Hello. Hello. Hello. Hello.'"); |
| 33 | + await denops.cmd("echomsg 'World. World. World. World. World. World.'"); |
32 | 34 | }, { verbose: true }); |
33 | | - // NOTE: Maybe some other values are included, so find target with `Array.some`. |
34 | | - // NOTE: Maybe "\r" or "\n" is prepend or postpend, so use `String.trim`. |
35 | | - assert(s.calls.some((c) => c.args[0].trim() === "foobar")); |
| 35 | + const rawOutput = s.calls.map((c) => c.args[0]); |
| 36 | + const normOutput = rawOutput.join("").split("\r\n").map((v) => v.trim()); |
| 37 | + // |
| 38 | + // NOTE: |
| 39 | + // |
| 40 | + // It appears that Neovim doesn't insert any delimiters between consecutive 'echomsg' calls, |
| 41 | + // and the chunk lengths are unstable as a result. |
| 42 | + // This inconsistency causes issues with Neovim's verbose output, but we couldn't find a workaround |
| 43 | + // to resolve this problem. |
| 44 | + // Interestingly, this issue only arises when producing verbose output using denops.vim, making it |
| 45 | + // difficult for us to reproduce the phenomenon and report it to Neovim's issue tracker. |
| 46 | + // While verbose output is essential for debugging, we're forced to accept our current situation. |
| 47 | + // |
| 48 | + if (mode === "vim") { |
| 49 | + assertArrayIncludes(normOutput, [ |
| 50 | + "Hello. Hello. Hello. Hello. Hello. Hello.", |
| 51 | + "World. World. World. World. World. World.", |
| 52 | + ]); |
| 53 | + } else { |
| 54 | + assertArrayIncludes(normOutput, [ |
| 55 | + "Hello. Hello. Hello. Hello. Hello. Hello.World. World. World. World. World. World.", |
| 56 | + ]); |
| 57 | + } |
36 | 58 | }); |
37 | 59 |
|
38 | 60 | Deno.test(`test(mode:${mode}) should be able to call Denops#redraw()`, async () => { |
|
0 commit comments