copy subset of Sprig template functions
This commit is contained in:
28
util/sprig/functions_linux_test.go
Normal file
28
util/sprig/functions_linux_test.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package sprig
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestOsBase(t *testing.T) {
|
||||
assert.NoError(t, runt(`{{ osBase "foo/bar" }}`, "bar"))
|
||||
}
|
||||
|
||||
func TestOsDir(t *testing.T) {
|
||||
assert.NoError(t, runt(`{{ osDir "foo/bar/baz" }}`, "foo/bar"))
|
||||
}
|
||||
|
||||
func TestOsIsAbs(t *testing.T) {
|
||||
assert.NoError(t, runt(`{{ osIsAbs "/foo" }}`, "true"))
|
||||
assert.NoError(t, runt(`{{ osIsAbs "foo" }}`, "false"))
|
||||
}
|
||||
|
||||
func TestOsClean(t *testing.T) {
|
||||
assert.NoError(t, runt(`{{ osClean "/foo/../foo/../bar" }}`, "/bar"))
|
||||
}
|
||||
|
||||
func TestOsExt(t *testing.T) {
|
||||
assert.NoError(t, runt(`{{ osExt "/foo/bar/baz.txt" }}`, ".txt"))
|
||||
}
|
||||
Reference in New Issue
Block a user