mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
Added tests for jsdoc/src.
This commit is contained in:
parent
34214405d5
commit
f6f962e847
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"app": {
|
"app": {
|
||||||
"name": "jsdoc-toolkit-3",
|
"name": "jsdoc-3",
|
||||||
"version": "0.0.0+2010-06-07-2143"
|
"version": "0.0.0+2010-06-27-2042"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
15
build.xml
15
build.xml
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
<project name="JSDoc Toolkit" default="about">
|
<project name="JSDoc-3" default="about">
|
||||||
<property file="build/build.properties" />
|
<property file="build/build.properties" />
|
||||||
<property name="build.templates" location="build/templates" />
|
<property name="build.templates" location="build/templates" />
|
||||||
|
|
||||||
@ -21,4 +21,17 @@
|
|||||||
</copy>
|
</copy>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
<target name="jar">
|
||||||
|
<delete file="about.json" quiet="true"/>
|
||||||
|
<copy file="${build.templates}/about.json" tofile="about.json" >
|
||||||
|
<filterchain>
|
||||||
|
<replacetokens>
|
||||||
|
<token key="app.name" value="${app.name}" />
|
||||||
|
<token key="app.version" value="${app.version}" />
|
||||||
|
<token key="timestamp" value="${NOW}" />
|
||||||
|
</replacetokens>
|
||||||
|
</filterchain>
|
||||||
|
</copy>
|
||||||
|
</target>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
@ -1,2 +1,2 @@
|
|||||||
app.name=jsdoc-toolkit-3
|
app.name=jsdoc-3
|
||||||
app.version=0.0.0
|
app.version=0.0.0
|
||||||
|
|||||||
5
main.js
5
main.js
@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @overview JSDoc Toolkit Version 3
|
* @overview JSDoc 3
|
||||||
* @copyright 2010 (c) Michael Mathews <micmath@gmail.com>
|
* @copyright 2010 (c) Michael Mathews <micmath@gmail.com>
|
||||||
* @license See LICENSE.md file included in this distribution.
|
* @license See LICENSE.md file included in this distribution.
|
||||||
*/
|
*/
|
||||||
@ -64,6 +64,7 @@
|
|||||||
java.lang.System.exit(0);
|
java.lang.System.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (opts._.length > 0) {
|
||||||
sourceFiles = jsdoc.src.getFilePaths(opts._);
|
sourceFiles = jsdoc.src.getFilePaths(opts._);
|
||||||
|
|
||||||
jsdoc.parser.parseFiles(sourceFiles, opts.encoding);
|
jsdoc.parser.parseFiles(sourceFiles, opts.encoding);
|
||||||
@ -76,5 +77,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
print( jsdoc.parser.result.toString(opts.destination) );
|
print( jsdoc.parser.result.toString(opts.destination) );
|
||||||
|
}
|
||||||
|
|
||||||
})();
|
})();
|
||||||
////
|
////
|
||||||
@ -1,50 +0,0 @@
|
|||||||
/**
|
|
||||||
@overview
|
|
||||||
@author Michael Mathews <micmath@gmail.com>
|
|
||||||
@license Apache License 2.0 - See file 'LICENSE.md' in this project.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
Unit tests runner for JSDoc Toolkit.
|
|
||||||
@module jsdoc/test
|
|
||||||
*/
|
|
||||||
(function() {
|
|
||||||
|
|
||||||
exports.runAll = function() {
|
|
||||||
load(BASEDIR + 'lib/jsunity.js');
|
|
||||||
|
|
||||||
testSuites = [];
|
|
||||||
load(BASEDIR + 'tests/opts.js');
|
|
||||||
load(BASEDIR + 'tests/docset.js');
|
|
||||||
load(BASEDIR + 'tests/tag_namespace.js');
|
|
||||||
load(BASEDIR + 'tests/tag_constructor.js');
|
|
||||||
load(BASEDIR + 'tests/tag_const.js');
|
|
||||||
load(BASEDIR + 'tests/tag_enum.js');
|
|
||||||
load(BASEDIR + 'tests/tag_param.js');
|
|
||||||
load(BASEDIR + 'tests/tag_example.js');
|
|
||||||
|
|
||||||
jsUnity.attachAssertions();
|
|
||||||
jsUnity.log = function (s) { print(s); };
|
|
||||||
var results = jsUnity.run.apply(jsUnity, testSuites);
|
|
||||||
summarize(results);
|
|
||||||
}
|
|
||||||
|
|
||||||
function summarize(results) {
|
|
||||||
var colorStart,
|
|
||||||
colorEnd = '\033[m';
|
|
||||||
|
|
||||||
print('------------------');
|
|
||||||
print('Total: ' + results.total + ' tests');
|
|
||||||
|
|
||||||
if (results.failed === 0) {
|
|
||||||
colorStart = '\033[1;37;42m', // green
|
|
||||||
print(colorStart + 'ALL PASS' + colorEnd);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
colorStart = '\033[1;37;41m'; // red
|
|
||||||
print(colorStart + results.failed + 'FAILED' + colorEnd);
|
|
||||||
}
|
|
||||||
print('');
|
|
||||||
}
|
|
||||||
|
|
||||||
})();
|
|
||||||
0
test/samples/src/dir1/three.js
Normal file
0
test/samples/src/dir1/three.js
Normal file
0
test/samples/src/ignored.txt
Normal file
0
test/samples/src/ignored.txt
Normal file
0
test/samples/src/one.js
Normal file
0
test/samples/src/one.js
Normal file
0
test/samples/src/two.js
Normal file
0
test/samples/src/two.js
Normal file
@ -16,6 +16,47 @@
|
|||||||
expect(jsdoc.src).to(respond_to, 'getFilePaths');
|
expect(jsdoc.src).to(respond_to, 'getFilePaths');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('The return value of jsdoc.src#getFilePaths when called with no arguments', function() {
|
||||||
|
it('should return an empty array', function() {
|
||||||
|
var returnedValue = jsdoc.src.getFilePaths();
|
||||||
|
expect(returnedValue).to(be_an, Array);
|
||||||
|
expect(returnedValue).to(have_length, 0);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('The return value of jsdoc.src#getFilePaths when called with an array with one src dir and no depth', function() {
|
||||||
|
it('should return an array of 2 file paths', function() {
|
||||||
|
var returnedValue = jsdoc.src.getFilePaths(['test/samples/src']);
|
||||||
|
expect(returnedValue).to(be_an, Array);
|
||||||
|
expect(returnedValue).to(have_length, 2);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should contain both js files and not the txt file', function() {
|
||||||
|
var returnedValue = jsdoc.src.getFilePaths(['test/samples/src']);
|
||||||
|
|
||||||
|
expect( returnedValue.indexOf('test/samples/src/one.js') ).to(be_at_least, 0);
|
||||||
|
expect( returnedValue.indexOf('test/samples/src/two.js') ).to(be_at_least, 0);
|
||||||
|
expect( returnedValue.indexOf('test/samples/src/ignored.txt') ).to(be_less_than, 0);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('The return value of jsdoc.src#getFilePaths when called with an array with one src dir and depth of 2', function() {
|
||||||
|
it('should return an array of 3 file paths', function() {
|
||||||
|
var returnedValue = jsdoc.src.getFilePaths(['test/samples/src'], 2);
|
||||||
|
expect(returnedValue).to(be_an, Array);
|
||||||
|
expect(returnedValue).to(have_length, 3);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should contain all three js files and not the txt file', function() {
|
||||||
|
var returnedValue = jsdoc.src.getFilePaths(['test/samples/src'], 2);
|
||||||
|
|
||||||
|
expect( returnedValue.indexOf('test/samples/src/one.js') ).to(be_at_least, 0);
|
||||||
|
expect( returnedValue.indexOf('test/samples/src/two.js') ).to(be_at_least, 0);
|
||||||
|
expect( returnedValue.indexOf('test/samples/src/dir1/three.js') ).to(be_at_least, 0);
|
||||||
|
expect( returnedValue.indexOf('test/samples/src/ignored.txt') ).to(be_less_than, 0);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user