mirror of https://github.com/aldy505/decrr.git
test: improve finding goroot
This commit is contained in:
parent
8df9913bb7
commit
198cc25b37
|
@ -3,8 +3,7 @@ package decrr_test
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"runtime"
|
||||||
"strings"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/aldy505/decrr"
|
"github.com/aldy505/decrr"
|
||||||
|
@ -15,16 +14,11 @@ func TestWrap(t *testing.T) {
|
||||||
w := decrr.Wrap(x)
|
w := decrr.Wrap(x)
|
||||||
wd, _ := os.Getwd()
|
wd, _ := os.Getwd()
|
||||||
|
|
||||||
cmd, err := exec.Command("bash", "-c", "go env | grep GOROOT").CombinedOutput()
|
gt := runtime.GOROOT()
|
||||||
if err != nil {
|
|
||||||
t.Error(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
gt := strings.Replace(strings.Replace(strings.Replace(string(cmd), "GOROOT=", "", 1), "\"", "", 2), "\n", "", -1)
|
|
||||||
|
|
||||||
var expected string
|
var expected string
|
||||||
expected += "why does a chicken cross the road?\n\n"
|
expected += "why does a chicken cross the road?\n\n"
|
||||||
expected += "github.com/aldy505/decrr_test.TestWrap " + wd + "/decrr_test.go:15\n"
|
expected += "github.com/aldy505/decrr_test.TestWrap " + wd + "/decrr_test.go:14\n"
|
||||||
expected += "testing.tRunner " + gt + "/src/testing/testing.go:1259\n"
|
expected += "testing.tRunner " + gt + "/src/testing/testing.go:1259\n"
|
||||||
expected += "runtime.goexit " + gt + "/src/runtime/asm_amd64.s:1581"
|
expected += "runtime.goexit " + gt + "/src/runtime/asm_amd64.s:1581"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue