Skip to content

Commit

Permalink
Fix Apply and test.Suit
Browse files Browse the repository at this point in the history
Signed-off-by: pavel.larkin <[email protected]>
  • Loading branch information
plar committed Feb 12, 2024
1 parent 0f635ad commit 9850f4a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/kopia/cli/internal/flag/flag.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func Apply(cli safecli.CommandAppender, flags ...Applier) error {
if flag == nil { // if the flag is nil, skip it
continue
}
if err := flag.Apply(cli); err != nil {
if err := flag.Apply(sub); err != nil {
return err
}
}
Expand Down
6 changes: 4 additions & 2 deletions pkg/kopia/cli/internal/test/flag_suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ func (t *FlagTest) assertNoError(c *check.C, err error) {

// assertCLI asserts the builder's CLI output against ExpectedCLI.
func (t *FlagTest) assertCLI(c *check.C, b *safecli.Builder) {
c.Check(b.Build(), check.DeepEquals, t.ExpectedCLI, t)
if t.ExpectedCLI != nil {
c.Check(b.Build(), check.DeepEquals, t.ExpectedCLI, t)
}
}

// assertLog asserts the builder's log output against ExpectedLog.
Expand All @@ -74,11 +76,11 @@ func (t *FlagTest) assertLog(c *check.C, b *safecli.Builder) {
// Test runs the flag test.
func (ft *FlagTest) Test(c *check.C, b *safecli.Builder) {
err := flag.Apply(b, ft.Flag)
ft.assertCLI(c, b)
if ft.ExpectedErr != nil {
ft.assertError(c, err)
} else {
ft.assertNoError(c, err)
ft.assertCLI(c, b)
ft.assertLog(c, b)
}
}
Expand Down

0 comments on commit 9850f4a

Please sign in to comment.