diff options
| author | Hiroshi Ioka <hirochachacha@gmail.com> | 2016-09-20 19:43:34 +0900 |
|---|---|---|
| committer | Brad Fitzpatrick <bradfitz@golang.org> | 2016-10-16 09:21:57 +0000 |
| commit | ad50408fe7d9edfc7a1d9791e7391df132bc58b2 (patch) | |
| tree | b6c68d699e1457448ac19372be08b6f127a2d3cb /src/path/filepath/path_windows_test.go | |
| parent | 0cc400f0e7e73e1ee870d803b8faf1904c0c9ec3 (diff) | |
| download | go-ad50408fe7d9edfc7a1d9791e7391df132bc58b2.tar.xz | |
path/filepath: simplify TestToNorm
Change-Id: I8a176ed9c7f59ebdfd39c1e2b88905f977179982
Reviewed-on: https://go-review.googlesource.com/31119
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/path/filepath/path_windows_test.go')
| -rw-r--r-- | src/path/filepath/path_windows_test.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/path/filepath/path_windows_test.go b/src/path/filepath/path_windows_test.go index 2be200cb7d..7bfa6e42a0 100644 --- a/src/path/filepath/path_windows_test.go +++ b/src/path/filepath/path_windows_test.go @@ -383,10 +383,12 @@ func TestToNorm(t *testing.T) { tmpVol := filepath.VolumeName(tmp) tmpNoVol := tmp[len(tmpVol):] + replacer := strings.NewReplacer("{{tmp}}", tmp, "{{tmpvol}}", tmpVol, "{{tmpnovol}}", tmpNoVol) + for _, test := range testsDir { - wd := strings.Replace(strings.Replace(strings.Replace(test.wd, "{{tmp}}", tmp, -1), "{{tmpvol}}", tmpVol, -1), "{{tmpnovol}}", tmpNoVol, -1) - arg := strings.Replace(strings.Replace(strings.Replace(test.arg, "{{tmp}}", tmp, -1), "{{tmpvol}}", tmpVol, -1), "{{tmpnovol}}", tmpNoVol, -1) - want := strings.Replace(strings.Replace(strings.Replace(test.want, "{{tmp}}", tmp, -1), "{{tmpvol}}", tmpVol, -1), "{{tmpnovol}}", tmpNoVol, -1) + wd := replacer.Replace(test.wd) + arg := replacer.Replace(test.arg) + want := replacer.Replace(test.want) if test.wd == "." { err := os.Chdir(cwd) |
