From 3d661c953f9684dd7f3891c28172ad4380943b5b Mon Sep 17 00:00:00 2001 From: toby Date: Sat, 11 Mar 2017 14:55:53 -0500 Subject: [PATCH] Enable test runner to compare ignoring whitespace --- test/TestRegister.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/TestRegister.js b/test/TestRegister.js index 2c4b6200..b9059cbd 100644 --- a/test/TestRegister.js +++ b/test/TestRegister.js @@ -53,6 +53,11 @@ output: null, }; + // Remove whitespace helper + var noWS = function(string) { + return string.replace(/\s/g, ""); + } + if (result.error) { if (test.expectedError) { ret.status = "passing"; @@ -66,6 +71,9 @@ ret.output = "Expected an error but did not receive one."; } else if (result.result === test.expectedOutput) { ret.status = "passing"; + } else if (test.ignoreWhitespace + && noWS(result.result) === noWS(test.expectedOutput)) { + ret.status = "passing"; } else { ret.status = "failing"; ret.output = [