-
Notifications
You must be signed in to change notification settings - Fork 2
/
go_test.go
41 lines (31 loc) · 995 Bytes
/
go_test.go
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
29
30
31
32
33
34
35
36
37
38
39
40
41
// Copyright (c) Jeevanandam M. (https://github.com/jeevatkm)
// go-aah/essentials source code and usage is governed by a MIT style
// license that can be found in the LICENSE file.
package ess
import (
"os"
"path/filepath"
"testing"
"aahframework.org/test.v0/assert"
)
func TestLookExecutable(t *testing.T) {
assert.Equal(t, true, LookExecutable("go"))
assert.Equal(t, false, LookExecutable("mygo"))
}
func TestIsImportPathExists(t *testing.T) {
assert.Equal(t, true, IsImportPathExists("aahframework.org/test.v0"))
assert.Equal(t, false, IsImportPathExists("aahframework.org/unknown"))
}
func TestGoPath(t *testing.T) {
gopath, err := GoPath()
assert.FailOnError(t, err, "")
t.Logf("gopath: %v", gopath)
}
func TestIsInGoRoot(t *testing.T) {
goroot := os.Getenv("GOROOT")
if IsStrEmpty(goroot) {
goroot = "/usr/local/go"
}
assert.Equal(t, true, IsInGoRoot(filepath.Join(goroot, "src/github.com/jeevatkm/myapp")))
assert.Equal(t, false, IsInGoRoot("/usr/local/"))
}