2022-09-01 14:25:02 -04:00
|
|
|
package util
|
|
|
|
|
2022-09-02 00:55:47 -04:00
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"github.com/stretchr/testify/suite"
|
|
|
|
)
|
2022-09-01 14:25:02 -04:00
|
|
|
|
2022-09-02 00:55:47 -04:00
|
|
|
// define our test suite struct
|
|
|
|
type EnvTestSuite struct {
|
|
|
|
suite.Suite
|
|
|
|
}
|
2022-09-01 14:25:02 -04:00
|
|
|
|
2022-09-02 00:55:47 -04:00
|
|
|
// the tilde should expand to user's home directory
|
|
|
|
func (s *EnvTestSuite) TestResolveTilde() {
|
|
|
|
resolvedPath := ResolveTilde("~")
|
|
|
|
assert.NotEqual(s.T(), resolvedPath, "~")
|
2022-09-01 14:25:02 -04:00
|
|
|
}
|
|
|
|
|
2022-09-02 00:55:47 -04:00
|
|
|
// ensure the tilde + relative path gets expanded fully
|
|
|
|
func (s *EnvTestSuite) TestResolveTildePath() {
|
2022-09-01 14:25:02 -04:00
|
|
|
resolvedPath := ResolveTilde("~/test")
|
2022-09-02 00:55:47 -04:00
|
|
|
assert.NotEqual(s.T(), resolvedPath, "~/test")
|
|
|
|
}
|
2022-09-01 14:25:02 -04:00
|
|
|
|
2022-09-02 00:55:47 -04:00
|
|
|
// this is needed to run the test suite
|
|
|
|
func TestEnvTestSuite(t *testing.T) {
|
|
|
|
suite.Run(t, new(EnvTestSuite))
|
2022-09-01 14:25:02 -04:00
|
|
|
}
|