mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
fix segfault printing errors. add test case and improve messages.
Fixes #338. R=rsc CC=golang-dev https://golang.org/cl/163083
This commit is contained in:
parent
f6c0eba741
commit
114f73f822
2 changed files with 41 additions and 6 deletions
|
|
@ -216,3 +216,38 @@ func TestCheckBadType(t *testing.T) {
|
|||
t.Error("expected error about type; got", err)
|
||||
}
|
||||
}
|
||||
|
||||
type Bad int
|
||||
type local struct{}
|
||||
|
||||
func (t *Bad) ArgNotPointer(args Args, reply *Reply) os.Error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (t *Bad) ArgNotPointerToStruct(args *int, reply *Reply) os.Error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (t *Bad) ReplyNotPointer(args *Args, reply Reply) os.Error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (t *Bad) ReplyNotPointerToStruct(args *Args, reply *int) os.Error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (t *Bad) ArgNotPublic(args *local, reply *Reply) os.Error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (t *Bad) ReplyNotPublic(args *Args, reply *local) os.Error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Check that registration handles lots of bad methods and a type with no suitable methods.
|
||||
func TestRegistrationError(t *testing.T) {
|
||||
err := Register(new(Bad));
|
||||
if err == nil {
|
||||
t.Errorf("expected error registering bad type")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue