cl: support llgo.cstr

This commit is contained in:
xushiwei
2024-04-29 13:59:06 +08:00
parent 637db665c3
commit 4eb2ddaf15
8 changed files with 147 additions and 31 deletions

View File

@@ -25,6 +25,24 @@ import (
"golang.org/x/tools/go/ssa"
)
func TestCStrNoArgs(t *testing.T) {
defer func() {
if r := recover(); r == nil {
t.Fatal("cstr: no error?")
}
}()
cstr(nil, nil)
}
func TestCStrNonconst(t *testing.T) {
defer func() {
if r := recover(); r == nil {
t.Fatal("cstr: no error?")
}
}()
cstr(nil, []ssa.Value{&ssa.Parameter{}})
}
func TestPkgNoInit(t *testing.T) {
pkg := types.NewPackage("foo", "foo")
ctx := &context{