uglify_test.js
1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
'use strict';
var grunt = require('grunt');
var tmp = 'tmp/',
fixtures = 'test/fixtures/expected/';
exports.contrib_uglify = {
preuglified_files: function(test) {
var files = [
'comments.js',
'compress.js',
'compress_mangle.js',
'compress_mangle_banner.js',
'compress_mangle_beautify.js',
'compress_mangle_except.js',
'compress_mangle_sourcemap',
'enclose.js',
'sourcemapurl.js',
'multifile.js',
'wrap.js',
'exportAll.js',
'sourcemap_prefix'
];
test.expect(files.length);
files.forEach(function(file){
var actual = grunt.file.read(tmp + file);
var expected = grunt.file.read(fixtures + file);
test.equal(actual, expected, 'task output should equal ' + file);
});
test.done();
},
relative_test : function(test) {
var files = [
'sourcemapin',
'sourcemapin.js',
'multiple_sourcemaps1.js',
'multiple_sourcemaps1.map',
'multiple_sourcemaps2.js',
'multiple_sourcemaps2.map',
];
test.expect(files.length);
files.forEach(function(file){
var actual = grunt.file.read(tmp + file).replace(tmp,'REPLACED');
var expected = grunt.file.read(fixtures + file).replace(fixtures,'REPLACED');
test.equal(actual, expected, 'task output should equal ' + file);
});
test.done();
}
};