aboutsummaryrefslogtreecommitdiff
path: root/test/mozilla-ast.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/mozilla-ast.js')
-rw-r--r--test/mozilla-ast.js17
1 files changed, 14 insertions, 3 deletions
diff --git a/test/mozilla-ast.js b/test/mozilla-ast.js
index c94ae438..5f5ad541 100644
--- a/test/mozilla-ast.js
+++ b/test/mozilla-ast.js
@@ -24,11 +24,22 @@ function try_beautify(code) {
}
}
-function test(original, estree, description) {
- var transformed = UglifyJS.minify(UglifyJS.AST_Node.from_mozilla_ast(estree), {
+function validate(ast) {
+ try {
+ ast.walk(new UglifyJS.TreeWalker(function(node) {
+ node.validate();
+ }));
+ } catch (e) {
+ return { error: e };
+ }
+ return UglifyJS.minify(ast, {
compress: false,
- mangle: false
+ mangle: false,
});
+}
+
+function test(original, estree, description) {
+ var transformed = validate(UglifyJS.AST_Node.from_mozilla_ast(estree));
if (transformed.error || original !== transformed.code) {
console.log("//=============================================================");
console.log("// !!!!!! Failed... round", round);