Add "underscore" build test.

Former-commit-id: 8050e285fae94c96e7db1c8847ace45ae5cade33
This commit is contained in:
John-David Dalton
2012-09-08 19:26:43 -07:00
parent 24825b42a2
commit 57a990ce25
2 changed files with 71 additions and 47 deletions

View File

@@ -52,52 +52,6 @@
'uniq': ['unique']
};
/** Used to track Backbone's Lo-Dash dependencies */
var backboneDependencies = [
'bind',
'bindAll',
'clone',
'contains',
'escape',
'every',
'extend',
'filter',
'find',
'first',
'forEach',
'groupBy',
'has',
'indexOf',
'initial',
'invoke',
'isArray',
'isEmpty',
'isEqual',
'isFunction',
'isObject',
'isRegExp',
'keys',
'last',
'lastIndexOf',
'map',
'max',
'min',
'mixin',
'reduce',
'reduceRight',
'reject',
'rest',
'result',
'shuffle',
'size',
'some',
'sortBy',
'sortedIndex',
'toArray',
'uniqueId',
'without'
];
/** Used to track function dependencies */
var dependencyMap = {
'after': [],
@@ -221,6 +175,52 @@
/** List of all Lo-Dash methods */
var allMethods = _.keys(dependencyMap);
/** List Backbone's Lo-Dash dependencies */
var backboneDependencies = [
'bind',
'bindAll',
'clone',
'contains',
'escape',
'every',
'extend',
'filter',
'find',
'first',
'forEach',
'groupBy',
'has',
'indexOf',
'initial',
'invoke',
'isArray',
'isEmpty',
'isEqual',
'isFunction',
'isObject',
'isRegExp',
'keys',
'last',
'lastIndexOf',
'map',
'max',
'min',
'mixin',
'reduce',
'reduceRight',
'reject',
'rest',
'result',
'shuffle',
'size',
'some',
'sortBy',
'sortedIndex',
'toArray',
'uniqueId',
'without'
];
/** List of methods used by Underscore */
var underscoreMethods = _.without.apply(_, [allMethods].concat([
'countBy',

View File

@@ -444,7 +444,7 @@
);
commands.forEach(function(command) {
var start = _.after(2, QUnit.start);
var start = _.after(2, _.once(QUnit.start));
asyncTest('`lodash ' + command +'`', function() {
build(['--silent'].concat(command.split(' ')), function(filepath, source) {
@@ -520,6 +520,8 @@
});
['non-strict', 'strict'].forEach(function(strictMode, index) {
var start = _.after(2, _.once(QUnit.start));
asyncTest(strictMode + ' should ' + (index ? 'error': 'silently fail') + ' attempting to overwrite read-only properties', function() {
var commands = ['--silent', 'include=bindAll,defaults,extend'];
if (index) {
@@ -546,4 +548,26 @@
});
});
}());
/*--------------------------------------------------------------------------*/
QUnit.module('underscore modifier');
(function() {
var start = _.once(QUnit.start);
asyncTest('should not have deep clone', function() {
build(['--silent', 'underscore'], function(filepath, source) {
vm.runInContext(source, context);
var array = [{ 'a': 1 }],
basename = path.basename(filepath, '.js'),
lodash = context._;
ok(lodash.clone(array, true)[0] === array[0], basename);
start();
});
});
}());
}());