GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test,readline: improve tab completion coverage · nodejs/node@16eb078

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/parallel
    • test-readline-tab-complete.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/parallel/test-readline-tab-complete.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-readline-tab-complete.js
+40-8Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,23 @@ common.skipIfDumbTerminal();
3131
const width = getStringWidth(char) - 1;
3232

3333
class FakeInput extends EventEmitter {
34-
columns = ((width + 1) * 10 + (lineBreak ? 0 : 10)) * 3
34+
columns = ((width + 1) * 10 + (lineBreak ? 0 : 10)) * 3
3535

36-
write = common.mustCall((data) => {
37-
output += data;
38-
}, 6)
36+
write = common.mustCall((data) => {
37+
output += data;
38+
}, 6)
3939

40-
resume() {}
41-
pause() {}
42-
end() {}
40+
resume() {}
41+
pause() {}
42+
end() {}
4343
}
4444

4545
const fi = new FakeInput();
4646
const rli = new readline.Interface({
4747
input: fi,
4848
output: fi,
4949
terminal: true,
50-
completer: completer
50+
completer: common.mustCallAtLeast(completer),
5151
});
5252

5353
const last = '\r\nFirst group\r\n\r\n' +
@@ -68,3 +68,35 @@ common.skipIfDumbTerminal();
6868
rli.close();
6969
});
7070
});
71+
72+
{
73+
let output = '';
74+
class FakeInput extends EventEmitter {
75+
columns = 80
76+
77+
write = common.mustCall((data) => {
78+
output += data;
79+
}, 1)
80+
81+
resume() {}
82+
pause() {}
83+
end() {}
84+
}
85+
86+
const fi = new FakeInput();
87+
const rli = new readline.Interface({
88+
input: fi,
89+
output: fi,
90+
terminal: true,
91+
completer:
92+
common.mustCallAtLeast((_, cb) => cb(new Error('message'))),
93+
});
94+
95+
rli.on('line', common.mustNotCall());
96+
fi.emit('data', '\t');
97+
queueMicrotask(() => {
98+
assert.match(output, /^Tab completion error: Error: message/);
99+
output = '';
100+
});
101+
rli.close();
102+
}

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.