mirror of
https://github.com/hanzoskill/sogcli.git
synced 2026-10-30 21:03:29 +00:00
30 lines
748 B
Go
30 lines
748 B
Go
package cli
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestParseRecipients(t *testing.T) {
|
|
tests := []struct {
|
|
input string
|
|
expected []string
|
|
}{
|
|
{"", nil},
|
|
{"[email protected]", []string{"[email protected]"}},
|
|
{"[email protected],[email protected]", []string{"[email protected]", "[email protected]"}},
|
|
{"[email protected], [email protected]", []string{"[email protected]", "[email protected]"}},
|
|
{" [email protected] , [email protected] ", []string{"[email protected]", "[email protected]"}},
|
|
{"[email protected],,[email protected]", []string{"[email protected]", "[email protected]"}},
|
|
{" , , ", []string{}},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
t.Run(tt.input, func(t *testing.T) {
|
|
got := parseRecipients(tt.input)
|
|
assert.Equal(t, tt.expected, got)
|
|
})
|
|
}
|
|
}
|