Skip to content

Commit

Permalink
Added missing test for passing flags as argument to command.
Browse files Browse the repository at this point in the history
  • Loading branch information
kristofferahl committed Mar 5, 2021
1 parent 48b93cb commit 813ae3a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions cmd/centry/runtime_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@ func TestMain(t *testing.T) {
out := execQuiet("commandtest foo bar")
test.AssertStringContains(g, out.Stdout, expected)
})

g.It("should pass any flags followed by -- as arguments", func() {
expected := "command args (--foo bar)"
out := execQuiet("commandtest -- --foo bar")
test.AssertStringContains(g, out.Stdout, expected)
})
})

g.Describe("without arguments", func() {
Expand All @@ -129,6 +135,12 @@ func TestMain(t *testing.T) {
out := execQuiet("commandtest subcommand foo bar")
test.AssertStringContains(g, out.Stdout, expected)
})

g.It("should pass any flags followed by -- as arguments", func() {
expected := "subcommand args (--foo bar)"
out := execQuiet("commandtest subcommand -- --foo bar")
test.AssertStringContains(g, out.Stdout, expected)
})
})

g.Describe("without arguments", func() {
Expand Down

0 comments on commit 813ae3a

Please sign in to comment.