MCPcopy
hub / github.com/tdewolff/minify / TestString

Function TestString

js/util_test.go:39–102  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

37}
38
39func TestString(t *testing.T) {
40 tests := []struct {
41 str, expected string
42 }{
43 {`""`, `""`},
44 {`"abc"`, `"abc"`},
45 {`'abc'`, `"abc"`},
46 {`"\8\9\t"`, "\"89\t\""},
47 {`"\n\r"`, "`\n\\r`"},
48 {`"\12\15"`, "`\n\\r`"},
49 {`"\x0A\x0D"`, "`\n\\r`"},
50 {`"\u000A\u000D"`, "`\n\\r`"},
51 {`"\u{A}\u{D}"`, "`\n\\r`"},
52 {`"\n$"`, "`\n$`"},
53 {`"\n${"`, `"\n${"`},
54 {`"\n\r${${"`, `"\n\r${${"`},
55 {`"\12\15${${"`, `"\n\r${${"`},
56 {`"\x0A\x0D${${"`, `"\n\r${${"`},
57 {`"\u000A\u000D${${"`, `"\n\r${${"`},
58 {`"\u{A}\u{D}${${"`, `"\n\r${${"`},
59 {`"\42"`, `'"'`},
60 {`"\x22"`, `'"'`},
61 {`"\u0022"`, `'"'`},
62 {`"\u{22}"`, `'"'`},
63 {`"\42''"`, "`\"''`"},
64 {`"\x22''"`, "`\"''`"},
65 {`"\u0022''"`, "`\"''`"},
66 {`"\u{022}''"`, "`\"''`"},
67 {"\"\\42''``\"", "\"\\\"''``\""},
68 {"\"\\x22''``\"", "\"\\\"''``\""},
69 {"\"\\u0022''``\"", "\"\\\"''``\""},
70 {"\"\\u{0022}''``\"", "\"\\\"''``\""},
71 {`'\47'`, `"'"`},
72 {`'\x27'`, `"'"`},
73 {`'\u0027'`, `"'"`},
74 {`'\u{27}'`, `"'"`},
75 {`'\47""'`, "`'\"\"`"},
76 {`'\x27""'`, "`'\"\"`"},
77 {`'\u0027""'`, "`'\"\"`"},
78 {`'\u{027}""'`, "`'\"\"`"},
79 {"'\\47\"\"``'", "'\\'\"\"``'"},
80 {"'\\x27\"\"``'", "'\\'\"\"``'"},
81 {"'\\u0027\"\"``'", "'\\'\"\"``'"},
82 {"'\\u{0027}\"\"``'", "'\\'\"\"``'"},
83 {`'\140'`, "\"`\""},
84 {`'\x60'`, "\"`\""},
85 {`'\u0060'`, "\"`\""},
86 {`'\u{60}'`, "\"`\""},
87 {`'\140""'`, "'`\"\"'"},
88 {`'\x60""'`, "'`\"\"'"},
89 {`'\u0060""'`, "'`\"\"'"},
90 {`'\u{060}""'`, "'`\"\"'"},
91 {`'\140""\'\''`, "`\\`\"\"''`"},
92 {`'\x60""\'\''`, "`\\`\"\"''`"},
93 {`'\u0060""\'\''`, "`\\`\"\"''`"},
94 {`'\u{0060}""\'\''`, "`\\`\"\"''`"},
95 }
96

Callers

nothing calls this directly

Calls 3

RunMethod · 0.80
minifyStringFunction · 0.70
BytesMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…