Ai
1 Star 0 Fork 0

filecoin-project/go-ipfs

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
runmain_test.go 643 Bytes
一键复制 编辑 原始数据 按行查看 历史
// +build testrunmain
package main
import (
"flag"
"fmt"
"io/ioutil"
"os"
"testing"
)
// this abuses go so much that I felt dirty writing this code
// but it is the only way to do it without writing custom compiler that would
// be a clone of go-build with go-test
func TestRunMain(t *testing.T) {
args := flag.Args()
os.Args = append([]string{os.Args[0]}, args...)
ret := mainRet()
p := os.Getenv("IPFS_COVER_RET_FILE")
if len(p) != 0 {
ioutil.WriteFile(p, []byte(fmt.Sprintf("%d\n", ret)), 0777)
}
// close outputs so go testing doesn't print anything
null, _ := os.Open(os.DevNull)
os.Stderr = null
os.Stdout = null
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ipfs2/go-ipfs.git
git@gitee.com:ipfs2/go-ipfs.git
ipfs2
go-ipfs
go-ipfs
master

搜索帮助