Skip to content

Commit

Permalink
Merge branch 'kopia-cli-core-infra' into kopia-cli-common-flags
Browse files Browse the repository at this point in the history
  • Loading branch information
plar authored Feb 12, 2024
2 parents 246e1c1 + 9850f4a commit 419652c
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 @@ -57,7 +57,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 @@ -69,11 +71,11 @@ func (t *FlagTest) assertLog(c *check.C, b *safecli.Builder) {
// Test runs the flag test.
func (t *FlagTest) Test(c *check.C, b *safecli.Builder) {
err := flag.Apply(b, t.Flag)
t.assertCLI(c, b)
if t.ExpectedErr != nil {
t.assertError(c, err)
} else {
t.assertNoError(c, err)
t.assertCLI(c, b)
t.assertLog(c, b)
}
}
Expand Down

0 comments on commit 419652c

Please sign in to comment.