[Pkg-javascript-commits] [uglifyjs] 143/491: fix parsing of `expect_stdout` (#2096)

Jonas Smedegaard dr at jones.dk
Wed Feb 14 19:51:30 UTC 2018


This is an automated email from the git hooks/post-receive script.

js pushed a commit to annotated tag debian/3.3.10-1
in repository uglifyjs.

commit 0a1e523cd5de9b96946b05bd70b3f125a4bfb4cc
Author: Alex Lam S.L <alexlamsl at gmail.com>
Date:   Thu Jun 15 01:00:03 2017 +0800

    fix parsing of `expect_stdout` (#2096)
    
    fixes #2095
---
 test/run-tests.js | 28 +++++++++++++---------------
 1 file changed, 13 insertions(+), 15 deletions(-)

diff --git a/test/run-tests.js b/test/run-tests.js
index 188532e..71ffe72 100755
--- a/test/run-tests.js
+++ b/test/run-tests.js
@@ -294,24 +294,22 @@ function parse_test(file) {
                 if (label.name == "expect_exact" || label.name == "node_version") {
                     test[label.name] = read_string(stat);
                 } else if (label.name == "expect_stdout") {
-                    if (stat.TYPE == "SimpleStatement") {
-                        var body = stat.body;
-                        if (body instanceof U.AST_Boolean) {
-                            test[label.name] = body.value;
-                        } else if (body instanceof U.AST_Call) {
-                            var ctor = global[body.expression.name];
-                            assert.ok(ctor === Error || ctor.prototype instanceof Error, tmpl("Unsupported expect_stdout format [{line},{col}]", {
+                    var body = stat.body;
+                    if (body instanceof U.AST_Boolean) {
+                        test[label.name] = body.value;
+                    } else if (body instanceof U.AST_Call) {
+                        var ctor = global[body.expression.name];
+                        assert.ok(ctor === Error || ctor.prototype instanceof Error, tmpl("Unsupported expect_stdout format [{line},{col}]", {
+                            line: label.start.line,
+                            col: label.start.col
+                        }));
+                        test[label.name] = ctor.apply(null, body.args.map(function(node) {
+                            assert.ok(node instanceof U.AST_Constant, tmpl("Unsupported expect_stdout format [{line},{col}]", {
                                 line: label.start.line,
                                 col: label.start.col
                             }));
-                            test[label.name] = ctor.apply(null, body.args.map(function(node) {
-                                assert.ok(node instanceof U.AST_Constant, tmpl("Unsupported expect_stdout format [{line},{col}]", {
-                                    line: label.start.line,
-                                    col: label.start.col
-                                }));
-                                return node.value;
-                            }));
-                        }
+                            return node.value;
+                        }));
                     } else {
                         test[label.name] = read_string(stat) + "\n";
                     }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/uglifyjs.git



More information about the Pkg-javascript-commits mailing list