emailextract_test.go
von paedubucher- SNIPPET_DESC:
- Testfälle für emailextract.go
- SNIPPET_CREATION_TIME:
- 19.06.2022 17:25:40
- SNIPPET_PRUNE_TIME:
- Unendlich
- SNIPPET_TEXT:
-
- package dfdegoregexp
- import "testing"
- type testCase struct {
- email, desc string
- }
- var tests = []testCase{
- {"joey@foobar.com", "Joey, FOOBAR"},
- {"harry.callahan@sfpd.gov", "Harry Callahan, SFPD"},
- {"homer.simpson69@aol.com", "Homer Simpson, *1969, AOL"},
- {"stan.marsh2012@southpark.com", "Stan Marsh, *2012, SOUTHPARK"},
- {"julius.caesar@rom.it", "Julius Caesar, ROM"},
- }
- func TestEmailExtract(t *testing.T) {
- for _, test := range tests {
- expected := test.desc
- actual := Extract(test.email)
- if actual != expected {
- t.Errorf(`Extract("%s"): expected "%s", got "%s"`, test.email, expected, actual)
- }
- }
- }
Quellcode
Hier kannst du den Code kopieren und ihn in deinen bevorzugten Editor einfügen. PASTEBIN_DOWNLOAD_SNIPPET_EXPLAIN