Skip to content

Commit 5809e86

Browse files
committed
tests(goenv): add tests for Get and GetOne
1 parent 0f92e72 commit 5809e86

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

goenv/goenv_test.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package goenv
2+
3+
import (
4+
"path/filepath"
5+
"testing"
6+
7+
"github.com/stretchr/testify/assert"
8+
"github.com/stretchr/testify/require"
9+
)
10+
11+
func TestGetOne(t *testing.T) {
12+
p, err := GetOne(GOMOD)
13+
require.NoError(t, err)
14+
15+
abs, err := filepath.Abs("..")
16+
require.NoError(t, err)
17+
18+
assert.Equal(t, filepath.Join(abs, "go.mod"), p)
19+
}
20+
21+
func TestGet(t *testing.T) {
22+
values, err := Get(GOMOD, GO111MODULE)
23+
require.NoError(t, err)
24+
25+
assert.NotEmpty(t, values[GOMOD])
26+
assert.NotEmpty(t, values[GO111MODULE])
27+
assert.Empty(t, values[GOEXE])
28+
}

0 commit comments

Comments
 (0)