diff options
-rw-r--r-- | lib/readline.js | 2 | ||||
-rw-r--r-- | test/parallel/test-readline-interface.js | 20 |
2 files changed, 21 insertions, 1 deletions
diff --git a/lib/readline.js b/lib/readline.js index c8d0a8040a..5cc2293882 100644 --- a/lib/readline.js +++ b/lib/readline.js @@ -121,7 +121,7 @@ function Interface(input, output, completer, terminal) { input = input.input; } - if (completer && typeof completer !== 'function') { + if (completer !== undefined && typeof completer !== 'function') { throw new ERR_INVALID_OPT_VALUE('completer', completer); } diff --git a/test/parallel/test-readline-interface.js b/test/parallel/test-readline-interface.js index 2dff11f2a2..93c4b12511 100644 --- a/test/parallel/test-readline-interface.js +++ b/test/parallel/test-readline-interface.js @@ -366,6 +366,26 @@ function isWarned(emitter) { type: TypeError, code: 'ERR_INVALID_OPT_VALUE' }); + + common.expectsError(function() { + readline.createInterface({ + input: fi, + completer: '' + }); + }, { + type: TypeError, + code: 'ERR_INVALID_OPT_VALUE' + }); + + common.expectsError(function() { + readline.createInterface({ + input: fi, + completer: false + }); + }, { + type: TypeError, + code: 'ERR_INVALID_OPT_VALUE' + }); } // Constructor throws if historySize is not a positive number |