Skip to content

Commit 7634dad

Browse files
committed
🌿 Fix invalid test for buffer/decoration
`buffer.append` was used so decoration was not properly applied to the expected line.
1 parent 402dedb commit 7634dad

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

buffer/decoration_test.ts

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,23 @@ test({
1111
name: "decorate define highlights as text properties",
1212
fn: async (denops) => {
1313
const collect = async (bufnr: number) => {
14-
const lines = await fn.getbufline(denops, bufnr, 1, "$");
15-
const props = [];
16-
for (let line = 1; line <= lines.length; line++) {
17-
props.push(
18-
...(await vimFn.prop_list(denops, line, { bufnr }) as unknown[]),
19-
);
20-
}
14+
const props = await vimFn.prop_list(denops, 1, {
15+
bufnr,
16+
end_lnum: -1,
17+
}) as {
18+
col: number;
19+
end: number;
20+
id: number;
21+
length: number;
22+
lnum: number;
23+
start: number;
24+
type: string;
25+
type_bufnr: number;
26+
}[];
2127
return props;
2228
};
2329
const bufnr = await fn.bufnr(denops);
24-
await buffer.append(denops, bufnr, [
30+
await buffer.replace(denops, bufnr, [
2531
"Hello",
2632
"Darkness",
2733
"My",
@@ -45,7 +51,8 @@ test({
4551
col: 1,
4652
end: 1,
4753
id: 0,
48-
length: 1,
54+
length: 5,
55+
lnum: 1,
4956
start: 1,
5057
type: "denops_std:buffer:decoration:decorate:Title",
5158
type_bufnr: 0,
@@ -54,18 +61,20 @@ test({
5461
end: 1,
5562
id: 0,
5663
length: 3,
64+
lnum: 2,
5765
start: 1,
5866
type: "denops_std:buffer:decoration:decorate:Search",
5967
type_bufnr: 0,
6068
}]);
6169
},
6270
});
71+
6372
test({
6473
mode: "nvim",
6574
name: "decorate define highlights as extmarks",
6675
fn: async (denops) => {
6776
const bufnr = await fn.bufnr(denops);
68-
await buffer.append(denops, bufnr, [
77+
await buffer.replace(denops, bufnr, [
6978
"Hello",
7079
"Darkness",
7180
"My",

0 commit comments

Comments
 (0)