File: indentation.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 (100 lines) | stat: -rw-r--r-- 1,853 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
99
100
numeric: {
    beautify = {
        beautify: true,
        indent_start: 1,
        indent_level: 3,
    }
    input: {
        switch (42) {
          case null:
            console.log("FAIL");
        }
        console.log("PASS");
    }
    expect_exact: [
        " switch (42) {",
        "  case null:",
        '    console.log("FAIL");',
        " }",
        "",
        ' console.log("PASS");',
    ]
    expect_stdout: "PASS"
}

spaces: {
    beautify = {
        beautify: true,
        indent_start: " ",
        indent_level: "   ",
    }
    input: {
        switch (42) {
          case null:
            console.log("FAIL");
        }
        console.log("PASS");
    }
    expect_exact: [
        " switch (42) {",
        "  case null:",
        '    console.log("FAIL");',
        " }",
        "",
        ' console.log("PASS");',
    ]
    expect_stdout: "PASS"
}

tabs: {
    beautify = {
        beautify: true,
        indent_start: "\t",
        indent_level: "\t",
    }
    input: {
        switch (42) {
          case null:
            console.log("FAIL");
        }
        console.log("PASS");
    }
    expect_exact: [
        "\tswitch (42) {",
        "\tcase null:",
        '\t\tconsole.log("FAIL");',
        "\t}",
        "",
        '\tconsole.log("PASS");',
    ]
    expect_stdout: "PASS"
}

mixed: {
    beautify = {
        beautify: true,
        indent_start: "\n",
        indent_level: "       \t",
    }
    input: {
        switch (42) {
          case null:
            console.log("FAIL");
        }
        console.log("PASS");
    }
    expect_exact: [
        "",
        "switch (42) {",
        "",
        "    case null:",
        "",
        '       \tconsole.log("FAIL");',
        "",
        "}",
        "",
        "",
        'console.log("PASS");',
    ]
    expect_stdout: "PASS"
}