File: max_line_len.js

package info (click to toggle)
uglify-js 3.17.4-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 4,792 kB
  • sloc: javascript: 137,812; sh: 940; makefile: 41
file content (98 lines) | stat: -rw-r--r-- 1,641 bytes parent folder | download
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
too_short: {
    beautify = {
        max_line_len: 10,
    }
    input: {
        function f(a) {
            return { c: 42, d: a(), e: "foo"};
        }
    }
    expect_exact: [
        "function f(",
        "a){return{",
        "c:42,d:a(",
        '),e:"foo"}',
        "}",
    ]
    expect_warnings: [
        "WARN: Output exceeds 10 characters",
    ]
}

just_enough: {
    beautify = {
        max_line_len: 14,
    }
    input: {
        function f(a) {
            return { c: 42, d: a(), e: "foo"};
        }
    }
    expect_exact: [
        "function f(a){",
        "return{c:42,",
        'd:a(),e:"foo"}',
        "}",
    ]
    expect_warnings: []
}

drop_semicolon: {
    beautify = {
        max_line_len: 5,
        semicolons: true,
    }
    input: {
        var a;
        console.log(a || 42);
    }
    expect_exact: [
        "var a",
        "console.log(",
        "a||42",
        ");",
    ]
    expect_stdout: "42"
    expect_warnings: [
        "WARN: Output exceeds 5 characters",
    ]
}

template_newline: {
    beautify = {
        max_line_len: 2,
    }
    input: {
        console.log(`foo
bar`);
    }
    expect_exact: [
        "console.log(",
        "`foo",
        "bar`",
        ");",
    ]
    expect_stdout: [
        "foo",
        "bar",
    ]
    expect_warnings: [
        "WARN: Output exceeds 2 characters",
    ]
    node_version: ">=4"
}

issue_304: {
    beautify = {
        max_line_len: 10,
    }
    input: {
        var a = 0, b = 0, c = 0, d = 0, e = 0;
    }
    expect_exact: [
        "var a=0,",
        "b=0,c=0,",
        "d=0,e=0;",
    ]
    expect_warnings: []
}