diff options
| author | Jonathan Amsterdam <jba@google.com> | 2021-09-09 10:14:35 -0400 |
|---|---|---|
| committer | Jonathan Amsterdam <jba@google.com> | 2021-09-09 15:05:14 +0000 |
| commit | 7ff2ae547d1d62a93dbe72cc6f96fbf52d15b38e (patch) | |
| tree | f627c4f3a74d21eda8f88ecdd92daadeaba97759 /internal/fetchdatasource | |
| parent | ecd2f455cee02d85dec3aa50f61bd42175bc70a5 (diff) | |
| download | go-x-pkgsite-7ff2ae547d1d62a93dbe72cc6f96fbf52d15b38e.tar.xz | |
internal/fetchdatasource: fix test to work on macs
Accept a wider range of URLs to accommodate Mac temp dirs.
Change-Id: I2933b71ab1956a4fbf504e842d3ec2fe5c56e127
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/348795
Trust: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
Diffstat (limited to 'internal/fetchdatasource')
| -rw-r--r-- | internal/fetchdatasource/fetchdatasource_test.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/internal/fetchdatasource/fetchdatasource_test.go b/internal/fetchdatasource/fetchdatasource_test.go index 7d5ed753..efa1894c 100644 --- a/internal/fetchdatasource/fetchdatasource_test.go +++ b/internal/fetchdatasource/fetchdatasource_test.go @@ -10,7 +10,7 @@ import ( "fmt" "log" "os" - "path" + "regexp" "testing" "time" @@ -445,13 +445,13 @@ func TestLocalGetUnitMeta(t *testing.T) { if got.SourceInfo != nil { gotURL = got.SourceInfo.RepoURL() } - wantURL := "/files/*/*/github.com/my/module/" - m, err := path.Match(wantURL, gotURL) + const wantRegexp = "^/files/.*/github.com/my/module/$" + matched, err := regexp.MatchString(wantRegexp, gotURL) if err != nil { t.Fatal(err) } - if !m { - t.Errorf("RepoURL: got %q, want match of %q", gotURL, wantURL) + if !matched { + t.Errorf("RepoURL: got %q, want match of %q", gotURL, wantRegexp) } diff := cmp.Diff(test.want, got, cmp.AllowUnexported(source.Info{}), cmpopts.IgnoreFields(source.Info{}, "repoURL")) if diff != "" { |
