mirror of
https://github.com/gchq/CyberChef.git
synced 2025-05-07 15:07:11 -04:00
Enable test runner to compare ignoring whitespace
This commit is contained in:
parent
d440b3b398
commit
3d661c953f
1 changed files with 8 additions and 0 deletions
|
@ -53,6 +53,11 @@
|
||||||
output: null,
|
output: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Remove whitespace helper
|
||||||
|
var noWS = function(string) {
|
||||||
|
return string.replace(/\s/g, "");
|
||||||
|
}
|
||||||
|
|
||||||
if (result.error) {
|
if (result.error) {
|
||||||
if (test.expectedError) {
|
if (test.expectedError) {
|
||||||
ret.status = "passing";
|
ret.status = "passing";
|
||||||
|
@ -66,6 +71,9 @@
|
||||||
ret.output = "Expected an error but did not receive one.";
|
ret.output = "Expected an error but did not receive one.";
|
||||||
} else if (result.result === test.expectedOutput) {
|
} else if (result.result === test.expectedOutput) {
|
||||||
ret.status = "passing";
|
ret.status = "passing";
|
||||||
|
} else if (test.ignoreWhitespace
|
||||||
|
&& noWS(result.result) === noWS(test.expectedOutput)) {
|
||||||
|
ret.status = "passing";
|
||||||
} else {
|
} else {
|
||||||
ret.status = "failing";
|
ret.status = "failing";
|
||||||
ret.output = [
|
ret.output = [
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue