mirror of
https://github.com/semaphoreui/semaphore.git
synced 2024-11-25 14:25:45 +01:00
29 lines
628 B
Go
29 lines
628 B
Go
|
package projects
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
func TestIsValidInventoryPath(t *testing.T) {
|
||
|
if !IsValidInventoryPath("inventories/test") {
|
||
|
t.Fatal(" a path below the cwd should be valid")
|
||
|
}
|
||
|
|
||
|
if !IsValidInventoryPath("inventories/test/../prod") {
|
||
|
t.Fatal(" a path below the cwd should be valid")
|
||
|
}
|
||
|
|
||
|
if IsValidInventoryPath("/test/../../../inventory") {
|
||
|
t.Fatal(" a path out of the cwd should be invalid")
|
||
|
}
|
||
|
|
||
|
if IsValidInventoryPath("/test/inventory") {
|
||
|
t.Fatal(" a path out of the cwd should be invalid")
|
||
|
}
|
||
|
|
||
|
if IsValidInventoryPath("c:\\test\\inventory") {
|
||
|
t.Fatal(" a path out of the cwd should be invalid")
|
||
|
}
|
||
|
}
|
||
|
|