diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/exports.js | 13 | ||||
-rw-r--r-- | test/mocha/accessorTokens-1492.js | 2 | ||||
-rw-r--r-- | test/mocha/arguments.js | 2 | ||||
-rw-r--r-- | test/mocha/cli.js | 2 | ||||
-rw-r--r-- | test/mocha/comment-filter.js | 2 | ||||
-rw-r--r-- | test/mocha/comment.js | 2 | ||||
-rw-r--r-- | test/mocha/directives.js | 2 | ||||
-rw-r--r-- | test/mocha/getter-setter.js | 2 | ||||
-rw-r--r-- | test/mocha/line-endings.js | 2 | ||||
-rw-r--r-- | test/mocha/minify.js | 9 | ||||
-rw-r--r-- | test/mocha/number-literal.js | 2 | ||||
-rw-r--r-- | test/mocha/operator.js | 2 | ||||
-rw-r--r-- | test/mocha/spidermonkey.js | 15 | ||||
-rw-r--r-- | test/mocha/string-literal.js | 2 | ||||
-rw-r--r-- | test/mocha/with.js | 2 | ||||
-rw-r--r-- | test/mozilla-ast.js | 2 | ||||
-rw-r--r-- | test/node.js | 6 | ||||
-rwxr-xr-x | test/run-tests.js | 2 | ||||
-rw-r--r-- | test/sourcemaps.js | 2 | ||||
-rw-r--r-- | test/ufuzz.js | 2 |
20 files changed, 37 insertions, 38 deletions
diff --git a/test/exports.js b/test/exports.js new file mode 100644 index 00000000..f50b772c --- /dev/null +++ b/test/exports.js @@ -0,0 +1,13 @@ +exports["Compressor"] = Compressor; +exports["JS_Parse_Error"] = JS_Parse_Error; +exports["OutputStream"] = OutputStream; +exports["SourceMap"] = SourceMap; +exports["TreeWalker"] = TreeWalker; +exports["base54"] = base54; +exports["defaults"] = defaults; +exports["mangle_properties"] = mangle_properties; +exports["minify"] = minify; +exports["parse"] = parse; +exports["string_template"] = string_template; +exports["tokenizer"] = tokenizer; +exports["is_identifier"] = is_identifier; diff --git a/test/mocha/accessorTokens-1492.js b/test/mocha/accessorTokens-1492.js index 861414ee..2b5bbeaa 100644 --- a/test/mocha/accessorTokens-1492.js +++ b/test/mocha/accessorTokens-1492.js @@ -1,4 +1,4 @@ -var UglifyJS = require('../../'); +var UglifyJS = require("../node"); var assert = require("assert"); describe("Accessor tokens", function() { diff --git a/test/mocha/arguments.js b/test/mocha/arguments.js index 73993a73..998978eb 100644 --- a/test/mocha/arguments.js +++ b/test/mocha/arguments.js @@ -1,4 +1,4 @@ -var UglifyJS = require('../../'); +var UglifyJS = require("../node"); var assert = require("assert"); describe("arguments", function() { diff --git a/test/mocha/cli.js b/test/mocha/cli.js index 9d8d496f..cac920d3 100644 --- a/test/mocha/cli.js +++ b/test/mocha/cli.js @@ -19,7 +19,7 @@ describe("bin/uglifyjs", function () { eval(stdout); assert.strictEqual(typeof WrappedUglifyJS, 'object'); - assert.strictEqual(true, WrappedUglifyJS.parse('foo;') instanceof WrappedUglifyJS.AST_Node); + assert.strictEqual(WrappedUglifyJS.minify("foo([true,,2+3]);").code, "foo([!0,,5]);"); done(); }); diff --git a/test/mocha/comment-filter.js b/test/mocha/comment-filter.js index 4b74ebf9..0e4f3dff 100644 --- a/test/mocha/comment-filter.js +++ b/test/mocha/comment-filter.js @@ -1,4 +1,4 @@ -var UglifyJS = require('../../'); +var UglifyJS = require("../node"); var assert = require("assert"); describe("comment filters", function() { diff --git a/test/mocha/comment.js b/test/mocha/comment.js index acad3693..6b5428d4 100644 --- a/test/mocha/comment.js +++ b/test/mocha/comment.js @@ -1,5 +1,5 @@ var assert = require("assert"); -var uglify = require("../../"); +var uglify = require("../node"); describe("Comment", function() { it("Should recognize eol of single line comments", function() { diff --git a/test/mocha/directives.js b/test/mocha/directives.js index 16279a5d..ab8ad57f 100644 --- a/test/mocha/directives.js +++ b/test/mocha/directives.js @@ -1,5 +1,5 @@ var assert = require("assert"); -var uglify = require("../../"); +var uglify = require("../node"); describe("Directives", function() { it ("Should allow tokenizer to store directives state", function() { diff --git a/test/mocha/getter-setter.js b/test/mocha/getter-setter.js index 641a2026..83bf5792 100644 --- a/test/mocha/getter-setter.js +++ b/test/mocha/getter-setter.js @@ -1,4 +1,4 @@ -var UglifyJS = require('../../'); +var UglifyJS = require("../node"); var assert = require("assert"); describe("Getters and setters", function() { diff --git a/test/mocha/line-endings.js b/test/mocha/line-endings.js index 379ee2b9..6b666813 100644 --- a/test/mocha/line-endings.js +++ b/test/mocha/line-endings.js @@ -1,4 +1,4 @@ -var Uglify = require('../../'); +var Uglify = require("../node"); var assert = require("assert"); describe("line-endings", function() { diff --git a/test/mocha/minify.js b/test/mocha/minify.js index 18840a58..d69ef59c 100644 --- a/test/mocha/minify.js +++ b/test/mocha/minify.js @@ -183,13 +183,4 @@ describe("minify", function() { }); }); }); - - describe("Compressor", function() { - it("should be backward compatible with ast.transform(compressor)", function() { - var ast = Uglify.parse("function f(a){for(var i=0;i<a;i++)console.log(i)}"); - ast.figure_out_scope(); - ast = ast.transform(Uglify.Compressor()); - assert.strictEqual(ast.print_to_string(), "function f(a){for(var i=0;i<a;i++)console.log(i)}"); - }); - }) }); diff --git a/test/mocha/number-literal.js b/test/mocha/number-literal.js index e80a5313..f4e2f5dd 100644 --- a/test/mocha/number-literal.js +++ b/test/mocha/number-literal.js @@ -1,5 +1,5 @@ var assert = require("assert"); -var uglify = require("../../"); +var uglify = require("../node"); describe("Number literals", function () { it("Should not allow legacy octal literals in strict mode", function() { diff --git a/test/mocha/operator.js b/test/mocha/operator.js index adef3abd..64db02c1 100644 --- a/test/mocha/operator.js +++ b/test/mocha/operator.js @@ -1,4 +1,4 @@ -var UglifyJS = require("../../"); +var UglifyJS = require("../node"); var assert = require("assert"); describe("operator", function() { diff --git a/test/mocha/spidermonkey.js b/test/mocha/spidermonkey.js index e5bf45a2..4071a136 100644 --- a/test/mocha/spidermonkey.js +++ b/test/mocha/spidermonkey.js @@ -1,6 +1,6 @@ var assert = require("assert"); var exec = require("child_process").exec; -var uglify = require("../../"); +var uglify = require("../node"); describe("spidermonkey export/import sanity test", function() { it("should produce a functional build when using --self with spidermonkey", function(done) { @@ -15,18 +15,7 @@ describe("spidermonkey export/import sanity test", function() { eval(stdout); assert.strictEqual(typeof SpiderUglify, "object"); - - var ast = SpiderUglify.parse("foo([true,,2+3]);"); - assert.strictEqual(true, ast instanceof SpiderUglify.AST_Node); - - ast.figure_out_scope(); - ast = SpiderUglify.Compressor({}).compress(ast); - assert.strictEqual(true, ast instanceof SpiderUglify.AST_Node); - - var stream = SpiderUglify.OutputStream({}); - ast.print(stream); - var code = stream.toString(); - assert.strictEqual(code, "foo([!0,,5]);"); + assert.strictEqual(SpiderUglify.minify("foo([true,,2+3]);").code, "foo([!0,,5]);"); done(); }); diff --git a/test/mocha/string-literal.js b/test/mocha/string-literal.js index 6e337a24..fde6db59 100644 --- a/test/mocha/string-literal.js +++ b/test/mocha/string-literal.js @@ -1,4 +1,4 @@ -var UglifyJS = require('../../'); +var UglifyJS = require("../node"); var assert = require("assert"); describe("String literals", function() { diff --git a/test/mocha/with.js b/test/mocha/with.js index a74ef41a..72fd76ef 100644 --- a/test/mocha/with.js +++ b/test/mocha/with.js @@ -1,5 +1,5 @@ var assert = require("assert"); -var uglify = require("../../"); +var uglify = require("../node"); describe("With", function() { it("Should throw syntaxError when using with statement in strict mode", function() { diff --git a/test/mozilla-ast.js b/test/mozilla-ast.js index e4c84df8..544ce8bc 100644 --- a/test/mozilla-ast.js +++ b/test/mozilla-ast.js @@ -1,7 +1,7 @@ // Testing UglifyJS <-> SpiderMonkey AST conversion // through generative testing. -var UglifyJS = require(".."), +var UglifyJS = require("./node"), escodegen = require("escodegen"), esfuzz = require("esfuzz"), estraverse = require("estraverse"), diff --git a/test/node.js b/test/node.js new file mode 100644 index 00000000..22bf325d --- /dev/null +++ b/test/node.js @@ -0,0 +1,6 @@ +var fs = require("fs"); + +new Function("MOZ_SourceMap", "exports", require("../tools/node").FILES.map(function(file) { + if (/exports\.js$/.test(file)) file = require.resolve("./exports"); + return fs.readFileSync(file, "utf8"); +}).join("\n\n"))(require("source-map"), exports); diff --git a/test/run-tests.js b/test/run-tests.js index f3c62e7a..05afc1b5 100755 --- a/test/run-tests.js +++ b/test/run-tests.js @@ -1,6 +1,6 @@ #! /usr/bin/env node -var U = require("../tools/node"); +var U = require("./node"); var path = require("path"); var fs = require("fs"); var assert = require("assert"); diff --git a/test/sourcemaps.js b/test/sourcemaps.js index 7db4672e..4757d1e0 100644 --- a/test/sourcemaps.js +++ b/test/sourcemaps.js @@ -1,4 +1,4 @@ -var UglifyJS = require(".."); +var UglifyJS = require("./node"); var ok = require("assert"); module.exports = function () { diff --git a/test/ufuzz.js b/test/ufuzz.js index 48e33f73..b2ec9e09 100644 --- a/test/ufuzz.js +++ b/test/ufuzz.js @@ -12,7 +12,7 @@ stream._handle.setBlocking(true); }); -var UglifyJS = require(".."); +var UglifyJS = require("./node"); var randomBytes = require("crypto").randomBytes; var sandbox = require("./sandbox"); |