This repository has been archived by the owner on Aug 16, 2020. It is now read-only.
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
14 changed files
with
155 additions
and
178 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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/env node | ||
|
||
var path = require('path'); | ||
var fs = require('fs'); | ||
var root = path.join(path.dirname(fs.realpathSync(__filename)), '..'); | ||
|
||
// FIXME: Not sure this is the best way to go about this, or if we should | ||
// just require("doctest")? | ||
var doctest = require(root + '/doctest'); | ||
|
||
function main(filename) { | ||
var runner = new doctest.Runner({Reporter: doctest.ConsoleReporter}); | ||
runner.globs = runner.evalInit(); | ||
var parser = new doctest.TextParser.fromFile(runner, process.argv[2]); | ||
parser.parse(); | ||
runner.run(); | ||
|
||
var reporter = runner.reporter; | ||
return reporter; | ||
} | ||
|
||
function showReport(reporter) { | ||
console.log('Successes:', reporter.successes); | ||
console.log('Failures:', reporter.failures); | ||
if ((! reporter.successes) || reporter.failures) { | ||
// Set exit code to number of failures (if any). It gives a nice failures | ||
// summary when running under make. E.g.: `make: *** [doctest] Error 2` | ||
process.exit(reporter.failures || 1); | ||
} | ||
} | ||
|
||
var filename = process.argv[2]; | ||
if (! filename) { | ||
console.log("Error: you did not give a filename"); | ||
console.log("Usage:", process.argv[1], "FILENAME"); | ||
process.exit(500); | ||
} | ||
showReport(main(filename)); |
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
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
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
This file was deleted.
Oops, something went wrong.
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
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
Oops, something went wrong.