Lines Matching refs:rli

32   const rli = new readline.Interface({
37 return [rli, fi];
40 function assertCursorRowsAndCols(rli, rows, cols) {
41 const cursorPos = rli.getCursorPos();
53 const [rli] = getInterface({ crlfDelay });
54 assert.strictEqual(rli.crlfDelay, Math.max(crlfDelay || 100, 100));
55 rli.close();
151 const rli = new readline.Interface(fi, {});
152 rli.on('line', common.mustNotCall());
154 rli.close();
160 const [rli, fi] = getInterface({ terminal: true });
162 rli.on('line', common.mustCall((line) => {
166 rli.close();
171 const [rli, fi] = getInterface({ terminal: true });
173 rli.on('line', common.mustCall((line) => {
177 rli.close();
183 const [rli, fi] = getInterface({ terminal: true, completer });
184 rli.on('line', common.mustCall((line) => {
191 rli.close();
197 const [rli, fi] = getInterface({ terminal: true });
198 rli.on('line', common.mustCall((line) => {
203 rli.close();
209 const [rli, fi] = getInterface({ terminal: true });
211 rli.on('history', common.mustCall((history) => {
218 rli.close();
224 const [rli, fi] = getInterface({ terminal: true });
226 rli.on('history', common.mustCall((history) => {
230 rli.on('line', common.mustCall((line) => {
232 assert.strictEqual(rli.history.length, 0);
235 rli.close();
241 const [rli, fi] = getInterface({
248 rli.on('line', function(line) {
255 assert.strictEqual(rli.line, expectedLines[--callCount]);
257 assert.notStrictEqual(rli.line, expectedLines[--callCount]);
258 assert.strictEqual(rli.line, expectedLines[--callCount]);
260 assert.strictEqual(rli.line, expectedLines[--callCount]);
262 assert.notStrictEqual(rli.line, expectedLines[--callCount]);
263 assert.strictEqual(rli.line, expectedLines[--callCount]);
266 assert.strictEqual(rli.line, 'baz');
267 assert.strictEqual(rli.historyIndex, 2);
269 assert.strictEqual(rli.line, 'bar');
270 assert.strictEqual(rli.historyIndex, 1);
272 assert.strictEqual(rli.line, 'bat');
273 assert.strictEqual(rli.historyIndex, 0);
276 assert.strictEqual(rli.line, 'bat');
277 assert.strictEqual(rli.historyIndex, -1);
280 assert.strictEqual(rli.historyIndex, -1);
281 assert.strictEqual(rli.line, 'ba');
284 assert.strictEqual(rli.historyIndex, -1);
285 assert.strictEqual(rli.line, 'ba');
287 assert.strictEqual(rli.historyIndex, -1);
288 assert.strictEqual(rli.line, 'ba');
290 assert.strictEqual(rli.historyIndex, 0);
291 assert.strictEqual(rli.line, 'bat');
293 assert.strictEqual(rli.historyIndex, 1);
294 assert.strictEqual(rli.line, 'bar');
296 assert.strictEqual(rli.historyIndex, 2);
297 assert.strictEqual(rli.line, 'baz');
299 assert.strictEqual(rli.historyIndex, 4);
300 assert.strictEqual(rli.line, 'ba');
302 assert.strictEqual(rli.historyIndex, 4);
303 assert.strictEqual(rli.line, 'ba');
306 assert.strictEqual(rli.historyIndex, -1);
307 assert.strictEqual(rli.line, 'ba');
310 assert.strictEqual(rli.historyIndex, 0);
311 assert.strictEqual(rli.line, 'bat');
312 rli.close();
318 const [rli, fi] = getInterface({
324 rli.on('line', function(line) {
331 assert.strictEqual(rli.line, expectedLines[--callCount]);
333 assert.notStrictEqual(rli.line, expectedLines[--callCount]);
334 assert.strictEqual(rli.line, expectedLines[--callCount]);
336 assert.strictEqual(rli.line, expectedLines[--callCount]);
338 assert.strictEqual(rli.line, expectedLines[--callCount]);
340 assert.strictEqual(rli.line, expectedLines[--callCount]);
342 rli.close();
348 const [rli, fi] = getInterface({ terminal: true });
366 rli.close();
371 const [rli, fi] = getInterface({ terminal: true, historySize: 2 });
374 assert.strictEqual(rli.history.length, 2);
375 assert.strictEqual(rli.history[0], 'line 3');
376 assert.strictEqual(rli.history[1], 'line 2');
381 const [rli] = getInterface({ terminal: true });
383 rli.question(expectedLines[0]).then(() => rli.close());
384 assertCursorRowsAndCols(rli, 0, expectedLines[0].length);
385 rli.close();
390 const [rli] = getInterface({ terminal: true });
392 rli.question(expectedLines.join('\n')).then(() => rli.close());
394 rli, expectedLines.length - 1, expectedLines.slice(-1)[0].length);
395 rli.close();
400 const [rli, fi] = getInterface({ terminal: true, prompt: '' });
403 assertCursorRowsAndCols(rli, 0, 0);
405 assertCursorRowsAndCols(rli, 0, 19);
406 rli.close();
411 const [rli, fi] = getInterface({ terminal: true, prompt: '' });
413 assertCursorRowsAndCols(rli, 0, 19);
417 assertCursorRowsAndCols(rli, 0, 18);
420 assertCursorRowsAndCols(rli, 0, 17);
423 assertCursorRowsAndCols(rli, 0, 18);
426 assertCursorRowsAndCols(rli, 0, 19);
427 rli.close();
432 const [rli, fi] = getInterface({ terminal: true, prompt: '' });
437 assertCursorRowsAndCols(rli, 0, 0);
441 assertCursorRowsAndCols(rli, 0, 2);
443 rli.on('line', common.mustCall((line) => {
447 rli.close();
452 const [rli, fi] = getInterface({ terminal: true, prompt: '' });
457 assertCursorRowsAndCols(rli, 0, 0);
460 assertCursorRowsAndCols(rli, 0, 2);
462 rli.on('line', common.mustCall((line) => {
466 rli.close();
471 const [rli, fi] = getInterface({ terminal: true, prompt: '' });
476 assertCursorRowsAndCols(rli, 0, 2);
479 assertCursorRowsAndCols(rli, 0, 4);
481 rli.on('line', common.mustCall((line) => {
485 rli.close();
490 const [rli, fi] = getInterface({ terminal: true, prompt: '' });
493 assertCursorRowsAndCols(rli, 0, 16);
495 assertCursorRowsAndCols(rli, 0, 10);
497 assertCursorRowsAndCols(rli, 0, 16);
499 assertCursorRowsAndCols(rli, 0, 19);
500 rli.close();
509 let [rli, fi] = getInterface({ terminal: true, prompt: '' });
512 rli.on('line', common.mustCall((line) => {
517 rli.close();
520 [rli, fi] = getInterface({ terminal: true, prompt: '' });
523 rli.on('line', common.mustCall((line) => {
528 rli.close();
537 let [rli, fi] = getInterface({ terminal: true, prompt: '' });
541 rli.on('line', common.mustCall((line) => {
546 rli.close();
549 [rli, fi] = getInterface({ terminal: true, prompt: '' });
551 rli.on('line', common.mustCall((line) => {
556 rli.close();
561 const [rli, fi] = getInterface({ terminal: true, prompt: '' });
563 assertCursorRowsAndCols(rli, 0, 19);
567 assertCursorRowsAndCols(rli, 0, 18);
568 rli.on('line', common.mustCall((line) => {
572 rli.close();
577 const [rli, fi] = getInterface({ terminal: true, prompt: '' });
579 assertCursorRowsAndCols(rli, 0, 2);
582 assertCursorRowsAndCols(rli, 0, 0);
583 rli.on('line', common.mustCall((line) => {
587 rli.close();
592 const [rli, fi] = getInterface({ terminal: true, prompt: '' });
597 assertCursorRowsAndCols(rli, 0, 0);
601 assertCursorRowsAndCols(rli, 0, 0);
602 rli.on('line', common.mustCall((line) => {
606 rli.close();
611 const [rli, fi] = getInterface({ terminal: true, prompt: '' });
616 assertCursorRowsAndCols(rli, 0, 0);
620 assertCursorRowsAndCols(rli, 0, 0);
621 rli.on('line', common.mustCall((line) => {
625 rli.close();
630 const [rli, fi] = getInterface({ terminal: true, prompt: '' });
632 assertCursorRowsAndCols(rli, 0, 19);
636 assertCursorRowsAndCols(rli, 0, 0);
637 rli.on('line', common.mustCall((line) => {
641 rli.close();
646 const [rli, fi] = getInterface({ terminal: true, prompt: '' });
651 assertCursorRowsAndCols(rli, 0, 0);
655 assertCursorRowsAndCols(rli, 0, 0);
656 rli.on('line', common.mustCall((line) => {
660 rli.close();
665 const [rli, fi] = getInterface({ terminal: true, prompt: '' });
667 assert(rli.closed);
672 const [rli, fi] = getInterface({ terminal: true, prompt: '' });
675 assertCursorRowsAndCols(rli, 1, 5);
676 rli.close();
681 const [rli, fi] = getInterface({ tabSize: 16, terminal: true, prompt: '' });
684 assert.strictEqual(rli.cursor, 17);
685 assertCursorRowsAndCols(rli, 3, 2);
686 rli.close();
691 const [rli, fi] = getInterface({ terminal: true, prompt: '' });
693 assert.strictEqual(rli.cursor, 19);
695 assertCursorRowsAndCols(rli, 0, 27);
700 const [rli, fi] = getInterface({
706 assertCursorRowsAndCols(rli, 4, 3);
707 rli.close();
712 const [rli, fi] = getInterface({ terminal: true, prompt: '' });
716 assertCursorRowsAndCols(rli, 0, 6);
717 rli.on('line', common.mustCall((line) => {
721 rli.close();
769 const [rli, fi] = getInterface({ terminal, historySize: 0 });
770 assert.strictEqual(rli.historySize, 0);
773 assert.deepStrictEqual(rli.history, []);
774 rli.close();
779 const [rli, fi] = getInterface({ terminal });
780 assert.strictEqual(rli.historySize, 30);
783 assert.deepStrictEqual(rli.history, terminal ? ['asdf'] : []);
784 rli.close();
789 const [rli, fi] = getInterface({ terminal });
790 rli.on('line', common.mustCall((line) => {
800 const [rli] = getInterface({ terminal });
807 rli.question('hello?', { signal }).then(common.mustCall());
809 rli.write('bar\n');
811 rli.close();
816 const [rli, fi] = getInterface({ terminal });
817 rli.on('line', common.mustCall((line) => {
825 const [rli, fi] = getInterface({ terminal });
827 rli.on('line', (line) => {
835 rli.close();
840 const [rli, fi] = getInterface({ terminal });
842 rli.on('line', common.mustCall((line) => {
846 rli.close();
851 const [rli, fi] = getInterface({ terminal });
853 rli.on('line', common.mustCall((line) => {
857 rli.close();
863 const [rli, fi] = getInterface({ terminal });
865 rli.on('line', common.mustCall((line) => {
868 rli.on('close', common.mustCall());
871 rli.close();
877 const [rli, fi] = getInterface({ terminal });
879 rli.on('line', function(line) {
889 rli.close();
894 const [rli, fi] = getInterface({ terminal });
895 rli.on('line', common.mustCall((line) => {
899 rli.close();
904 const [rli] = getInterface({ terminal });
905 rli.question('foo?').then(common.mustCall((answer) => {
908 rli.write('bar\n');
909 rli.close();
914 const [rli] = getInterface({ terminal });
916 rli.question('foo?', { signal }).then(common.mustCall((answer) => {
919 rli.write('bar\n');
920 rli.close();
927 const [rli] = getInterface({ terminal });
928 rli.on('line', common.mustCall((line) => {
931 assert.rejects(rli.question('hello?', { signal }), { name: 'AbortError' })
934 rli.write('bar\n');
935 rli.close();
939 const [rli] = getInterface({ terminal });
941 await assert.rejects(rli.question('hello', { signal }), {
944 rli.close();
952 const [rli] = getInterface({ terminal });
954 rli.question('hello?', { signal }),
959 rli.close();
964 const [rli, fi] = getInterface({ terminal });
965 rli.question('What\'s your name?').then(common.mustCall((name) => {
967 rli.close();
968 rli.question('How are you?')
973 assert.notStrictEqual(rli.getPrompt(), 'How are you?');
981 const [rli, fi] = getInterface({ output: null, terminal });
982 rli.on('line', common.mustCall((line) => {
987 rli.setPrompt('ddd> ');
988 rli.prompt();
989 rli.write("really shouldn't be seeing this");
990 rli.question('What do you think of node.js? ', function(answer) {
992 rli.close();
999 const [rli] = getInterface({ terminal });
1001 rli.setPrompt(prompt);
1002 assert.strictEqual(rli.getPrompt(), prompt);
1040 const [rli, fi] = getInterface({ terminal, crlfDelay });
1042 rli.on('line', function(line) {
1049 rli.close();
1062 const [rli, fi] = getInterface({ terminal, crlfDelay });
1064 rli.on('line', function(line) {
1071 rli.close();
1080 const [rli, fi] = getInterface({ terminal, crlfDelay });
1082 rli.on('line', common.mustCall((line) => {
1086 rli.close();
1091 const [rli, fi] = getInterface({ terminal, crlfDelay });
1094 rli.on('line', common.mustCall((line) => {
1102 rli.close();
1109 const [rli, fi] = getInterface({ terminal, crlfDelay });
1111 rli.on('line', () => callCount++);
1116 rli.close();