-
-
Notifications
You must be signed in to change notification settings - Fork 72
Expand file tree
/
Copy pathmain_test.go
More file actions
33 lines (25 loc) · 691 Bytes
/
main_test.go
File metadata and controls
33 lines (25 loc) · 691 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package main
import (
"flag"
"strings"
"testing"
"github.com/gruntwork-io/git-xargs/cmd"
"github.com/stretchr/testify/assert"
"github.com/urfave/cli"
)
func TestSetupApp(t *testing.T) {
app := setupApp()
assert.NotNil(t, app)
}
func TestGitXargsShowsHelpTextForEmptyArgs(t *testing.T) {
app := setupApp()
// Capture the app's stdout
var stdout strings.Builder
app.Writer = &stdout
emptyFlagSet := flag.NewFlagSet("git-xargs-test", flag.ContinueOnError)
emptyTestContext := cli.NewContext(app, emptyFlagSet, nil)
err := cmd.RunGitXargs(emptyTestContext)
// Make sure we see the help text
assert.NoError(t, err)
assert.Contains(t, stdout.String(), app.Description)
}