gitee.com/mirrors/goreporter@v0.0.0-20180902115603-df1b20f7c5d0/linters/spellcheck/misspell/notwords_test.go (about) 1 package misspell 2 3 import ( 4 "testing" 5 ) 6 7 func TestNotWords(t *testing.T) { 8 cases := []struct { 9 word string 10 want string 11 }{ 12 {" /foo/bar abc", " abc"}, 13 {"X/foo/bar abc", "X/foo/bar abc"}, 14 {"[/foo/bar] abc", "[ ] abc"}, 15 {"/", "/"}, 16 {"x nickg@client9.xxx y", "x y"}, 17 {"x infinitie.net y", "x y"}, 18 {"(s.svc.GetObject(", "( ("}, 19 } 20 for pos, tt := range cases { 21 got := RemoveNotWords(tt.word) 22 if got != tt.want { 23 t.Errorf("%d want %q got %q", pos, tt.want, got) 24 } 25 } 26 }