forked from pacedotdev/oto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain_test.go
44 lines (38 loc) · 797 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
package main
import (
"bytes"
"strings"
"testing"
"github.com/matryer/is"
)
func Test(t *testing.T) {
is := is.New(t)
var buf bytes.Buffer
args := []string{
"oto",
"-template=./testdata/template.plush",
"-pkg=stuff",
"./testdata/services/pleasantries",
}
err := run(&buf, args)
is.NoErr(err)
s := buf.String()
for _, should := range []string{
"GreeterService.GetGreetings",
"GreeterService.Greet",
"Welcomer.Welcome",
} {
if !strings.Contains(s, should) {
t.Errorf("missing: %s", should)
is.Fail()
}
}
}
func TestParseParams(t *testing.T) {
is := is.New(t)
params, err := parseParams("key1:value1,key2: value2 , key3:value3")
is.NoErr(err)
is.Equal(params["key1"], "value1")
is.Equal(params["key2"], "value2")
is.Equal(params["key3"], "value3")
}