Merge pull request 'Create main.go CLI entry point at cmd/testbed2/main.go' (#10) from issue-6-main-cli into scaffold-go-cli
This commit is contained in:
commit
316df86029
2 changed files with 17 additions and 2 deletions
15
cmd/testbed2/main.go
Normal file
15
cmd/testbed2/main.go
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/marmaduke/testbed2/pkg/cli"
|
||||
)
|
||||
|
||||
func main() {
|
||||
if err := cli.Run(os.Args[1:]); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "error: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
|
@ -48,13 +48,13 @@ func TestRunOutput(t *testing.T) {
|
|||
r, w, _ := os.Pipe()
|
||||
os.Stdout = w
|
||||
|
||||
Run([]string{})
|
||||
_ = Run([]string{})
|
||||
|
||||
w.Close()
|
||||
os.Stdout = oldStdout
|
||||
|
||||
buf := new(bytes.Buffer)
|
||||
buf.ReadFrom(r)
|
||||
_, _ = buf.ReadFrom(r)
|
||||
if buf.Len() == 0 {
|
||||
t.Fatal("expected output")
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue