-
Notifications
You must be signed in to change notification settings - Fork 26
/
jump_test.go
30 lines (27 loc) · 936 Bytes
/
jump_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package wishlist
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestSplitJump(t *testing.T) {
for jump, expected := range map[string]struct {
user, addr string
}{
"foo": {addr: "foo:22"},
"foo:22": {addr: "foo:22"},
"foo:2234": {addr: "foo:2234"},
"user@foo": {user: "user", addr: "foo:22"},
"user@foo:22": {user: "user", addr: "foo:22"},
"user@foo:2223": {user: "user", addr: "foo:2223"},
"user@bar@foo:22": {user: "user@bar", addr: "foo:22"},
"user@bar@zaz@foo:22": {user: "user@bar@zaz", addr: "foo:22"},
"user@bar@zaz@foo": {user: "user@bar@zaz", addr: "foo:22"},
"user@bar@zaz@foo:2323": {user: "user@bar@zaz", addr: "foo:2323"},
} {
t.Run(jump, func(t *testing.T) {
user, addr := splitJump(jump)
require.Equal(t, expected.user, user)
require.Equal(t, expected.addr, addr)
})
}
}