File: functions_linux_test.go

package info (click to toggle)
golang-github-masterminds-sprig 3.2.3-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 448 kB
  • sloc: makefile: 10
file content (28 lines) | stat: -rw-r--r-- 626 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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"))
}