Enable test runner to compare ignoring whitespace

This commit is contained in:
toby 2017-03-11 14:55:53 -05:00
parent d440b3b398
commit 3d661c953f

View file

@ -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 = [