mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
gnu: go-github-com-urfave-cli-v2: Fix tests when building with Go 1.17.
* gnu/packages/patches/go-github-com-urfave-cli-v2-fix-tests.patch: New file. * gnu/local.mk (dist_patch_DATA): Register it. * gnu/packages/golang.scm (go-github-com-urfave-cli-v2)[origin]: Apply it. Signed-off-by: Leo Famulari <leo@famulari.name>
This commit is contained in:
parent
f161f111e0
commit
63cc4dd579
3 changed files with 42 additions and 1 deletions
|
@ -0,0 +1,37 @@
|
|||
From upstream PR: https://github.com/urfave/cli/pull/1299
|
||||
|
||||
From: William Wilson <william.wilson@canonical.com>
|
||||
Date: Tue, 31 Aug 2021 14:19:17 -0500
|
||||
Subject: Make test case compatible with Go 1.17
|
||||
|
||||
As of Go 1.17, the go flag package will panic if given a syntactically invalid
|
||||
flag. This causes TestApp_RunAsSubCommandIncorrectUsage to panic and therefore
|
||||
fail. See https://golang.org/doc/go1.17#flag for more information.
|
||||
|
||||
---
|
||||
diff --git a/app_test.go b/app_test.go
|
||||
index 7c38f6048..76e211d68 100644
|
||||
--- a/app_test.go
|
||||
+++ b/app_test.go
|
||||
@@ -476,18 +476,18 @@ func TestApp_RunAsSubCommandIncorrectUsage(t *testing.T) {
|
||||
a := App{
|
||||
Name: "cmd",
|
||||
Flags: []Flag{
|
||||
- &StringFlag{Name: "--foo"},
|
||||
+ &StringFlag{Name: "foo"},
|
||||
},
|
||||
Writer: bytes.NewBufferString(""),
|
||||
}
|
||||
|
||||
set := flag.NewFlagSet("", flag.ContinueOnError)
|
||||
- _ = set.Parse([]string{"", "---foo"})
|
||||
+ _ = set.Parse([]string{"", "-bar"})
|
||||
c := &Context{flagSet: set}
|
||||
|
||||
err := a.RunAsSubcommand(c)
|
||||
|
||||
- expect(t, err, errors.New("bad flag syntax: ---foo"))
|
||||
+ expect(t, err.Error(), "flag provided but not defined: -bar")
|
||||
}
|
||||
|
||||
func TestApp_CommandWithFlagBeforeTerminator(t *testing.T) {
|
Loading…
Add table
Add a link
Reference in a new issue