mirror of
https://github.com/binwiederhier/ntfy.git
synced 2025-07-20 10:04:08 +00:00
28 lines
626 B
Go
28 lines
626 B
Go
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"))
|
|
}
|