From b83350a2e05d63eaae8da9ff4f957ab44e4cb9d9 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Mon, 14 Nov 2016 22:23:10 +0000 Subject: 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 --- src/text/template/parse/parse_test.go | 34 ---------------------------------- 1 file changed, 34 deletions(-) (limited to 'src/text/template/parse/parse_test.go') 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) - } - } -} -- cgit v1.3-5-g9baa