2015-12-03 00:28:58 +03:00
|
|
|
package afero
|
|
|
|
|
|
|
|
import "testing"
|
|
|
|
|
|
|
|
func TestNormalizePath(t *testing.T) {
|
|
|
|
type test struct {
|
|
|
|
input string
|
|
|
|
expected string
|
|
|
|
}
|
|
|
|
|
|
|
|
data := []test{
|
2015-12-09 23:37:04 +03:00
|
|
|
{".", FilePathSeparator},
|
|
|
|
{"./", FilePathSeparator},
|
|
|
|
{"..", FilePathSeparator},
|
|
|
|
{"../", FilePathSeparator},
|
|
|
|
{"./..", FilePathSeparator},
|
|
|
|
{"./../", FilePathSeparator},
|
2015-12-03 00:28:58 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
for i, d := range data {
|
|
|
|
cpath := normalizePath(d.input)
|
|
|
|
if d.expected != cpath {
|
2015-12-09 23:37:04 +03:00
|
|
|
t.Errorf("Test %d failed. Expected %q got %q", i, d.expected, cpath)
|
2015-12-03 00:28:58 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|