mirror of
https://github.com/zebrajr/node.git
synced 2025-12-06 12:20:27 +01:00
PR-URL: https://github.com/nodejs/node/pull/59964 Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
26 lines
756 B
JavaScript
26 lines
756 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const assert = require('node:assert');
|
|
const { startNewREPLServer } = require('../common/repl');
|
|
|
|
const tmpdir = require('../common/tmpdir');
|
|
tmpdir.refresh();
|
|
|
|
// Test for the appropriate handling of cases in which REPL saves fail
|
|
|
|
const { replServer, input, output } = startNewREPLServer({ terminal: false });
|
|
|
|
// NUL (\0) is disallowed in filenames in UNIX-like operating systems and
|
|
// Windows so we can use that to test failed saves.
|
|
const invalidFilePath = tmpdir.resolve('\0\0\0\0\0');
|
|
|
|
output.write = common.mustCall(function(data) {
|
|
assert.strictEqual(data, `Failed to save: ${invalidFilePath}\n`);
|
|
output.write = () => {};
|
|
});
|
|
|
|
input.run([`.save ${invalidFilePath}`]);
|
|
|
|
replServer.close();
|