-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
57 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,41 @@ | |||
/* a general testing framework (helpers) for us in the jstests/ | |||
to use, from your test file: | |||
testname="mytestname"; | |||
load("jstests/_tst.js"); | |||
*/ | |||
|
|||
if( typeof tst == "undefined" ) { | |||
tst = {} | |||
|
|||
tst.log = function (optional_msg) { | |||
print("\n\nstep " + ++this._step + " " + (optional_msg || "")); | |||
} | |||
|
|||
tst.success = function () { | |||
print(testname + " SUCCESS"); | |||
} | |||
|
|||
/* diff files a and b, returning the difference (empty str if no difference) */ | |||
tst.diff = function(a, b) { | |||
function reSlash(s) { | |||
var x = s; | |||
if (_isWindows()) { | |||
while (1) { | |||
var y = x.replace('/', '\\'); | |||
if (y == x) | |||
break; | |||
x = y; | |||
} | |||
} | |||
return x; | |||
} | |||
a = reSlash(a); | |||
b = reSlash(b); | |||
print("diff " + a + " " + b); | |||
return run("diff", a, b); | |||
} | |||
} | |||
|
|||
print(testname + " BEGIN"); | |||
tst._step = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters