ethutil -> common
This commit is contained in:
parent
5e7702fd05
commit
b4060da9eb
@ -5,7 +5,7 @@ import (
|
|||||||
"github.com/obscuren/otto"
|
"github.com/obscuren/otto"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/ethutil"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -37,7 +37,7 @@ func New(assetPath string) *JSRE {
|
|||||||
// Exec(file) loads and runs the contents of a file
|
// Exec(file) loads and runs the contents of a file
|
||||||
// if a relative path is given, the jsre's assetPath is used
|
// if a relative path is given, the jsre's assetPath is used
|
||||||
func (self *JSRE) Exec(file string) error {
|
func (self *JSRE) Exec(file string) error {
|
||||||
return self.exec(ethutil.AbsolutePath(self.assetPath, file))
|
return self.exec(common.AbsolutePath(self.assetPath, file))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *JSRE) exec(path string) error {
|
func (self *JSRE) exec(path string) error {
|
||||||
|
@ -4,7 +4,7 @@ import (
|
|||||||
"github.com/obscuren/otto"
|
"github.com/obscuren/otto"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/ethutil"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
type testNativeObjectBinding struct {
|
type testNativeObjectBinding struct {
|
||||||
@ -26,7 +26,7 @@ func (no *testNativeObjectBinding) TestMethod(call otto.FunctionCall) otto.Value
|
|||||||
func TestExec(t *testing.T) {
|
func TestExec(t *testing.T) {
|
||||||
jsre := New("/tmp")
|
jsre := New("/tmp")
|
||||||
|
|
||||||
ethutil.WriteFile("/tmp/test.js", []byte(`msg = "testMsg"`))
|
common.WriteFile("/tmp/test.js", []byte(`msg = "testMsg"`))
|
||||||
err := jsre.Exec("test.js")
|
err := jsre.Exec("test.js")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("expected no error, got %v", err)
|
t.Errorf("expected no error, got %v", err)
|
||||||
@ -64,7 +64,7 @@ func TestBind(t *testing.T) {
|
|||||||
func TestLoadScript(t *testing.T) {
|
func TestLoadScript(t *testing.T) {
|
||||||
jsre := New("/tmp")
|
jsre := New("/tmp")
|
||||||
|
|
||||||
ethutil.WriteFile("/tmp/test.js", []byte(`msg = "testMsg"`))
|
common.WriteFile("/tmp/test.js", []byte(`msg = "testMsg"`))
|
||||||
_, err := jsre.Run(`loadScript("test.js")`)
|
_, err := jsre.Run(`loadScript("test.js")`)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("expected no error, got %v", err)
|
t.Errorf("expected no error, got %v", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user