mirror of
https://github.com/octoleo/restic.git
synced 2024-11-27 07:16:40 +00:00
ff7ef5007e
The ioutil functions are deprecated since Go 1.17 and only wrap another library function. Thus directly call the underlying function. This commit only mechanically replaces the function calls.
25 lines
486 B
Go
25 lines
486 B
Go
package main
|
|
|
|
import (
|
|
"io"
|
|
"testing"
|
|
)
|
|
|
|
// TestFlags checks for double defined flags, the commands will panic on
|
|
// ParseFlags() when a shorthand flag is defined twice.
|
|
func TestFlags(t *testing.T) {
|
|
for _, cmd := range cmdRoot.Commands() {
|
|
t.Run(cmd.Name(), func(t *testing.T) {
|
|
cmd.Flags().SetOutput(io.Discard)
|
|
err := cmd.ParseFlags([]string{"--help"})
|
|
if err.Error() == "pflag: help requested" {
|
|
err = nil
|
|
}
|
|
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
})
|
|
}
|
|
}
|