-
Notifications
You must be signed in to change notification settings - Fork 0
/
flag_test.go
51 lines (40 loc) · 1.11 KB
/
flag_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
50
51
package main
import (
"os"
"testing"
)
func TestProcessFlagsVersion(t *testing.T) {
os.Args = []string{"audioc", "-version"}
if _, cont := configFromFlags(); cont == true {
t.Errorf("Expected %v, got %v", false, cont)
}
}
func TestProcessFlagsUsage(t *testing.T) {
os.Args = []string{"audioc"}
if _, cont := configFromFlags(); cont == true {
t.Errorf("Expected %v, got %v", false, cont)
}
}
func TestProcessFlagsNoArtistOrCollection(t *testing.T) {
os.Args = []string{"audioc", "."}
if _, cont := configFromFlags(); cont == true {
t.Errorf("Expected %v, got %v", false, cont)
}
}
func TestProcessFlagsArtist(t *testing.T) {
os.Args = []string{"audioc", "--artist", "Grateful Dead", "."}
c, cont := configFromFlags()
if cont == false {
t.Errorf("Expected %v, got %v", true, cont)
}
if c.Artist != os.Args[2] {
t.Errorf("Expected %v, got %v", os.Args[2], c.Artist)
}
}
func TestProcessFlagsCollection(t *testing.T) {
os.Args = []string{"audioc", "--collection", "."}
_, cont := configFromFlags()
if cont == false {
t.Errorf("Expected %v, got %v", true, cont)
}
}