mirror of https://github.com/golang/go.git
cmd/compile/internal/types2: add a test for argument error unwrapping
This CL is a clean port of CL 351338 from go/types to types2. Change-Id: I7fd0e5a447bf51cb359e71731c2f9b95e3960da6 Reviewed-on: https://go-review.googlesource.com/c/go/+/364536 Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
This commit is contained in:
parent
f384c707ac
commit
fceca2c0f1
|
|
@ -2014,6 +2014,20 @@ func TestInstantiateErrors(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestArgumentErrorUnwrapping(t *testing.T) {
|
||||
var err error = &ArgumentError{
|
||||
Index: 1,
|
||||
Err: Error{Msg: "test"},
|
||||
}
|
||||
var e Error
|
||||
if !errors.As(err, &e) {
|
||||
t.Fatalf("error %v does not wrap types.Error", err)
|
||||
}
|
||||
if e.Msg != "test" {
|
||||
t.Errorf("e.Msg = %q, want %q", e.Msg, "test")
|
||||
}
|
||||
}
|
||||
|
||||
func TestInstanceIdentity(t *testing.T) {
|
||||
imports := make(testImporter)
|
||||
conf := Config{Importer: imports}
|
||||
|
|
|
|||
Loading…
Reference in New Issue