-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain_test.go
35 lines (31 loc) · 1.07 KB
/
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
package main
import (
. "github.com/smartystreets/goconvey/convey"
"testing"
)
func TestSetOptsFromArgs(t *testing.T) {
Convey("When 1 argument is passed", t, func() {
Convey("A CfgName option should be set, a Key and Value should not", func() {
setOptsFromArgs([]string{"testCfg"})
So(Options.CfgName, ShouldEqual, "testCfg")
So(string(Options.Key), ShouldEqual, "")
So(string(Options.Value), ShouldEqual, "")
})
})
Convey("When 2 arguments are passed", t, func() {
Convey("A CfgName and Key option should be set", func() {
setOptsFromArgs([]string{"testCfg", "some key"})
So(Options.CfgName, ShouldEqual, "testCfg")
So(string(Options.Key), ShouldEqual, "some key")
So(string(Options.Value), ShouldEqual, "")
})
})
Convey("When 3 arguments are passed", t, func() {
Convey("CfgName, Key, and Value options should be set", func() {
setOptsFromArgs([]string{"testCfg", "some key", "some value"})
So(Options.CfgName, ShouldEqual, "testCfg")
So(Options.Key, ShouldEqual, "some key")
So(string(Options.Value), ShouldEqual, "some value")
})
})
}