xref: /third_party/node/test/parallel/test-readline-interface-no-trailing-newline.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/parallel/
11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ciconst common = require('../common');
31cb0ef41Sopenharmony_ciconst ArrayStream = require('../common/arraystream');
41cb0ef41Sopenharmony_ciconst assert = require('assert');
51cb0ef41Sopenharmony_ci
61cb0ef41Sopenharmony_cicommon.skipIfDumbTerminal();
71cb0ef41Sopenharmony_ci
81cb0ef41Sopenharmony_ciconst readline = require('readline');
91cb0ef41Sopenharmony_ciconst rli = new readline.Interface({
101cb0ef41Sopenharmony_ci  terminal: true,
111cb0ef41Sopenharmony_ci  input: new ArrayStream(),
121cb0ef41Sopenharmony_ci  output: new ArrayStream(),
131cb0ef41Sopenharmony_ci});
141cb0ef41Sopenharmony_ci
151cb0ef41Sopenharmony_ci// Minimal reproduction for #47305
161cb0ef41Sopenharmony_ciconst testInput = '{\n}';
171cb0ef41Sopenharmony_ci
181cb0ef41Sopenharmony_cilet accum = '';
191cb0ef41Sopenharmony_ci
201cb0ef41Sopenharmony_cirli.output.write = (data) => accum += data.replace('\r', '');
211cb0ef41Sopenharmony_ci
221cb0ef41Sopenharmony_cirli.write(testInput);
231cb0ef41Sopenharmony_ci
241cb0ef41Sopenharmony_ciassert.strictEqual(accum, testInput);
25

Indexes created Thu Nov 07 10:32:03 CST 2024