Skip to content

Commit

Permalink
TestOverloadNameds
Browse files Browse the repository at this point in the history
  • Loading branch information
xushiwei committed Jan 21, 2024
1 parent bc946f4 commit 46d7112
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions builtin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,28 @@ func getConf() *Config {
return &Config{Fset: fset, Importer: imp}
}

func TestOverloadNameds(t *testing.T) {
pkg := types.NewPackage("", "")
tn := types.NewTypeName(0, pkg, "foo__1", nil)
named := types.NewNamed(tn, TyByte, nil)
func() {
defer func() {
if e := recover(); e != "overload type foo__1 out of range 0..0\n" {
t.Fatal("TestOverloadFuncs:", e)
}
}()
overloadNameds(5, []*types.Named{named})
}()
func() {
defer func() {
if e := recover(); e != "overload type foo__1 exists?\n" {
t.Fatal("TestOverloadFuncs:", e)
}
}()
overloadNameds(5, []*types.Named{named, named})
}()
}

func TestOverloadFuncs(t *testing.T) {
pkg := types.NewPackage("", "")
fn := types.NewFunc(0, pkg, "foo__1", nil)
Expand Down

0 comments on commit 46d7112

Please sign in to comment.