From 3fc6159fa3973e6a1ea138da11dbc8d4123e5b17 Mon Sep 17 00:00:00 2001 From: Alan Donovan Date: Wed, 24 Sep 2014 16:38:46 -0400 Subject: [PATCH] refactor/rename: attempt to fix windows test, 2nd attempt. Windows doesn't regard "/go/src" as an absolute path, so we must explicitly define the virtual IsAbsPath method. LGTM=gri R=gri, sameer CC=golang-codereviews https://golang.org/cl/147100043 --- refactor/rename/rename_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/refactor/rename/rename_test.go b/refactor/rename/rename_test.go index 23695d8a..fb568f0d 100644 --- a/refactor/rename/rename_test.go +++ b/refactor/rename/rename_test.go @@ -740,6 +740,11 @@ func fakeContext(pkgs map[string][]string) *build.Context { index, _ := strconv.Atoi(strings.TrimSuffix(base, ".go")) return ioutil.NopCloser(bytes.NewBufferString(pkgs[dir][index])), nil } + ctxt.IsAbsPath = func(path string) bool { + // Don't rely on the default (filepath.Path) since on + // Windows, it reports our virtual paths as non-absolute. + return strings.HasPrefix(path, "/") + } return &ctxt }