aboutsummaryrefslogtreecommitdiff
path: root/test/mocha/let.js
blob: 09e84b7481792e3a5ac0ed72e8ebd6951a577cb7 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
var assert = require("assert");
var UglifyJS = require("../..");

describe("let", function() {
    this.timeout(30000);
    it("Should not produce reserved keywords as variable name in mangle", function() {
        // Produce a lot of variables in a function and run it through mangle.
        var s = '"dddddeeeeelllllooooottttt"; function foo() {';
        for (var i = 0; i < 18000; i++) {
            s += "var v" + i + "=0;";
        }
        s += '}';
        var result = UglifyJS.minify(s, {
            compress: false
        }).code;

        // Verify that select keywords and reserved keywords not produced
        [
            "do",
            "let",
            "var",
        ].forEach(function(name) {
            assert.strictEqual(result.indexOf("var " + name + "="), -1);
        });

        // Verify that the variable names that appeared immediately before
        // and after the erroneously generated variable name still exist
        // to show the test generated enough symbols.
        [
            "to", "eo",
            "eet", "fet",
            "rar", "oar",
        ].forEach(function(name) {
            assert.notStrictEqual(result.indexOf("var " + name + "="), -1);
        });
    });
    it("Should quote mangled properties that are reserved keywords", function() {
        var s = '"rrrrrnnnnniiiiiaaaaa";';
        for (var i = 0; i < 18000; i++) {
            s += "v.b" + i + ";";
        }
        var result = UglifyJS.minify(s, {
            compress: false,
            ie8: true,
            mangle: {
                properties: true,
            }
        }).code;
        [
            "in",
            "var",
        ].forEach(function(name) {
            assert.notStrictEqual(result.indexOf(name), -1);
            assert.notStrictEqual(result.indexOf('v["' + name + '"]'), -1);
        });
    });
});
n. * emacs/guix-geiser.el (guix-geiser-eval-in-repl-synchronously): New function. * emacs/guix-devel.el (guix-devel-setup-repl): Use it. Alex Kost 2015-10-09emacs: devel: Fix 'modify-phases' highlighting....* emacs/guix-devel.el (guix-devel-modify-phases-font-lock-pre): Handle the case when 'modify-phases' is commented. Alex Kost 2015-10-09emacs: devel: Highlight gexp symbols....Suggested by Ludovic Courtès <ludo@gnu.org>. * emacs/guix-devel.el (guix-devel-gexp-symbol): New face. (guix-devel-font-lock-keywords): Adjust to handle gexp symbols. Alex Kost 2015-09-26emacs: devel: Highlight 'modify-phases' keywords....* emacs/guix-guile.el (guix-guile-keyword-regexp): New function. * emacs/guix-devel.el (guix-devel-faces): New custom group. (guix-devel-modify-phases-keyword): New face. (guix-devel-modify-phases-keyword-regexp, guix-devel-font-lock-keywords): New variables. (guix-devel-modify-phases-font-lock-matcher, guix-devel-modify-phases-font-lock-pre): New functions. (guix-devel-mode): Adjust to add/remove font-lock-keywords. Alex Kost 2015-09-23emacs: Add 'guix-devel-build-package-definition'....Suggested by Ludovic Courtès <ludo@gnu.org>. * emacs/guix-guile.el (guix-guile-definition-regexp): New variable. (guix-guile-current-definition, guix-guile-boolean): New functions. * emacs/guix-devel.el: Require 'guix-base'. (guix-devel-repl-processes): New variable. (guix-devel-setup-repl, guix-devel-setup-repl-maybe): New functions. (guix-devel-build-package-definition): New command. * doc/emacs.texi (Emacs Development): Document it. Alex Kost 2015-09-23emacs: Add development utils....* emacs/guix-guile.el (guix-guile-current-module): New function. * emacs/guix-devel.el: New file. * emacs.am (ELFILES): Add it. * doc/emacs.texi (Emacs Development): New node. (Emacs Interface): Add it. * doc/contributing.texi (The Perfect Setup): Mention it. * doc/guix.texi (Top): Add it. * emacs/guix-init.el: Add 'guix-devel-activate-mode-maybe' to 'scheme-mode-hook'. Alex Kost