elvish/pkg/eval/builtin_fn_fs_test.go
2019-12-23 20:00:59 +00:00

26 lines
476 B
Go

package eval
import (
"path/filepath"
"testing"
"github.com/elves/elvish/pkg/parse"
)
func TestBuiltinFnFS(t *testing.T) {
tmpHome, cleanup := InTempHome()
defer cleanup()
MustMkdirAll("dir", 0700)
MustCreateEmpty("file")
Test(t,
That(`path-base a/b/c.png`).Puts("c.png"),
That("tilde-abbr "+parse.Quote(filepath.Join(tmpHome, "foobar"))).
Puts(filepath.Join("~", "foobar")),
That(`-is-dir ~/dir`).Puts(true),
That(`-is-dir ~/file`).Puts(false),
)
}