common: remove WriteFile and ReadAllFile (use ioutil instead)

This commit is contained in:
zelig
2015-03-25 14:58:52 +00:00
parent 23e41a57ad
commit 4ec38e3932
8 changed files with 22 additions and 92 deletions

View File

@ -2,9 +2,9 @@ package jsre
import (
"github.com/robertkrimen/otto"
"io/ioutil"
"os"
"testing"
"github.com/ethereum/go-ethereum/common"
)
type testNativeObjectBinding struct {
@ -26,7 +26,7 @@ func (no *testNativeObjectBinding) TestMethod(call otto.FunctionCall) otto.Value
func TestExec(t *testing.T) {
jsre := New("/tmp")
common.WriteFile("/tmp/test.js", []byte(`msg = "testMsg"`))
ioutil.WriteFile("/tmp/test.js", []byte(`msg = "testMsg"`), os.ModePerm)
err := jsre.Exec("test.js")
if err != nil {
t.Errorf("expected no error, got %v", err)
@ -64,7 +64,7 @@ func TestBind(t *testing.T) {
func TestLoadScript(t *testing.T) {
jsre := New("/tmp")
common.WriteFile("/tmp/test.js", []byte(`msg = "testMsg"`))
ioutil.WriteFile("/tmp/test.js", []byte(`msg = "testMsg"`), os.ModePerm)
_, err := jsre.Run(`loadScript("test.js")`)
if err != nil {
t.Errorf("expected no error, got %v", err)