From 915742cd17e07e8a78253f2d00ec86ea599711fe Mon Sep 17 00:00:00 2001 From: freewil Date: Sun, 12 May 2013 14:13:28 -0400 Subject: [PATCH] fix short circuit if line from `help` fails regex --- test/missing-commands.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/test/missing-commands.js b/test/missing-commands.js index 8d9a0e0..edc1f49 100644 --- a/test/missing-commands.js +++ b/test/missing-commands.js @@ -13,16 +13,14 @@ var getHelpCommands = function(client, cb) { // split up the command list by newlines var commandListLines = commandList.split('\n'); - commandListLines.forEach(function(commandListLine) { - - // get the actual name of the command from the command list line - var result = commandRegex.exec(commandListLine); + var result; + for (var i in commandListLines) { + result = commandRegex.exec(commandListLines[i]); if (!result) { - return cb(new Error('command list line failed to match regex: ' + commandListLine)); + return cb(new Error('command list line failed to match regex: ' + commandListLines[i])); } helpCommands.push(result[1]); - }); - + } cb(null, helpCommands); }); };