| 1 | // Copyright (c) 2021-2024, Maxime Soulé |
| 2 | // All rights reserved. |
| 3 | // |
| 4 | // This source code is licensed under the BSD-style license found in the |
| 5 | // LICENSE file in the root directory of this source tree. |
| 6 | |
| 7 | package tdscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/ |
| 8 | |
| 9 | import ( |
| 10 | "errorsscip-go gomod github.com/golang/go/src go1.18 errors/" |
| 11 | "reflectscip-go gomod github.com/golang/go/src go1.18 reflect/" |
| 12 | "testingscip-go gomod github.com/golang/go/src go1.18 testing/" |
| 13 | |
| 14 | "github.com/maxatome/go-testdeep/internal/testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/" |
| 15 | ) |
| 16 | |
| 17 | func TestFieldsPathscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/TestFieldsPath().(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) { |
| 18 | check := func(in string, expected ...string) []smuggleFieldscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/smuggleField# { |
| 19 | t.Helperscip-go gomod github.com/golang/go/src go1.18 testing/common#Helper().() |
| 20 | |
| 21 | got, err := splitFieldsPathscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/splitFieldsPath().(in) |
| 22 | testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.NoErrorscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/NoError().(t, err) |
| 23 | |
| 24 | var gotStr []string |
| 25 | for _, s := range got { |
| 26 | if s.Methodscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/smuggleField#Method. { |
| 27 | gotStr = append(gotStr, s.Namescip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/smuggleField#Name.+"()") |
| 28 | } else { |
| 29 | gotStr = append(gotStr, s.Namescip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/smuggleField#Name.) |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | if !reflectscip-go gomod github.com/golang/go/src go1.18 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.18 reflect/DeepEqual().(gotStr, expected) { |
| 34 | t.Errorfscip-go gomod github.com/golang/go/src go1.18 testing/common#Errorf().("Failed:\n got: %v\n expected: %v", got, expected) |
| 35 | } |
| 36 | |
| 37 | testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.EqualStrscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/EqualStr().(t, in, joinFieldsPathscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/joinFieldsPath().(got)) |
| 38 | |
| 39 | return got |
| 40 | } |
| 41 | |
| 42 | check("test", "test") |
| 43 | check("Test.Foo().bar", "Test", "Foo()", "bar") |
| 44 | check("test.foo.bar", "test", "foo", "bar") |
| 45 | check("test[foo.bar]", "test", "foo.bar") |
| 46 | check("test[foo][bar]", "test", "foo", "bar") |
| 47 | fp := check("test[foo][bar].zip", "test", "foo", "bar", "zip") |
| 48 | |
| 49 | // "." can be omitted just after "]" |
| 50 | got, err := splitFieldsPathscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/splitFieldsPath().("test[foo][bar]zip") |
| 51 | testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.NoErrorscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/NoError().(t, err) |
| 52 | if !reflectscip-go gomod github.com/golang/go/src go1.18 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.18 reflect/DeepEqual().(got, fp) { |
| 53 | t.Errorfscip-go gomod github.com/golang/go/src go1.18 testing/common#Errorf().("Failed:\n got: %v\n expected: %v", got, fp) |
| 54 | } |
| 55 | |
| 56 | check("[foo][bar]", "foo", "bar") |
| 57 | check("[0][foo][bar]", "0", "foo", "bar") |
| 58 | |
| 59 | // |
| 60 | // Errors |
| 61 | checkErr := func(in, expectedErr string) { |
| 62 | t.Helperscip-go gomod github.com/golang/go/src go1.18 testing/common#Helper().() |
| 63 | |
| 64 | _, err := splitFieldsPathscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/splitFieldsPath().(in) |
| 65 | |
| 66 | if testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.Errorscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/Error().(t, err) { |
| 67 | testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.EqualStrscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/EqualStr().(t, err.Error(), expectedErr) |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | checkErr("", "FIELDS_PATH cannot be empty") |
| 72 | checkErr(".test", `'.' cannot be the first rune in FIELDS_PATH ".test"`) |
| 73 | checkErr("foo.bar.", `final '.' in FIELDS_PATH "foo.bar." is not allowed`) |
| 74 | checkErr("foo..bar", `unexpected '.' after '.' in FIELDS_PATH "foo..bar"`) |
| 75 | checkErr("foo.[bar]", `unexpected '[' after '.' in FIELDS_PATH "foo.[bar]"`) |
| 76 | checkErr("foo[bar", `cannot find final ']' in FIELDS_PATH "foo[bar"`) |
| 77 | checkErr("test.%foo", `unexpected '%' in field name "%foo" in FIELDS_PATH "test.%foo"`) |
| 78 | checkErr("test.f%oo", `unexpected '%' in field name "f%oo" in FIELDS_PATH "test.f%oo"`) |
| 79 | checkErr("Foo().()", `missing method name before () in FIELDS_PATH "Foo().()"`) |
| 80 | checkErr("abc.foo()", `method name "foo()" is not public in FIELDS_PATH "abc.foo()"`) |
| 81 | checkErr("Fo%o().abc", `unexpected '%' in method name "Fo%o()" in FIELDS_PATH "Fo%o().abc"`) |
| 82 | checkErr("Pipo.bingo.zzz.Foo.Zip().abc", `cannot call method Zip() as it is based on an unexported field "bingo" in FIELDS_PATH "Pipo.bingo.zzz.Foo.Zip().abc"`) |
| 83 | checkErr("foo[bar", `cannot find final ']' in FIELDS_PATH "foo[bar"`) |
| 84 | } |
| 85 | |
| 86 | type SmuggleBuildscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild# struct { |
| 87 | Fieldscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#Field. struct { |
| 88 | Pathscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#$anon_7924d3d9624588aa#Path. string |
| 89 | } |
| 90 | Ifacescip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#Iface. any |
| 91 | Nextscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#Next. *SmuggleBuildscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild# |
| 92 | } |
| 93 | |
| 94 | func (s SmuggleBuildscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#) FollowIfacescip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#FollowIface().() any { |
| 95 | return s.Ifacescip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#Iface. |
| 96 | } |
| 97 | |
| 98 | func (s *SmuggleBuildscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#) PtrFollowIfacescip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#PtrFollowIface().() any { |
| 99 | return s.Ifacescip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#Iface. |
| 100 | } |
| 101 | |
| 102 | func (s SmuggleBuildscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#) MayFollowIfacescip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#MayFollowIface().() (any, error) { |
| 103 | if s.Ifacescip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#Iface. == nil { |
| 104 | return nil, errorsscip-go gomod github.com/golang/go/src go1.18 errors/.Newscip-go gomod github.com/golang/go/src go1.18 errors/New().("Iface is nil") |
| 105 | } |
| 106 | return s.Ifacescip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#Iface., nil |
| 107 | } |
| 108 | |
| 109 | func (s SmuggleBuildscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#) FollowNextscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#FollowNext().() *SmuggleBuildscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild# { |
| 110 | return s.Nextscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#Next. |
| 111 | } |
| 112 | |
| 113 | func (s *SmuggleBuildscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#) PtrFollowNextscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#PtrFollowNext().() *SmuggleBuildscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild# { |
| 114 | return s.Nextscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#Next. |
| 115 | } |
| 116 | |
| 117 | func (s SmuggleBuildscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#) MayFollowNextscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#MayFollowNext().() (*SmuggleBuildscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#, error) { |
| 118 | if s.Nextscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#Next. == nil { |
| 119 | return nil, errorsscip-go gomod github.com/golang/go/src go1.18 errors/.Newscip-go gomod github.com/golang/go/src go1.18 errors/New().("Next is nil") |
| 120 | } |
| 121 | return s.Nextscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#Next., nil |
| 122 | } |
| 123 | |
| 124 | func (s SmuggleBuildscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#) Errorscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#Error().() (bool, error) { |
| 125 | return false, errorsscip-go gomod github.com/golang/go/src go1.18 errors/.Newscip-go gomod github.com/golang/go/src go1.18 errors/New().("an error occurred") |
| 126 | } |
| 127 | |
| 128 | func (s SmuggleBuildscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#) SetPathscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#SetPath().(path string) { |
| 129 | s.Fieldscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#Field..Pathscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#$anon_7924d3d9624588aa#Path. = path |
| 130 | } |
| 131 | |
| 132 | func (s SmuggleBuildscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#) Panicscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#Panic().() string { |
| 133 | panic("oops!") |
| 134 | } |
| 135 | |
| 136 | func (s SmuggleBuildscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#) Numscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#Num().() int { |
| 137 | return 42 |
| 138 | } |
| 139 | |
| 140 | func (s *SmuggleBuildscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#) PNumscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#PNum().() int { |
| 141 | return 42 |
| 142 | } |
| 143 | |
| 144 | func TestBuildFieldsPathFnscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/TestBuildFieldsPathFn().(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) { |
| 145 | _, err := buildFieldsPathFnscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/buildFieldsPathFn().("bad[path") |
| 146 | testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.Errorscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/Error().(t, err) |
| 147 | |
| 148 | t.Runscip-go gomod github.com/golang/go/src go1.18 testing/T#Run().("Struct", func(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) { |
| 149 | fn, err := buildFieldsPathFnscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/buildFieldsPathFn().("Field.Path.Bad") |
| 150 | if testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.NoErrorscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/NoError().(t, err) { |
| 151 | _, err = fn(SmuggleBuildscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#{}) |
| 152 | if testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.Errorscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/Error().(t, err) { |
| 153 | testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.EqualStrscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/EqualStr().(t, err.Error(), |
| 154 | `field "Field.Path" is a string and should be a struct or a map[string]…`) |
| 155 | } |
| 156 | |
| 157 | _, err = fn(123) |
| 158 | if testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.Errorscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/Error().(t, err) { |
| 159 | testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.EqualStrscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/EqualStr().(t, err.Error(), |
| 160 | "it is a int and should be a struct or a map[string]…") |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | fn, err = buildFieldsPathFnscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/buildFieldsPathFn().("Iface.Bad") |
| 165 | if testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.NoErrorscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/NoError().(t, err) { |
| 166 | _, err = fn(SmuggleBuildscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#{Ifacescip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#Iface.: 42}) |
| 167 | if testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.Errorscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/Error().(t, err) { |
| 168 | testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.EqualStrscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/EqualStr().(t, err.Error(), |
| 169 | `field "Iface" is a int (after dereferencing) and should be a struct or a map[string]…`) |
| 170 | } |
| 171 | |
| 172 | num := 42 |
| 173 | _, err = fn(&num) |
| 174 | if testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.Errorscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/Error().(t, err) { |
| 175 | testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.EqualStrscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/EqualStr().(t, err.Error(), |
| 176 | `it is a int (after dereferencing) and should be a struct or a map[string]…`) |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | fn, err = buildFieldsPathFnscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/buildFieldsPathFn().("Field.Unknown") |
| 181 | if testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.NoErrorscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/NoError().(t, err) { |
| 182 | _, err = fn(SmuggleBuildscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#{}) |
| 183 | if testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.Errorscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/Error().(t, err) { |
| 184 | testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.EqualStrscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/EqualStr().(t, err.Error(), `field "Field.Unknown" not found`) |
| 185 | } |
| 186 | } |
| 187 | }) |
| 188 | |
| 189 | t.Runscip-go gomod github.com/golang/go/src go1.18 testing/T#Run().("Map", func(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) { |
| 190 | fn, err := buildFieldsPathFnscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/buildFieldsPathFn().("Iface[str].Field") |
| 191 | if testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.NoErrorscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/NoError().(t, err) { |
| 192 | _, err = fn(SmuggleBuildscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#{Ifacescip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#Iface.: map[int]SmuggleBuildscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#{}}) |
| 193 | if testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.Errorscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/Error().(t, err) { |
| 194 | testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.EqualStrscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/EqualStr().(t, err.Error(), |
| 195 | `field "Iface[str]", "str" is not an integer and so cannot match int map key type`) |
| 196 | } |
| 197 | |
| 198 | _, err = fn(SmuggleBuildscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#{Ifacescip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#Iface.: map[uint]SmuggleBuildscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#{}}) |
| 199 | if testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.Errorscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/Error().(t, err) { |
| 200 | testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.EqualStrscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/EqualStr().(t, err.Error(), |
| 201 | `field "Iface[str]", "str" is not an unsigned integer and so cannot match uint map key type`) |
| 202 | } |
| 203 | |
| 204 | _, err = fn(SmuggleBuildscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#{Ifacescip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#Iface.: map[float32]SmuggleBuildscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#{}}) |
| 205 | if testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.Errorscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/Error().(t, err) { |
| 206 | testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.EqualStrscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/EqualStr().(t, err.Error(), |
| 207 | `field "Iface[str]", "str" is not a float and so cannot match float32 map key type`) |
| 208 | } |
| 209 | |
| 210 | _, err = fn(SmuggleBuildscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#{Ifacescip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#Iface.: map[complex128]SmuggleBuildscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#{}}) |
| 211 | if testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.Errorscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/Error().(t, err) { |
| 212 | testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.EqualStrscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/EqualStr().(t, err.Error(), |
| 213 | `field "Iface[str]", "str" is not a complex number and so cannot match complex128 map key type`) |
| 214 | } |
| 215 | |
| 216 | _, err = fn(SmuggleBuildscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#{Ifacescip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#Iface.: map[struct{ A int }]SmuggleBuildscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#{}}) |
| 217 | if testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.Errorscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/Error().(t, err) { |
| 218 | testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.EqualStrscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/EqualStr().(t, err.Error(), |
| 219 | `field "Iface[str]", "str" cannot match unsupported struct { A int } map key type`) |
| 220 | } |
| 221 | |
| 222 | _, err = fn(SmuggleBuildscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#{Ifacescip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#Iface.: map[string]SmuggleBuildscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#{}}) |
| 223 | if testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.Errorscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/Error().(t, err) { |
| 224 | testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.EqualStrscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/EqualStr().(t, err.Error(), `field "Iface[str]", "str" map key not found`) |
| 225 | } |
| 226 | } |
| 227 | }) |
| 228 | |
| 229 | t.Runscip-go gomod github.com/golang/go/src go1.18 testing/T#Run().("Array-Slice", func(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) { |
| 230 | fn, err := buildFieldsPathFnscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/buildFieldsPathFn().("Iface[str].Field") |
| 231 | if testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.NoErrorscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/NoError().(t, err) { |
| 232 | _, err = fn(SmuggleBuildscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#{Ifacescip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#Iface.: []int{}}) |
| 233 | if testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.Errorscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/Error().(t, err) { |
| 234 | testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.EqualStrscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/EqualStr().(t, err.Error(), |
| 235 | `field "Iface[str]", "str" is not a slice/array index`) |
| 236 | } |
| 237 | } |
| 238 | |
| 239 | fn, err = buildFieldsPathFnscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/buildFieldsPathFn().("Iface[18].Field") |
| 240 | if testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.NoErrorscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/NoError().(t, err) { |
| 241 | _, err = fn(SmuggleBuildscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#{Ifacescip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#Iface.: []int{1, 2, 3}}) |
| 242 | if testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.Errorscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/Error().(t, err) { |
| 243 | testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.EqualStrscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/EqualStr().(t, err.Error(), |
| 244 | `field "Iface[18]", 18 is out of slice/array range (len 3)`) |
| 245 | } |
| 246 | |
| 247 | _, err = fn(SmuggleBuildscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#{Ifacescip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#Iface.: 42}) |
| 248 | if testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.Errorscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/Error().(t, err) { |
| 249 | testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.EqualStrscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/EqualStr().(t, err.Error(), |
| 250 | `field "Iface" is a int, but a map, array or slice is expected`) |
| 251 | } |
| 252 | } |
| 253 | |
| 254 | fn, err = buildFieldsPathFnscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/buildFieldsPathFn().("[18].Field") |
| 255 | if testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.NoErrorscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/NoError().(t, err) { |
| 256 | _, err = fn(42) |
| 257 | testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.EqualStrscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/EqualStr().(t, err.Error(), |
| 258 | `it is a int, but a map, array or slice is expected`) |
| 259 | } |
| 260 | }) |
| 261 | |
| 262 | t.Runscip-go gomod github.com/golang/go/src go1.18 testing/T#Run().("Function", func(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) { |
| 263 | fn, err := buildFieldsPathFnscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/buildFieldsPathFn().("Iface.Unknown()") |
| 264 | if testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.NoErrorscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/NoError().(t, err) { |
| 265 | _, err = fn(SmuggleBuildscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#{Ifacescip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#Iface.: SmuggleBuildscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#{}}) |
| 266 | if testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.Errorscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/Error().(t, err) { |
| 267 | testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.EqualStrscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/EqualStr().(t, err.Error(), |
| 268 | `field Iface (type td.SmuggleBuild) does not implement Unknown() method`) |
| 269 | } |
| 270 | } |
| 271 | |
| 272 | fn, err = buildFieldsPathFnscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/buildFieldsPathFn().("Iface.NilUnknown()") |
| 273 | if testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.NoErrorscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/NoError().(t, err) { |
| 274 | _, err = fn(SmuggleBuildscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#{}) |
| 275 | if testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.Errorscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/Error().(t, err) { |
| 276 | testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.EqualStrscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/EqualStr().(t, err.Error(), `field "Iface" is nil`) |
| 277 | } |
| 278 | } |
| 279 | |
| 280 | fn, err = buildFieldsPathFnscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/buildFieldsPathFn().("Unknown()") |
| 281 | if testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.NoErrorscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/NoError().(t, err) { |
| 282 | _, err = fn(SmuggleBuildscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#{}) |
| 283 | if testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.Errorscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/Error().(t, err) { |
| 284 | testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.EqualStrscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/EqualStr().(t, err.Error(), |
| 285 | `type td.SmuggleBuild has no method Unknown()`) |
| 286 | } |
| 287 | } |
| 288 | |
| 289 | fn, err = buildFieldsPathFnscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/buildFieldsPathFn().("Iface.SetPath()") |
| 290 | if testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.NoErrorscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/NoError().(t, err) { |
| 291 | _, err = fn(SmuggleBuildscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#{Ifacescip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#Iface.: &SmuggleBuildscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#{}}) |
| 292 | if testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.Errorscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/Error().(t, err) { |
| 293 | testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.EqualStrscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/EqualStr().(t, err.Error(), |
| 294 | `cannot call Iface.SetPath(), signature func(string) not handled, only func() A or func() (A, error) allowed`) |
| 295 | } |
| 296 | } |
| 297 | |
| 298 | fn, err = buildFieldsPathFnscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/buildFieldsPathFn().("Iface.Panic()") |
| 299 | if testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.NoErrorscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/NoError().(t, err) { |
| 300 | _, err = fn(SmuggleBuildscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#{Ifacescip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#Iface.: &SmuggleBuildscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#{}}) |
| 301 | if testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.Errorscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/Error().(t, err) { |
| 302 | testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.EqualStrscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/EqualStr().(t, err.Error(), |
| 303 | `method Iface.Panic() panicked: oops!`) |
| 304 | } |
| 305 | } |
| 306 | |
| 307 | fn, err = buildFieldsPathFnscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/buildFieldsPathFn().("Iface.Error()") |
| 308 | if testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.NoErrorscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/NoError().(t, err) { |
| 309 | _, err = fn(SmuggleBuildscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#{Ifacescip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#Iface.: &SmuggleBuildscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#{}}) |
| 310 | if testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.Errorscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/Error().(t, err) { |
| 311 | testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.EqualStrscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/EqualStr().(t, err.Error(), |
| 312 | `method Iface.Error() returned an error: an error occurred`) |
| 313 | } |
| 314 | } |
| 315 | |
| 316 | fn, err = buildFieldsPathFnscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/buildFieldsPathFn().("Num().Bad") |
| 317 | if testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.NoErrorscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/NoError().(t, err) { |
| 318 | _, err = fn(SmuggleBuildscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#{}) |
| 319 | if testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.Errorscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/Error().(t, err) { |
| 320 | testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.EqualStrscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/EqualStr().(t, err.Error(), |
| 321 | `method Num() returned a int and should be a struct or a map[string]…`) |
| 322 | } |
| 323 | } |
| 324 | |
| 325 | fn, err = buildFieldsPathFnscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/buildFieldsPathFn().("FollowIface().Bad") |
| 326 | if testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.NoErrorscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/NoError().(t, err) { |
| 327 | _, err = fn(SmuggleBuildscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#{Ifacescip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/td`/SmuggleBuild#Iface.: 42}) |
| 328 | if testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.Errorscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/Error().(t, err) { |
| 329 | testscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/.EqualStrscip-go gomod github.com/maxatome/go-testdeep . `github.com/maxatome/go-testdeep/internal/test`/EqualStr().(t, err.Error(), |
| 330 | `method FollowIface() returned a int (after dereferencing) and should be a struct or a map[string]…`) |
| 331 | } |
| 332 | } |
| 333 | }) |
| 334 | } |