-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #37: Fields in embedded struct should always be shadowed by fie…
…lds in outer struct
- Loading branch information
Showing
2 changed files
with
31 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -92,6 +92,30 @@ func Test_structValue_columns(t *testing.T) { | |
assert.Equal(t, map[string]interface{}{"Name": "abc"}, cols) | ||
} | ||
|
||
func TestIssue37(t *testing.T) { | ||
customer := Customer{ | ||
ID: 1, | ||
Name: "abc", | ||
Status: 2, | ||
Email: "[email protected]", | ||
} | ||
ev := struct{ | ||
Customer | ||
Status string | ||
} {customer, "20"} | ||
sv := newStructValue(&ev, nil) | ||
cols := sv.columns([]string{"ID", "Status"}, nil) | ||
assert.Equal(t, map[string]interface{}{"ID": 1, "Status": "20"}, cols) | ||
|
||
ev2 := struct{ | ||
Status string | ||
Customer | ||
} {"20", customer} | ||
sv = newStructValue(&ev2, nil) | ||
cols = sv.columns([]string{"ID", "Status"}, nil) | ||
assert.Equal(t, map[string]interface{}{"ID": 1, "Status": "20"}, cols) | ||
} | ||
|
||
type MyCustomer struct{} | ||
|
||
func Test_getTableName(t *testing.T) { | ||
|