Skip to content

Commit

Permalink
enhance testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Songmu committed Dec 25, 2017
1 parent cd60513 commit 2c6b7db
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
14 changes: 8 additions & 6 deletions cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ func TestCliRun(t *testing.T) {
files: []string{"abc_linux_amd64.tar.gz"},
},
{
name: "output option",
input: []string{"-o=abc", "-os=freebsd", "./testdata/hello"},
files: []string{"goxz_freebsd_amd64.tar.gz"},
name: "output option with version",
input: []string{"-o=abc", "-C=.", "-pv=0.1.1", "-os=freebsd", "./testdata/hello"},
files: []string{"goxz_0.1.1_freebsd_amd64.tar.gz"},
},
{
name: "[error] no resulting object",
input: []string{"."},
input: []string{}, // same as []string{"."}
errStr: "No binaries are built",
},
{
Expand All @@ -57,7 +57,7 @@ func TestCliRun(t *testing.T) {
},
{
name: "[error] package not exists",
input: []string{"./testdata/hello___"},
input: []string{"-work", "./testdata/hello___"},
errStr: "can't load package",
},
}
Expand Down Expand Up @@ -93,7 +93,9 @@ func TestCliRun(t *testing.T) {
}
var outs []string
for _, f := range files {
outs = append(outs, f.Name())
if !f.IsDir() {
outs = append(outs, f.Name())
}
}
sort.Strings(tc.files)
sort.Strings(outs)
Expand Down
6 changes: 6 additions & 0 deletions goxz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ func TestResolvePlatforms(t *testing.T) {
inArch: "amd64 386",
expect: []platform{},
},
{
name: "empty Arch",
inOS: "linux",
inArch: "",
expect: []platform{},
},
{
name: "mixed separators",
inOS: "linux ,windows darwin ",
Expand Down

0 comments on commit 2c6b7db

Please sign in to comment.