mirror of
https://github.com/golang/go
synced 2024-11-18 19:14:40 -07:00
go/packages: fix broken test that checks errors
Change-Id: Id9b1dc5e01a5b7eeca45448be0b7d7eef79fa928 Reviewed-on: https://go-review.googlesource.com/c/tools/+/172400 Run-TryBot: Rebecca Stambler <rstambler@golang.org> Reviewed-by: Ian Cottrell <iancottrell@google.com>
This commit is contained in:
parent
76038274be
commit
f6a9ef9393
@ -1726,9 +1726,14 @@ func testReturnErrorWhenUsingNonGoFiles(t *testing.T, exporter packagestest.Expo
|
||||
}}})
|
||||
defer exported.Cleanup()
|
||||
config := packages.Config{}
|
||||
want := "named files must be .go files"
|
||||
pkgs, err := packages.Load(&config, "a/a.go", "b/b.c")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
// Check if the error returned is the one we expected.
|
||||
if !strings.Contains(err.Error(), want) {
|
||||
t.Fatalf("want error message: %s, got: %s", want, err.Error())
|
||||
}
|
||||
return
|
||||
}
|
||||
if len(pkgs) != 1 || pkgs[0].PkgPath != "command-line-arguments" {
|
||||
t.Fatalf("packages.Load: want [command-line-arguments], got %v", pkgs)
|
||||
@ -1737,7 +1742,6 @@ func testReturnErrorWhenUsingNonGoFiles(t *testing.T, exporter packagestest.Expo
|
||||
t.Fatalf("result of Load: want package with one error, got: %+v", pkgs[0])
|
||||
}
|
||||
got := pkgs[0].Errors[0].Error()
|
||||
want := "named files must be .go files"
|
||||
if !strings.Contains(got, want) {
|
||||
t.Fatalf("want error message: %s, got: %s", want, got)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user