Test that what is well-formed and means one thing loads: ignored parts, constant samples, any JSON value, weight 0, an unread name, a stray rows file, a tagless struct and flags with no effect

This commit is contained in:
2026-10-07 23:33:22 +02:00
committed by Lillem4n
parent 5f8981b14f
commit 052a52fc7a
11 changed files with 94 additions and 82 deletions
+7 -1
View File
@@ -253,6 +253,13 @@ func TestFakeStructTakesTheDatatypeItsGoTypeSets(t *testing.T) {
}
}
func TestFakeStructWithNoTagsFillsNothing(t *testing.T) {
v := struct{ A string }{A: "kept"}
if err := structData(t).FakeStruct(&v); err != nil || v.A != "kept" {
t.Errorf("FakeStruct = %+v, %v, want nothing filled", v, err)
}
}
func TestFakeStructErrors(t *testing.T) {
f := structData(t)
for _, c := range []struct {
@@ -263,7 +270,6 @@ func TestFakeStructErrors(t *testing.T) {
{(*structUser)(nil), "through a non-nil pointer"},
{new(int), "through a non-nil pointer"},
{nil, "through a non-nil pointer"},
{&struct{ A string }{}, "has no fake tags"},
{&struct {
a string `fake:"person.first"`
}{}, ".a: unexported"},