From b21d280c675242c42245c1a7a5e00fb1610904e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Sat, 6 Feb 2016 20:50:26 +0100 Subject: transform: Complete test statement coverage "coverage: 100.0% of statements" --- transform/absurlreplacer.go | 9 +++------ transform/chain_test.go | 5 ++++- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'transform') diff --git a/transform/absurlreplacer.go b/transform/absurlreplacer.go index b834bcdcc..8e8269a05 100644 --- a/transform/absurlreplacer.go +++ b/transform/absurlreplacer.go @@ -85,9 +85,9 @@ func (l *absurllexer) match(r rune) { if r == p.r[l.idx] { l.matches[j] = true found = true - if l.checkMatchState(r, j) { - return - } + // checkMatchState will only return true when r=='=', so + // we can safely ignore the return value here. + l.checkMatchState(r, j) } } @@ -249,9 +249,6 @@ func (l *absurllexer) replace() { l.matches[i] = false } } - if p == nil { - panic("illegal state: curr is nil when state is full") - } l.ms = matchStateNone p.f(l) } diff --git a/transform/chain_test.go b/transform/chain_test.go index 8ac3b6bc1..9a133a857 100644 --- a/transform/chain_test.go +++ b/transform/chain_test.go @@ -36,6 +36,9 @@ const H5_XML_CONTENT_GUARDED = "Schemaless. normal. Post.` @@ -94,7 +97,7 @@ var xml_abs_url_bench_tests = []test{ {H5_XML_CONTENT_GUARDED, H5_XML_CONTENT_GUARDED}, } -var sanity_tests = []test{{REPLACE_1, REPLACE_1}, {REPLACE_2, REPLACE_2}} +var sanity_tests = []test{{REPLACE_1, REPLACE_1}, {REPLACE_2, REPLACE_2}, {REPLACE_3, REPLACE_3}, {REPLACE_4, REPLACE_4}, {REPLACE_5, REPLACE_5}} var extra_tests_html = []test{{REPLACE_SCHEMALESS_HTML, REPLACE_SCHEMALESS_HTML_CORRECT}} var abs_url_tests = append(abs_url_bench_tests, append(sanity_tests, extra_tests_html...)...) var extra_tests_xml = []test{{REPLACE_SCHEMALESS_XML, REPLACE_SCHEMALESS_XML_CORRECT}} -- cgit v1.2.3