TestErrImport

This commit is contained in:
xushiwei
2024-06-17 04:11:31 +08:00
parent 4097f90938
commit ebc9711309
2 changed files with 8 additions and 4 deletions

View File

@@ -29,6 +29,7 @@ import (
func TestCollectSkipNames(t *testing.T) { func TestCollectSkipNames(t *testing.T) {
ctx := &context{skips: make(map[string]none)} ctx := &context{skips: make(map[string]none)}
ctx.collectSkipNames("//llgo:skipall")
ctx.collectSkipNames("//llgo:skip") ctx.collectSkipNames("//llgo:skip")
ctx.collectSkipNames("//llgo:skip abs") ctx.collectSkipNames("//llgo:skip abs")
} }
@@ -219,6 +220,13 @@ func TestErrImport(t *testing.T) {
var ctx context var ctx context
pkg := types.NewPackage("foo", "foo") pkg := types.NewPackage("foo", "foo")
ctx.importPkg(pkg, nil) ctx.importPkg(pkg, nil)
alt := types.NewPackage("bar", "bar")
alt.Scope().Insert(
types.NewConst(0, alt, "LLGoPackage", types.Typ[types.String], constant.MakeString("noinit")),
)
ctx.patches = Patches{"foo": &ssa.Package{Pkg: alt}}
ctx.importPkg(pkg, &pkgInfo{})
} }
func TestErrInitLinkname(t *testing.T) { func TestErrInitLinkname(t *testing.T) {

View File

@@ -28,7 +28,6 @@ import (
"strings" "strings"
"github.com/goplus/llgo/cl/blocks" "github.com/goplus/llgo/cl/blocks"
"github.com/goplus/llgo/internal/packages"
"github.com/goplus/llgo/internal/typepatch" "github.com/goplus/llgo/internal/typepatch"
llssa "github.com/goplus/llgo/ssa" llssa "github.com/goplus/llgo/ssa"
"golang.org/x/tools/go/ssa" "golang.org/x/tools/go/ssa"
@@ -1022,9 +1021,6 @@ func NewPackageEx(prog llssa.Program, patches Patches, pkg *ssa.Package, files [
pkg.Pkg = pkgTypes pkg.Pkg = pkgTypes
alt.Pkg = pkgTypes alt.Pkg = pkgTypes
} }
if packages.DebugPackagesLoad {
log.Println("==> NewPackageEx", pkgPath, hasPatch)
}
if pkgPath == llssa.PkgRuntime { if pkgPath == llssa.PkgRuntime {
prog.SetRuntime(pkgTypes) prog.SetRuntime(pkgTypes)
} }