mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-11 03:17:49 +00:00
Add "underscore" build test.
Former-commit-id: 8050e285fae94c96e7db1c8847ace45ae5cade33
This commit is contained in:
92
build.js
92
build.js
@@ -52,52 +52,6 @@
|
|||||||
'uniq': ['unique']
|
'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 */
|
/** Used to track function dependencies */
|
||||||
var dependencyMap = {
|
var dependencyMap = {
|
||||||
'after': [],
|
'after': [],
|
||||||
@@ -221,6 +175,52 @@
|
|||||||
/** List of all Lo-Dash methods */
|
/** List of all Lo-Dash methods */
|
||||||
var allMethods = _.keys(dependencyMap);
|
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 */
|
/** List of methods used by Underscore */
|
||||||
var underscoreMethods = _.without.apply(_, [allMethods].concat([
|
var underscoreMethods = _.without.apply(_, [allMethods].concat([
|
||||||
'countBy',
|
'countBy',
|
||||||
|
|||||||
@@ -444,7 +444,7 @@
|
|||||||
);
|
);
|
||||||
|
|
||||||
commands.forEach(function(command) {
|
commands.forEach(function(command) {
|
||||||
var start = _.after(2, QUnit.start);
|
var start = _.after(2, _.once(QUnit.start));
|
||||||
|
|
||||||
asyncTest('`lodash ' + command +'`', function() {
|
asyncTest('`lodash ' + command +'`', function() {
|
||||||
build(['--silent'].concat(command.split(' ')), function(filepath, source) {
|
build(['--silent'].concat(command.split(' ')), function(filepath, source) {
|
||||||
@@ -520,6 +520,8 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
['non-strict', 'strict'].forEach(function(strictMode, index) {
|
['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() {
|
asyncTest(strictMode + ' should ' + (index ? 'error': 'silently fail') + ' attempting to overwrite read-only properties', function() {
|
||||||
var commands = ['--silent', 'include=bindAll,defaults,extend'];
|
var commands = ['--silent', 'include=bindAll,defaults,extend'];
|
||||||
if (index) {
|
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();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}());
|
||||||
|
|
||||||
}());
|
}());
|
||||||
|
|||||||
Reference in New Issue
Block a user