forked from WindomZ/go-commander
-
Notifications
You must be signed in to change notification settings - Fork 0
/
options_test.go
38 lines (33 loc) · 1.02 KB
/
options_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
package commander
import (
"github.com/WindomZ/testify/assert"
"testing"
)
func TestOptions_UsagesString(t *testing.T) {
var o _Options
o = _Options{}
assert.Equal(t, o.UsagesString(), []string(nil))
o = _Options{
newOption("-a, --about", "about description"),
newOption("-b=<kn>, --bold=<kn>", "bold description"),
newOption("-c, --config", "config description"),
newOption("-d, --drop", "drop description"),
}
assert.Equal(t, o.UsagesString(),
[]string{"[-a|--about] [-b=<kn>|--bold=<kn>] [-c|--config] [-d|--drop]"})
}
func TestOptions_OptionsString(t *testing.T) {
o := _Options{
newOption("-a, --about", "about description"),
newOption("-b=<kn>, --bold=<kn>", "bold description"),
newOption("-c, --config", "config description"),
newOption("-d, --drop", "drop description"),
}
assert.Equal(t, o.OptionsString(),
[]string{
"-a --about about description",
"-b=<kn> --bold=<kn>\n bold description",
"-c --config config description",
"-d --drop drop description",
})
}