xgo icon indicating copy to clipboard operation
xgo copied to clipboard

All-in-one go testing library

Results 38 xgo issues
Sort by recently updated
recently updated
newest added

在java或者c#这样的语言中,支持在单元测试的时候动态生成接口的mock类, 在rust中,也支持添加特性的形式来支持动态生成mock. c系列的语言,一般没这功能。目前项目所有的底层依赖包全都生成了mock静态文件,即使用不到, 这体验非常差. go的编译器也比较弱,对于动态加载go代码支持也比较差. xgo如果是从编译器层面提供支持,应该可以添加这个功能,也是亮点.

The problem is: is it possible to call arbitrary function through http without modifying any code? The answer is: it is possible, and could be a major feature of xgo....

feature
testing

Currently init functions are skipped, that makes it impossible to inject mock and collect trace during the init stage. However since init functions just run once and run serially, it...

trace

Some function may modify it's input, and some may not. For these modifying the input, serializing the snapshot helps to improve the trace accuracy. And it's better to support this...

trace

Do not require user to manually modify the code, the tool can automatically parse the code and rewrite gomonkey API calls to xgo

mock

Fail message: ```sh fatal error: runtime: C malloc failed _cgo_gotypes.go:202 ... github.com/mattn/go-sqlite3._Cfunc_CString({0xc00004f130, 0x4a}) _cgo_gotypes.go:202 +0x1d2 fp=0xc000e663d8 sp=0xc000e662c8 pc=0x101ac2a72 github.com/mattn/go-sqlite3.(*SQLiteDriver).Open(0xc0008eaf60, {0xc00004f130, 0x4a}) /Users/xhd2015/Projects/gopath/pkg/mod/github.com/mattn/[email protected]/sqlite3.go:1456 +0x2a5e fp=0xc000e66920 sp=0xc000e663d8 pc=0x101af06be database/sql.dsnConnector.Connect(...) /Users/xhd2015/.xgo/go-instrument/go1.21.7_Us_xh_in_go_096be049/go1.21.7/src/database/sql/sql.go:758 ``` The...

bug
done
needs_internal_doc

This has positive impact on performance since only a small portion of the program will be intercepted

When writing asserts, could we just naturally do the actual check without repeating any name? Current situation: ```go if result!="1234"{ t.Fatalf("expect result to be %s, actual: %s", "123", result) }...

feature