]> Cypherpunks repositories - gostls13.git/commit
path/filepath: make TestToNorm robust
authorHiroshi Ioka <hirochachacha@gmail.com>
Sun, 23 Oct 2016 23:52:04 +0000 (08:52 +0900)
committerAlex Brainman <alex.brainman@gmail.com>
Tue, 25 Oct 2016 01:57:05 +0000 (01:57 +0000)
commit643c6b3c74409871d7f96cbad145dabdefbbc8c1
treef28c162c4cbe5b2156b5ba2d689c99fc2664014a
parent02c1d8a1589b47f12deaaa63d4a6a084640f4389
path/filepath: make TestToNorm robust

The old code leaves garbages in a temporary directory because it
cannot remove the current working directory on windows.
The new code changes the directory before calling os.Remove.

Furthermore, the old code assumes that ioutil.TempDir (os.TempDir)
doesn't return a relative path nor an UNC path.
If it isn't the case, the new code calls t.Fatal earlier for preventing
ambiguous errors.

Finally, the old code reassigns the variable which is used by the defer
function. It could cause unexpected results, so avoid that.

Change-Id: I5fc3902059ecaf18dc1341ecc4979d1206034cd7
Reviewed-on: https://go-review.googlesource.com/31790
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
src/path/filepath/path_windows_test.go