Skip to content
Snippets Groups Projects
Unverified Commit 8cb7f593 authored by Daniel Ehrenberg's avatar Daniel Ehrenberg Committed by Leo Balter
Browse files

Create an assert.compareArray

This is a convenience function which tries to make tests easier
to read and write.
parent bfc9020d
No related branches found
No related tags found
No related merge requests found
...@@ -13,3 +13,17 @@ function compareArray(a, b) { ...@@ -13,3 +13,17 @@ function compareArray(a, b) {
return true; return true;
} }
assert.compareArray = function(actual, expected, message) {
if (compareArray(actual, expected)) return;
if (message === undefined) {
message = '';
} else {
message += ' ';
}
message += 'Expected SameValue(«' + String(actual) + '», «' + String(expected) + '») to be true';
$ERROR(`${message}${message === undefined ? '' : ' '}Expected the arrays [${actual}] to have the same contents as [${expected}]`);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment