Adds unit tests for Utils

This commit is contained in:
Manu Mtz-Almeida
2015-04-08 15:32:50 +02:00
parent c61c547539
commit ac1ee3fb86
3 changed files with 63 additions and 6 deletions

View File

@ -89,10 +89,11 @@ func joinPaths(absolutePath, relativePath string) string {
if len(relativePath) == 0 {
return absolutePath
}
absolutePath = path.Join(absolutePath, relativePath)
appendSlash := lastChar(relativePath) == '/' && lastChar(absolutePath) != '/'
finalPath := path.Join(absolutePath, relativePath)
appendSlash := lastChar(relativePath) == '/' && lastChar(finalPath) != '/'
if appendSlash {
return absolutePath + "/"
return finalPath + "/"
}
return absolutePath
return finalPath
}