unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
blob 87ccc2b6555936c046d75b634a097838de1d415c 1156 bytes (raw)
name: gnu/packages/patches/go-github-com-urfave-cli-v2-fix-tests.patch 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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) {

debug log:

solving 87ccc2b655 ...
found 87ccc2b655 in https://git.savannah.gnu.org/cgit/guix.git

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).