Skip to content

Commit

Permalink
fixup! feat: improve missing formatter test
Browse files Browse the repository at this point in the history
Signed-off-by: Brian McGee <[email protected]>
  • Loading branch information
brianmcgee committed Oct 21, 2024
1 parent 9d521a9 commit 7909b55
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions cmd/root_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,22 +156,25 @@ func TestAllowMissingFormatter(t *testing.T) {
},
})

// default
treefmt2(t,
withError(func(err error) {
as.ErrorIs(err, format.ErrCommandNotFound)
}),
)
t.Run("default", func(t *testing.T) {
treefmt2(t,
withError(func(err error) {
as.ErrorIs(err, format.ErrCommandNotFound)
}),
)
})

// arg
treefmt2(t,
withArgs("--allow-missing-formatter"),
withNoError(as),
)
t.Run("arg", func(t *testing.T) {
treefmt2(t,
withArgs("--allow-missing-formatter"),
withNoError(as),
)
})

// env
t.Setenv("TREEFMT_ALLOW_MISSING_FORMATTER", "true")
treefmt2(t, withNoError(as))
t.Run("env", func(t *testing.T) {
t.Setenv("TREEFMT_ALLOW_MISSING_FORMATTER", "true")
treefmt2(t, withNoError(as))
})
}

func TestSpecifyingFormatters(t *testing.T) {
Expand Down

0 comments on commit 7909b55

Please sign in to comment.