Skip to content

Commit

Permalink
Update test to use new assert package
Browse files Browse the repository at this point in the history
original PR was from prior to the switch from `require` to `assert` for tests (in this commit 8b82618)

Just change to using `assert` in keeping with the rebase
  • Loading branch information
keilin-anz authored and alecthomas committed Mar 5, 2024
1 parent 2f0bdbb commit 3957ac6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions help_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,9 @@ Commands:
//
// MUST retain original behaviour by default (see "default" sub test)
// MUST show optional subcommand flags when SubcommandsWithOptionalFlags
// is enabled (see "forced" sub test)
//
// is enabled (see "forced" sub test)
//
// MUST show any _required_ parent flags on subcommands
// MUST NOT show any optional parent flags on subcommands
func TestSubcommandsWithOptionalFlags(t *testing.T) {
Expand Down Expand Up @@ -406,7 +408,7 @@ func TestSubcommandsWithOptionalFlags(t *testing.T) {
t.Run("default", func(t *testing.T) {
expected := "Usage: test-app <command>\n\nA test app.\n\nFlags:\n -h, --help Show context-sensitive help.\n\nCommands:\n sub more-sub --mandatory=STRING --required=STRING\n more sub help\n\n sub another --mandatory=STRING\n another help\n\nRun \"test-app <command> --help\" for more information on a command.\n"
_, _ = app.Parse([]string{"--help"})
require.Equal(t, expected, w.String())
assert.Equal(t, expected, w.String())
})

w.Truncate(0)
Expand All @@ -424,7 +426,7 @@ func TestSubcommandsWithOptionalFlags(t *testing.T) {
t.Run("forced", func(t *testing.T) {
expected := "Usage: test-app <command>\n\nA test app.\n\nFlags:\n -h, --help Show context-sensitive help.\n\nCommands:\n sub more-sub --mandatory=STRING --required=STRING [--flag=STRING]\n more sub help\n\n sub another --mandatory=STRING\n another help\n\nRun \"test-app <command> --help\" for more information on a command.\n"
_, _ = app.Parse([]string{"--help"})
require.Equal(t, expected, w.String())
assert.Equal(t, expected, w.String())
})
}

Expand Down

0 comments on commit 3957ac6

Please sign in to comment.