diff options
author | Noah Campbell <noahcampbell@gmail.com> | 2013-10-30 07:24:29 +0400 |
---|---|---|
committer | Noah Campbell <noahcampbell@gmail.com> | 2013-11-01 20:59:57 +0400 |
commit | f4cb8e1688b1459472413f3c85cb3b6297397020 (patch) | |
tree | 80bd82a700d4a22037356e7f910581287accabec /transform/posttrans_test.go | |
parent | 789aa6ad76fe2f6c7b911da6042a7f2a697e94ea (diff) |
Adding benchmark for transformation module.
Diffstat (limited to 'transform/posttrans_test.go')
-rw-r--r-- | transform/posttrans_test.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/transform/posttrans_test.go b/transform/posttrans_test.go index fd6bc18b2..103e73a4a 100644 --- a/transform/posttrans_test.go +++ b/transform/posttrans_test.go @@ -21,7 +21,7 @@ func TestAbsUrlify(t *testing.T) { BaseURL: "http://base", } - apply(t, tr, abs_url_tests) + apply(t.Errorf, tr, abs_url_tests) } type test struct { @@ -35,15 +35,17 @@ var abs_url_tests = []test{ {H5_JS_CONTENT_ABS_URL, H5_JS_CONTENT_ABS_URL}, } -func apply(t *testing.T, tr Transformer, tests []test) { +type errorf func (string, ...interface{}) + +func apply(ef errorf, tr Transformer, tests []test) { for _, test := range tests { out := new(bytes.Buffer) err := tr.Apply(out, strings.NewReader(test.content)) if err != nil { - t.Errorf("Unexpected error: %s", err) + ef("Unexpected error: %s", err) } if test.expected != string(out.Bytes()) { - t.Errorf("Expected:\n%s\nGot:\n%s", test.expected, string(out.Bytes())) + ef("Expected:\n%s\nGot:\n%s", test.expected, string(out.Bytes())) } } } |