jx/internal/folio/searchpath_test.go

25 lines
456 B
Go
Raw Normal View History

// Copyright 2024 Matthew Rich <matthewrich.conf@gmail.com>. All rights reserved.
package folio
import (
"github.com/stretchr/testify/assert"
"testing"
"os"
)
func TestSearchPath(t *testing.T) {
assert.Nil(t, TempDir.CreateFile("test.jx.yaml", ""))
sp := NewSearchPath(nil)
assert.NotNil(t, sp)
assert.Nil(t, sp.AddPath(string(TempDir)))
absPath := sp.Find("test.jx.yaml")
_, err := os.Stat(absPath)
assert.True(t, !os.IsNotExist(err))
}