Skip to content

Commit

Permalink
refactor TestBuildTimeFlag's cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
satotake committed Apr 25, 2022
1 parent dc25c77 commit 73c39bd
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions commands/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,13 @@ func captureStdout(f func() error) (string, error) {
func TestListAll(t *testing.T) {
c := qt.New(t)
dir, clean, err := createSimpleTestSite(t, testSiteConfig{})
defer clean()
t.Cleanup(clean)

c.Assert(err, qt.IsNil)

hugoCmd := newCommandsBuilder().addAll().build()
cmd := hugoCmd.getCommand()

defer func() {
os.RemoveAll(dir)
}()

cmd.SetArgs([]string{"-s=" + dir, "list", "all"})

out, err := captureStdout(func() error {
Expand Down Expand Up @@ -84,17 +80,13 @@ date: 2100-11-06
Content
`)
defer clean()
t.Cleanup(clean)

c.Assert(err, qt.IsNil)

hugoCmd := newCommandsBuilder().addAll().build()
cmd := hugoCmd.getCommand()

defer func() {
os.RemoveAll(dir)
}()

cmd.SetArgs([]string{"-s=" + dir, "list", "future"})

out, err := captureStdout(func() error {
Expand Down

0 comments on commit 73c39bd

Please sign in to comment.