This commit is contained in:
parent
bc785524a5
commit
e01b0b3951
1 changed files with 21 additions and 10 deletions
|
@ -8,18 +8,29 @@ import (
|
|||
)
|
||||
|
||||
func TestExec(t *testing.T) {
|
||||
assert.Equal(t, cli.Exec(nil), 2)
|
||||
assert.Equal(t, cli.Exec([]string{"_"}), 2)
|
||||
assert.Equal(t, cli.Exec([]string{"build", "../../examples/hello", "--dry"}), 0)
|
||||
assert.Equal(t, cli.Exec([]string{"build", "../../examples/hello/hello.q", "--dry"}), 0)
|
||||
assert.Equal(t, cli.Exec([]string{"build", "../../examples/hello", "--dry", "--os", "linux", "--arch", "arm"}), 0)
|
||||
assert.Equal(t, cli.Exec([]string{"build", "../../examples/hello", "--dry", "--os", "linux", "--arch", "x86"}), 0)
|
||||
assert.Equal(t, cli.Exec([]string{"build", "../../examples/hello", "--dry", "--os", "mac", "--arch", "arm"}), 0)
|
||||
assert.Equal(t, cli.Exec([]string{"build", "../../examples/hello", "--dry", "--os", "mac", "--arch", "x86"}), 0)
|
||||
assert.Equal(t, cli.Exec([]string{"build", "../../examples/hello", "--dry", "--os", "windows", "--arch", "arm"}), 0)
|
||||
assert.Equal(t, cli.Exec([]string{"build", "../../examples/hello", "--dry", "--os", "windows", "--arch", "x86"}), 0)
|
||||
assert.Equal(t, cli.Exec([]string{"help"}), 0)
|
||||
}
|
||||
|
||||
func TestExecErrors(t *testing.T) {
|
||||
assert.Equal(t, cli.Exec([]string{"build"}), 1)
|
||||
assert.Equal(t, cli.Exec([]string{"run"}), 1)
|
||||
}
|
||||
|
||||
func TestExecWrongParameters(t *testing.T) {
|
||||
assert.Equal(t, cli.Exec(nil), 2)
|
||||
assert.Equal(t, cli.Exec([]string{"_"}), 2)
|
||||
assert.Equal(t, cli.Exec([]string{"build", "--invalid-parameter"}), 2)
|
||||
assert.Equal(t, cli.Exec([]string{"build", "../../examples/hello", "--invalid-parameter"}), 2)
|
||||
assert.Equal(t, cli.Exec([]string{"build", "../../examples/hello", "--dry"}), 0)
|
||||
assert.Equal(t, cli.Exec([]string{"build", "../../examples/hello", "--dry", "--os", "linux"}), 0)
|
||||
assert.Equal(t, cli.Exec([]string{"build", "../../examples/hello", "--dry", "--os", "mac"}), 0)
|
||||
assert.Equal(t, cli.Exec([]string{"build", "../../examples/hello", "--dry", "--os", "windows"}), 0)
|
||||
assert.Equal(t, cli.Exec([]string{"build", "../../examples/hello", "--dry", "--arch", "arm"}), 0)
|
||||
assert.Equal(t, cli.Exec([]string{"build", "../../examples/hello", "--dry", "--arch", "x86"}), 0)
|
||||
assert.Equal(t, cli.Exec([]string{"build", "../../examples/hello/hello.q", "--dry"}), 0)
|
||||
assert.Equal(t, cli.Exec([]string{"help"}), 0)
|
||||
assert.Equal(t, cli.Exec([]string{"build", "../../examples/hello", "--os"}), 2)
|
||||
assert.Equal(t, cli.Exec([]string{"build", "../../examples/hello", "--os", "invalid-os"}), 2)
|
||||
assert.Equal(t, cli.Exec([]string{"build", "../../examples/hello", "--arch"}), 2)
|
||||
assert.Equal(t, cli.Exec([]string{"build", "../../examples/hello", "--arch", "invalid-arch"}), 2)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue