diff --git a/tests/exec.go b/tests/exec.go index 3d70015..7a9cf48 100644 --- a/tests/exec.go +++ b/tests/exec.go @@ -26,6 +26,12 @@ func Exec(o *option.Option) { ginkgo.AfterEach(func() { command.RemoveAll(o) }) + + ginkgo.It("should not panic when exec without arguments", func() { + // Test finch exec without arguments - should show help, not panic + session := command.New(o, "exec").WithoutCheckingExitCode().Run() + gomega.Expect(session.Out.Contents()).ShouldNot(gomega.BeEmpty()) // Should have output + }) // TODO: specifying -t flag will have error in test -> panic: provided file is not a console ginkgo.When("then container is running", func() { ginkgo.BeforeEach(func() { diff --git a/tests/run.go b/tests/run.go index 7286403..f6b8057 100644 --- a/tests/run.go +++ b/tests/run.go @@ -46,6 +46,12 @@ func Run(o *RunOption) { command.RemoveAll(o.BaseOpt) }) + ginkgo.It("should not panic when run without arguments", func() { + // Test finch run without arguments - should show help, not panic + session := command.New(o.BaseOpt, "run").WithoutCheckingExitCode().Run() + gomega.Expect(session.Out.Contents()).ShouldNot(gomega.BeEmpty()) // Should have output + }) + ginkgo.When("running a container that echos dummy output", func() { ginkgo.BeforeEach(func() { dockerfile := fmt.Sprintf(`FROM %s