summaryrefslogtreecommitdiff
path: root/parse_test.go
diff options
context:
space:
mode:
authorAlex Flint <[email protected]>2020-01-24 14:30:29 -0800
committerAlex Flint <[email protected]>2020-01-24 14:30:29 -0800
commit711618869d25f9f1851bb18d4792c3f46ef9821b (patch)
tree0248ea715bc56f9884b1b7d0ec9cbcecfc75ca2b /parse_test.go
parent7e2466d70798086a87f82713cfba49dae0af494f (diff)
fix issue with duplicate fields in embedded structs
Diffstat (limited to 'parse_test.go')
-rw-r--r--parse_test.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/parse_test.go b/parse_test.go
index f75d1a7..ff521ae 100644
--- a/parse_test.go
+++ b/parse_test.go
@@ -910,6 +910,23 @@ func TestEmbeddedPtrIgnored(t *testing.T) {
assert.Equal(t, 321, args.Y)
}
+func TestEmbeddedWithDuplicateField(t *testing.T) {
+ // see https://github.com/alexflint/go-arg/issues/100
+ type T struct {
+ A string
+ }
+ type U struct {
+ A string
+ }
+ var args struct {
+ T
+ U
+ }
+
+ err := parse("", &args)
+ require.NoError(t, err)
+}
+
func TestEmptyArgs(t *testing.T) {
origArgs := os.Args