aboutsummaryrefslogtreecommitdiff
path: root/src/text/template/parse/parse_test.go
diff options
context:
space:
mode:
authorBrad Fitzpatrick <bradfitz@golang.org>2016-11-14 22:23:10 +0000
committerBrad Fitzpatrick <bradfitz@golang.org>2016-11-14 22:23:24 +0000
commitb83350a2e05d63eaae8da9ff4f957ab44e4cb9d9 (patch)
tree393b98cd52778fc2a190ebdea52fbdcfd856f0f8 /src/text/template/parse/parse_test.go
parent2442b49c47aa818bbc55e4c064e9ea0ca058735f (diff)
downloadgo-b83350a2e05d63eaae8da9ff4f957ab44e4cb9d9.tar.xz
Revert "text/template: efficient reporting of line numbers"
This reverts commit 794fb71d9c1018c4beae1657baca5229e6a02ad0. Reason for revert: submitted without TryBots and it broke all three race builders. Change-Id: I80a1e566616f0ee8fa3529d4eeee04268f8a713b Reviewed-on: https://go-review.googlesource.com/33232 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/text/template/parse/parse_test.go')
-rw-r--r--src/text/template/parse/parse_test.go34
1 files changed, 0 insertions, 34 deletions
diff --git a/src/text/template/parse/parse_test.go b/src/text/template/parse/parse_test.go
index 81f14aca98..9d856bcb3d 100644
--- a/src/text/template/parse/parse_test.go
+++ b/src/text/template/parse/parse_test.go
@@ -484,37 +484,3 @@ func TestBlock(t *testing.T) {
t.Errorf("inner template = %q, want %q", g, w)
}
}
-
-func TestLineNum(t *testing.T) {
- const count = 100
- text := strings.Repeat("{{printf 1234}}\n", count)
- tree, err := New("bench").Parse(text, "", "", make(map[string]*Tree), builtins)
- if err != nil {
- t.Fatal(err)
- }
- // Check the line numbers. Each line is an action containing a template, followed by text.
- // That's two nodes per line.
- nodes := tree.Root.Nodes
- for i := 0; i < len(nodes); i += 2 {
- line := 1 + i/2
- // Action first.
- action := nodes[i].(*ActionNode)
- if action.Line != line {
- t.Fatalf("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)
- }
- }
-}
-
-func BenchmarkParseLarge(b *testing.B) {
- text := strings.Repeat("{{1234}}\n", 10000)
- for i := 0; i < b.N; i++ {
- _, err := New("bench").Parse(text, "", "", make(map[string]*Tree), builtins)
- if err != nil {
- b.Fatal(err)
- }
- }
-}