Skip to content

Commit

Permalink
fix func_list tests
Browse files Browse the repository at this point in the history
  • Loading branch information
xhd2015 committed Apr 3, 2024
1 parent b27192a commit d56f35b
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# xgo
[![Go Reference](https://pkg.go.dev/badge/github.com/xhd2015/xgo.svg)](https://pkg.go.dev/github.com/xhd2015/xgo)
[![Go Report Card](https://goreportcard.com/badge/github.com/xhd2015/xgo)](https://goreportcard.com/report/github.com/xhd2015/xgo)
[![Go Coverage](https://img.shields.io/badge/Coverage-81.3%25-brightgreen)](https://github.com/xhd2015/xgo/actions)
[![Go Coverage](https://img.shields.io/badge/Coverage-82.6%25-brightgreen)](https://github.com/xhd2015/xgo/actions)
[![CI](https://github.com/xhd2015/xgo/workflows/Go/badge.svg)](https://github.com/xhd2015/xgo/actions)
[![Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go)

Expand Down
2 changes: 1 addition & 1 deletion README_zh_cn.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# xgo
[![Go Reference](https://pkg.go.dev/badge/github.com/xhd2015/xgo.svg)](https://pkg.go.dev/github.com/xhd2015/xgo)
[![Go Report Card](https://goreportcard.com/badge/github.com/xhd2015/xgo)](https://goreportcard.com/report/github.com/xhd2015/xgo)
[![Go Coverage](https://img.shields.io/badge/Coverage-81.3%25-brightgreen)](https://github.com/xhd2015/xgo/actions)
[![Go Coverage](https://img.shields.io/badge/Coverage-82.6%25-brightgreen)](https://github.com/xhd2015/xgo/actions)
[![CI](https://github.com/xhd2015/xgo/workflows/Go/badge.svg)](https://github.com/xhd2015/xgo/actions)
[![Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go)

Expand Down
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.16"
const REVISION = "6f59a908da45484b2104d51e2fa56d83d3bf65a5+1"
const NUMBER = 153
const REVISION = "b27192a64f46ddf3ddd2b02ca6fe52c8c4e03ffd+1"
const NUMBER = 154

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 @@ -54,9 +54,14 @@ var stdWhitelist = map[string]map[string]bool{
"ReadFile": true,
"WriteFile": true,
},
"io/ioutil": map[string]bool{
"io": map[string]bool{
"ReadAll": true,
},
"io/ioutil": map[string]bool{
"ReadAll": true,
"ReadFile": true,
"ReadDir": true,
},
"time": map[string]bool{
"Now": true,
// time.Sleep is special:
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.16"
const REVISION = "6f59a908da45484b2104d51e2fa56d83d3bf65a5+1"
const NUMBER = 153
const REVISION = "b27192a64f46ddf3ddd2b02ca6fe52c8c4e03ffd+1"
const NUMBER = 154

// these fields will be filled by compiler
const XGO_VERSION = ""
Expand Down
13 changes: 12 additions & 1 deletion runtime/test/func_list/func_list_stdlib_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package func_list

import (
"io"
"io/ioutil"
"net"
"net/http"
"os/exec"
Expand All @@ -14,6 +16,10 @@ var _ http.Request
var _ net.Addr
var _ time.Time
var _ exec.Cmd
var _ = ioutil.ReadAll
var _ = ioutil.ReadFile
var _ = ioutil.ReadDir
var _ = io.ReadAll

// go run ./cmd/xgo test --project-dir runtime -run TestListStdlib -v ./test/func_list
func TestListStdlib(t *testing.T) {
Expand All @@ -27,8 +33,13 @@ func TestListStdlib(t *testing.T) {
"os.ReadFile": true,
"os.WriteFile": true,

// io
"io.ReadAll": true,

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

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

0 comments on commit d56f35b

Please sign in to comment.