diff options
author | Matěj Cepl <mcepl@redhat.com> | 2013-05-23 08:05:00 +0200 |
---|---|---|
committer | Matěj Cepl <mcepl@redhat.com> | 2013-05-23 08:47:19 +0200 |
commit | ccd8b64dbb18e19f3129f74429ac83b99c295734 (patch) | |
tree | 3cbf09732d0309abd07bfdcd50537e68b93fc290 /test | |
parent | 7f91596ca5fbe55831d587cdb746b4da595a15ff (diff) | |
download | parseLDIF-ccd8b64dbb18e19f3129f74429ac83b99c295734.tar.gz |
Switch testing to NodeJS, so we can use Travis-CI.
Also remove all dependencies on Rhino.
Diffstat (limited to 'test')
-rwxr-xr-x | test/testAll.js | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/test/testAll.js b/test/testAll.js index 9aabd43..232baa4 100755 --- a/test/testAll.js +++ b/test/testAll.js @@ -1,6 +1,8 @@ -#!/usr/bin/rhino +#!/usr/bin/node -load("../parseLDIF.js"); +var parse = require("../parseLDIF.js"); +var fs = require("fs"); +var toSource = require('tosource'); Object.prototype.equals = function(x) { var p; @@ -88,19 +90,23 @@ var expResults = { }; var resultsCount = Object.keys(expResults).length; +var success = 0; for (var key in expResults) { if (expResults.hasOwnProperty(key)) { - var lines = readFile("example0" + key + ".ldif").replace(/\r\n/g,"\n"); - observed = parseLDIF(lines.split("\n")); + var lines = fs.readFileSync("example0" + key + ".ldif", "utf-8"). + replace(/\r\n/g,"\n"); + observed = parse.parseLDIF(lines.split("\n")); if (observed.equals(expResults[key])) { - print(key + "/" + resultsCount + " ... OK"); + console.log(key + "/" + resultsCount + " ... OK"); } else { - print("Test " + key + " fails! Expected:\n" + - expResults[key].toSource() + - "\n----\nObserved:\n" + observed.toSource()); + console.log("Test " + key + " fails! Expected:\n" + + toSource(expResults[key]) + + "\n----\nObserved:\n" + toSource(observed)); + success = 1; } } } +process.exit(success); |