We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a3cc43d commit 8ea6844Copy full SHA for 8ea6844
test/parallel/test-repl-.save.load.js
@@ -74,5 +74,20 @@ putIn.write = function(data) {
74
};
75
putIn.run(['.load ' + loadFile]);
76
77
+// clear the REPL
78
+putIn.run(['.clear']);
79
+
80
+// NUL (\0) is disallowed in filenames in UNIX-like operating systems and
81
+// Windows so we can use that to test failed saves
82
+const invalidFileName = join(common.tmpDir, '\0\0\0\0\0');
83
-//TODO how do I do a failed .save test?
84
+// should not break
85
+putIn.write = function(data) {
86
+ // make sure I get a failed to save message and not some other error
87
+ assert.equal(data, 'Failed to save:' + invalidFileName + '\n');
88
+ // reset to no-op
89
+ putIn.write = function() {};
90
+};
91
92
+// save it to a file
93
+putIn.run(['.save ' + invalidFileName]);
0 commit comments