tpl/internal: Sync go_templates

Closes #10411
This commit is contained in:
Bjørn Erik Pedersen
2022-11-14 19:13:09 +01:00
parent 58a98c7758
commit f6ab9553f4
34 changed files with 739 additions and 514 deletions

View File

@@ -492,7 +492,7 @@ var errorTests = []parseTest{
hasError, `unclosed left paren`},
{"rparen",
"{{.X 1 2 3 ) }}",
hasError, `unexpected ")" in command`},
hasError, "unexpected right paren"},
{"rparen2",
"{{(.X 1 2 3",
hasError, `unclosed action`},
@@ -600,7 +600,8 @@ func TestBlock(t *testing.T) {
}
func TestLineNum(t *testing.T) {
const count = 100
// const count = 100
const count = 3
text := strings.Repeat("{{printf 1234}}\n", count)
tree, err := New("bench").Parse(text, "", "", make(map[string]*Tree), builtins)
if err != nil {
@@ -614,11 +615,11 @@ func TestLineNum(t *testing.T) {
// Action first.
action := nodes[i].(*ActionNode)
if action.Line != line {
t.Fatalf("line %d: action is line %d", line, action.Line)
t.Errorf("line %d: action is line %d", line, action.Line)
}
pipe := action.Pipe
if pipe.Line != line {
t.Fatalf("line %d: pipe is line %d", line, pipe.Line)
t.Errorf("line %d: pipe is line %d", line, pipe.Line)
}
}
}