summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2018-01-03 01:50:48 +0100
committerDimitri Sokolyuk <demon@dim13.org>2018-01-03 01:50:48 +0100
commitca84f2f360172f52a57bd67a265509df68a13a50 (patch)
treedb2a97ecf6227cead50646844cf8038474aaf0af
parenta576c458be10a0754e5fcd0ee1ac8f01d3ff0be1 (diff)
shorten
-rw-r--r--flood_test.go53
-rw-r--r--href_test.go28
2 files changed, 19 insertions, 62 deletions
diff --git a/flood_test.go b/flood_test.go
index 086292c..175779d 100644
--- a/flood_test.go
+++ b/flood_test.go
@@ -4,50 +4,23 @@ import "testing"
func TestFlood(t *testing.T) {
testCases := []struct {
- line string
- flood bool
+ line string
+ isFlood bool
}{
- {
- line: `! ! ! ! ! ! ! !`,
- flood: true,
- },
- {
- line: `test test test test abc abc`,
- flood: true,
- },
- {
- line: `! test ! test ! test ! test !`,
- flood: true,
- },
- {
- line: `a b c d e f g h i j`,
- flood: false,
- },
- {
- line: `const union __infinity_un __infinity = { { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f } };`,
- flood: false,
- },
- {
- line: `a = b > 3 ? 2 : 4`,
- flood: false,
- },
- {
- line: `AAAAAAAAAAAAAAAAAAAA`,
- flood: true,
- },
- {
- line: `AAAAAAAAAABBBBBBBBBB`,
- flood: true,
- },
- {
- line: `ivy 3 3 rho (iota 9) in 2 6 7 8 9`,
- flood: false,
- },
+ {`! ! ! ! ! ! ! !`, true},
+ {`test test test test abc abc`, true},
+ {`! test ! test ! test ! test !`, true},
+ {`a b c d e f g h i j`, false},
+ {`const union __infinity_un __infinity = { { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f } };`, false},
+ {`a = b > 3 ? 2 : 4`, false},
+ {`AAAAAAAAAAAAAAAAAAAA`, true},
+ {`AAAAAAAAAABBBBBBBBBB`, true},
+ {`ivy 3 3 rho (iota 9) in 2 6 7 8 9`, false},
}
for _, tc := range testCases {
t.Run(tc.line, func(t *testing.T) {
- if isFlood(tc.line) != tc.flood {
- t.Errorf("want %v", tc.flood)
+ if isFlood(tc.line) != tc.isFlood {
+ t.Errorf("want %v", tc.isFlood)
}
})
}
diff --git a/href_test.go b/href_test.go
index 430eafc..7ce72a1 100644
--- a/href_test.go
+++ b/href_test.go
@@ -4,29 +4,13 @@ import "testing"
func TestTitle(t *testing.T) {
testCases := []struct {
- url string
- title string
+ url, title string
}{
- {
- url: `https://www.linux.org.ru`,
- title: `LINUX.ORG.RU - Русская информация об ОС Linux`,
- },
- {
- url: `http://www.opennet.ru`,
- title: `Проект OpenNet - всё, что связано с открытым ПО, открытыми технологиями, Linux, BSD и Unix`,
- },
- {
- url: `http://www.openbsd.org`,
- title: `OpenBSD`,
- },
- {
- url: `http://undeadly.org`,
- title: `OpenBSD Journal: A resource for the OpenBSD community`,
- },
- {
- url: `https://github.com/dls/house/blob/master/kernel/SimpleExec.hs`,
- title: `house/SimpleExec.hs at master · dls/house · GitHub`,
- },
+ {`https://www.linux.org.ru`, `LINUX.ORG.RU - Русская информация об ОС Linux`},
+ {`http://www.opennet.ru`, `Проект OpenNet - всё, что связано с открытым ПО, открытыми технологиями, Linux, BSD и Unix`},
+ {`http://www.openbsd.org`, `OpenBSD`},
+ {`http://undeadly.org`, `OpenBSD Journal: A resource for the OpenBSD community`},
+ {`https://github.com/dls/house/blob/master/kernel/SimpleExec.hs`, `house/SimpleExec.hs at master · dls/house · GitHub`},
}
for _, tc := range testCases {
t.Run(tc.url, func(t *testing.T) {