Skip to content

Commit

Permalink
support mocking io/ioutil.ReadAll
Browse files Browse the repository at this point in the history
  • Loading branch information
xhd2015 committed Apr 3, 2024
1 parent 6f59a90 commit bbcf8fc
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
4 changes: 2 additions & 2 deletions cmd/xgo/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package main
import "fmt"

const VERSION = "1.0.15"
const REVISION = "2861a46387df90bcadae7651dc6e0d2db8ab0148+1"
const NUMBER = 152
const REVISION = "6f59a908da45484b2104d51e2fa56d83d3bf65a5+1"
const NUMBER = 153

func getRevision() string {
return fmt.Sprintf("%s %s BUILD_%d", VERSION, REVISION, NUMBER)
Expand Down
7 changes: 6 additions & 1 deletion patch/ctxt/ctx.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,12 @@ var stdWhitelist = map[string]map[string]bool{
// },
"os": map[string]bool{
// starts with Get
"OpenFile": true,
"OpenFile": true,
"ReadFile": true,
"WriteFile": true,
},
"io/ioutil": map[string]bool{
"ReadAll": true,
},
"time": map[string]bool{
"Now": true,
Expand Down
4 changes: 2 additions & 2 deletions runtime/core/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
)

const VERSION = "1.0.15"
const REVISION = "2861a46387df90bcadae7651dc6e0d2db8ab0148+1"
const NUMBER = 152
const REVISION = "6f59a908da45484b2104d51e2fa56d83d3bf65a5+1"
const NUMBER = 153

// these fields will be filled by compiler
const XGO_VERSION = ""
Expand Down
11 changes: 8 additions & 3 deletions runtime/test/func_list/func_list_stdlib_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,14 @@ func TestListStdlib(t *testing.T) {

stdPkgs := map[string]bool{
// os
"os.Getenv": true,
"os.Getwd": true,
"os.OpenFile": true,
"os.Getenv": true,
"os.Getwd": true,
"os.OpenFile": true,
"os.ReadFile": true,
"os.WriteFile": true,

// io/ioutl
"io/ioutil.ReadAll": true,

// time
"time.Now": true,
Expand Down

0 comments on commit bbcf8fc

Please sign in to comment.