Skip to content

Commit b28417b

Browse files
committed
Add test for undefined types in source file.
1 parent 60b9873 commit b28417b

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

gotests_test.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2086,6 +2086,38 @@ func TestNot(t *testing.T) {
20862086
}
20872087
}
20882088
}
2089+
`,
2090+
}, {
2091+
name: "Undefined types",
2092+
srcPath: `testdata/undefinedtypes/undefined.go`,
2093+
want: `package undefinedtypes
2094+
2095+
import (
2096+
"reflect"
2097+
"testing"
2098+
)
2099+
2100+
func TestUndefinedDo(t *testing.T) {
2101+
tests := []struct {
2102+
name string
2103+
u *Undefined
2104+
es Something
2105+
want *Unknown
2106+
wantErr bool
2107+
}{
2108+
// TODO: Add test cases.
2109+
}
2110+
for _, tt := range tests {
2111+
got, err := tt.u.Do(tt.es)
2112+
if (err != nil) != tt.wantErr {
2113+
t.Errorf("%q. Undefined.Do() error = %v, wantErr %v", tt.name, err, tt.wantErr)
2114+
continue
2115+
}
2116+
if !reflect.DeepEqual(got, tt.want) {
2117+
t.Errorf("%q. Undefined.Do() = %v, want %v", tt.name, got, tt.want)
2118+
}
2119+
}
2120+
}
20892121
`,
20902122
},
20912123
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package undefinedtypes
2+
3+
func (u *Undefined) Do(es Something) (*Unknown, error) {
4+
return nil, nil
5+
}

0 commit comments

Comments
 (0)