improve mocha tests (#3195)
This commit is contained in:
@@ -1,17 +1,14 @@
|
||||
var UglifyJS = require("../node");
|
||||
var assert = require("assert");
|
||||
var UglifyJS = require("../..");
|
||||
|
||||
describe("arguments", function() {
|
||||
it("Should known that arguments in functions are local scoped", function() {
|
||||
var ast = UglifyJS.parse("var arguments; var f = function() {arguments.length}");
|
||||
ast.figure_out_scope();
|
||||
|
||||
// Test scope of `var arguments`
|
||||
assert.strictEqual(ast.find_variable("arguments").global, true);
|
||||
|
||||
// Select arguments symbol in function
|
||||
var symbol = ast.body[1].definitions[0].value.find_variable("arguments");
|
||||
|
||||
assert.strictEqual(symbol.global, false);
|
||||
assert.strictEqual(symbol.scope, ast. // From ast
|
||||
body[1]. // Select 2nd statement (equals to `var f ...`)
|
||||
@@ -27,4 +24,4 @@ describe("arguments", function() {
|
||||
assert.strictEqual(ast.body[0].body[0].uses_arguments, true);
|
||||
assert.strictEqual(ast.body[0].body[0].body[0].uses_arguments, false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user