forked from prep/pubsubc
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain_test.go
49 lines (45 loc) · 1003 Bytes
/
main_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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package main
import (
"reflect"
"testing"
)
func Test_parseEnv(t *testing.T) {
type args struct {
env string
}
type test struct {
name string
args args
want Topics
want1 string
}
tests := []test {
test {
name : "single",
args : args {
env: "project1,topic1,topic2>subscription1",
},
want : Topics{"topic1": []string{}, "topic2": []string{"subscription1"} },
want1 : "project1",
},
test {
name : "with push configs",
args : args {
env: "project1,topic1,topic2>subscription1@http://localhost:3333",
},
want : Topics{"topic1": []string{}, "topic2": []string{"subscription1@http://localhost:3333"} },
want1 : "project1",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, got1 := ParseEnv(tt.args.env)
if !reflect.DeepEqual(got, tt.want) {
t.Errorf("ParseEnv() got = %v, want %v", got, tt.want)
}
if got1 != tt.want1 {
t.Errorf("ParseEnv() got1 = %v, want %v", got1, tt.want1)
}
})
}
}