2016-10-05 12:39:33 +00:00
|
|
|
var Uglify = require('../../');
|
|
|
|
|
var assert = require("assert");
|
|
|
|
|
|
|
|
|
|
describe("mangle_properties 'debug' option ", function() {
|
2016-10-06 10:33:42 +00:00
|
|
|
it("Should test the 'debug' option of mangle_properties works as expected", function() {
|
2016-10-05 12:39:33 +00:00
|
|
|
var js = 'var o = {}; o.foo = "bar";';
|
2016-10-05 12:48:36 +00:00
|
|
|
|
|
|
|
|
var ast = Uglify.parse(js);
|
|
|
|
|
ast.figure_out_scope();
|
|
|
|
|
ast = Uglify.mangle_properties(ast, {
|
|
|
|
|
debug: true
|
|
|
|
|
});
|
|
|
|
|
|
2016-10-05 12:52:16 +00:00
|
|
|
var stream = Uglify.OutputStream();
|
2016-10-05 12:48:36 +00:00
|
|
|
ast.print(stream);
|
|
|
|
|
var result = stream.toString();
|
|
|
|
|
|
2016-10-06 10:33:42 +00:00
|
|
|
// Should match: var o={};o._$foo$NNN="bar";
|
2016-10-05 12:48:36 +00:00
|
|
|
// where NNN is a number.
|
2016-10-06 10:33:42 +00:00
|
|
|
assert(/var o=\{\};o\._\$foo\$\d+_="bar";/.test(result));
|
2016-10-05 12:39:33 +00:00
|
|
|
});
|
|
|
|
|
});
|