tpl/internal/go_templates: Revert formatting

Should make future fork synch easier.
This commit is contained in:
Bjørn Erik Pedersen
2020-12-03 13:47:43 +01:00
parent d90e37e0c6
commit 718e09ed4b
21 changed files with 173 additions and 322 deletions

View File

@@ -427,7 +427,7 @@ func TestStringer(t *testing.T) {
if err := tmpl.Execute(b, s); err != nil {
t.Fatal(err)
}
expect := "string=3"
var expect = "string=3"
if b.String() != expect {
t.Errorf("expected %q got %q", expect, b.String())
}

View File

@@ -210,10 +210,8 @@ var cssReplacementTable = []string{
'}': `\7d`,
}
var (
expressionBytes = []byte("expression")
mozBindingBytes = []byte("mozbinding")
)
var expressionBytes = []byte("expression")
var mozBindingBytes = []byte("mozbinding")
// cssValueFilter allows innocuous CSS values in the output including CSS
// quantities (10px or 25%), ID or class literals (#foo, .bar), keyword values

View File

@@ -891,6 +891,7 @@ func TestEscapeSet(t *testing.T) {
t.Errorf("want\n\t%q\ngot\n\t%q", test.want, got)
}
}
}
func TestErrors(t *testing.T) {
@@ -1087,6 +1088,7 @@ func TestErrors(t *testing.T) {
// Check that we get the same error if we call Execute again.
if err := tmpl.Execute(buf, nil); err == nil || err.Error() != got {
t.Errorf("input=%q: unexpected error on second call %q", test.input, err)
}
}
}

View File

@@ -82,6 +82,7 @@ func Example() {
// <div><strong>no rows</strong></div>
// </body>
// </html>
}
func Example_autoescaping() {
@@ -122,6 +123,7 @@ func Example_escape() {
// \"Fran \u0026 Freddie\'s Diner\" \u003Ctasty@example.com\u003E
// \"Fran \u0026 Freddie\'s Diner\"32\u003Ctasty@example.com\u003E
// %22Fran+%26+Freddie%27s+Diner%2232%3Ctasty%40example.com%3E
}
func ExampleTemplate_Delims() {

View File

@@ -337,7 +337,6 @@ var jsStrNormReplacementTable = []string{
'<': `\u003c`,
'>': `\u003e`,
}
var jsRegexpReplacementTable = []string{
0: `\u0000`,
'\t': `\t`,

View File

@@ -206,8 +206,7 @@ func TestJSStrEscaper(t *testing.T) {
{"<!--", `\u003c!--`},
{"-->", `--\u003e`},
// From https://code.google.com/p/doctype/wiki/ArticleUtf7
{
"+ADw-script+AD4-alert(1)+ADw-/script+AD4-",
{"+ADw-script+AD4-alert(1)+ADw-/script+AD4-",
`\u002bADw-script\u002bAD4-alert(1)\u002bADw-\/script\u002bAD4-`,
},
// Invalid UTF-8 sequence

View File

@@ -41,10 +41,8 @@ var transitionFunc = [...]func(context, []byte) (context, int){
stateError: tError,
}
var (
commentStart = []byte("<!--")
commentEnd = []byte("-->")
)
var commentStart = []byte("<!--")
var commentEnd = []byte("-->")
// tText is the context transition function for the text state.
func tText(c context, s []byte) (context, int) {

View File

@@ -42,6 +42,7 @@ func TestFindEndTag(t *testing.T) {
}
func BenchmarkTemplateSpecialTags(b *testing.B) {
r := struct {
Name, Gift string
}{"Aunt Mildred", "bone china tea set"}