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 b27192a
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
6 changes: 3 additions & 3 deletions cmd/xgo/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package main

import "fmt"

const VERSION = "1.0.15"
const REVISION = "2861a46387df90bcadae7651dc6e0d2db8ab0148+1"
const NUMBER = 152
const VERSION = "1.0.16"
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
6 changes: 3 additions & 3 deletions runtime/core/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"os"
)

const VERSION = "1.0.15"
const REVISION = "2861a46387df90bcadae7651dc6e0d2db8ab0148+1"
const NUMBER = 152
const VERSION = "1.0.16"
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 b27192a

Please sign in to comment.