From 78a016e84313041ae00999a981ce5d8e1f3d6d64 Mon Sep 17 00:00:00 2001 From: upstream Date: Fri, 4 Sep 2026 09:31:42 +0200 Subject: [PATCH] Upstream urfave/cli state of the touched files before 10fa7c790d --- cli_test.go | 21 --------------------- flag.go | 2 +- 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/cli_test.go b/cli_test.go index 068208b..ab79c43 100644 --- a/cli_test.go +++ b/cli_test.go @@ -727,24 +727,3 @@ func TestDecoder(t *testing.T) { assert.Nil(t, flagSet.err) assert.Equal(t, v.D, customT{K1: "string", K2: 2}) } - -func TestMapMultiCharSep(t *testing.T) { - // A multi-character separator must not leak its tail into the value. - if k, v, _ := splitKeyVal("key=>val", "=>"); k != "key" || v != "val" { - t.Errorf(`splitKeyVal("key=>val", "=>") = (%q, %q), want ("key", "val")`, k, v) - } - - // Public API: a map flag configured with a multi-char sep. - type T struct { - Map map[string]string `cli:"m" sep:"=>"` - } - clr := color.Color{} - v := new(T) - flagSet := parseArgv([]string{"-mkey=>val"}, v, clr) - if flagSet.err != nil { - t.Fatalf("unexpected error: %v", flagSet.err) - } - if got := v.Map["key"]; got != "val" { - t.Errorf(`map value = %q, want "val"`, got) - } -} diff --git a/flag.go b/flag.go index b57c0e4..55b71cf 100644 --- a/flag.go +++ b/flag.go @@ -436,7 +436,7 @@ func splitKeyVal(s, sep string) (key, val string, err error) { if index == -1 { return s, "", nil } - return s[:index], s[index+len(sep):], nil + return s[:index], s[index+1:], nil } func minmaxIntCheck(kind reflect.Kind, v int64) bool {