]> Cypherpunks repositories - gostls13.git/commitdiff
os: in TestDirFS only check returned path for unexpected string
authorIan Lance Taylor <iant@golang.org>
Mon, 31 Oct 2022 20:41:59 +0000 (13:41 -0700)
committerGopher Robot <gobot@golang.org>
Mon, 31 Oct 2022 21:03:17 +0000 (21:03 +0000)
The test added in CL 446115 was failing on Plan 9, on which the error
returned by a failed open includes the path that failed.

Change-Id: If27222596c3cb0366a030bb49ae41c4c869c3db2
Reviewed-on: https://go-review.googlesource.com/c/go/+/446641
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: David du Colombier <0intro@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>

src/os/os_test.go

index 52fac4f63c452ab3282bb2945ee655d39c925758..a1b954c43887ef6f5cc49f530260aa9761e62013 100644 (file)
@@ -2727,7 +2727,7 @@ func TestDirFS(t *testing.T) {
                if !strings.Contains(err.Error(), nonesuch) {
                        t.Errorf("error %q does not contain %q", err, nonesuch)
                }
-               if strings.Contains(err.Error(), "testdata") {
+               if strings.Contains(err.(*PathError).Path, "testdata") {
                        t.Errorf("error %q contains %q", err, "testdata")
                }
        }