-
Notifications
You must be signed in to change notification settings - Fork 5
/
prepare_test.go
34 lines (28 loc) · 765 Bytes
/
prepare_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
package main
import (
"github.com/integrii/flaggy"
"github.com/stretchr/testify/assert"
"os"
"testing"
)
/**
This will load the dep.yml file of depcharge
*/
func TestLoad(t *testing.T) {
results := load()
assert.NotEmpty(t, results)
assert.Equal(t, 1, len(results.Deps))
assert.True(t, len(results.Deps[0].DepList) > 3)
}
func TestProcessArgs(t *testing.T) {
oldArgs := os.Args
os.Args = []string{"", "--kind=git", "--inclusive", "--dryrun", "--labels=some,thing", "--", "status"}
results := processArgs()
assert.Equal(t, "git", results.Kind)
assert.Equal(t, "some,thing", results.Labels)
assert.Equal(t, "status", results.Action[0])
assert.True(t, results.DryRun)
assert.False(t, results.Exclusive)
os.Args = oldArgs
flaggy.ResetParser()
}