From a8710a91f757b5afd54a2f20796446cb36a73ae3 Mon Sep 17 00:00:00 2001 From: xushiwei Date: Wed, 6 Mar 2024 04:15:48 +0800 Subject: [PATCH] isGoxTestFile --- cl/classfile.go | 2 +- cl/compile.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cl/classfile.go b/cl/classfile.go index 3ebf85e73..c19d16ef2 100644 --- a/cl/classfile.go +++ b/cl/classfile.go @@ -92,7 +92,7 @@ func loadClass(ctx *pkgCtx, pkg *gox.Package, file string, f *ast.File, conf *Co p, ok := ctx.projs[gt.Ext] if !ok { pkgPaths := gt.PkgPaths - p = &gmxProject{pkgPaths: pkgPaths} + p = &gmxProject{pkgPaths: pkgPaths, isTest: isGoxTestFile(ext)} ctx.projs[gt.Ext] = p p.pkgImps = make([]gox.PkgRef, len(pkgPaths)) diff --git a/cl/compile.go b/cl/compile.go index 6ae75ca1b..846c0564a 100644 --- a/cl/compile.go +++ b/cl/compile.go @@ -730,12 +730,12 @@ func preloadGopFile(p *gox.Package, ctx *blockCtx, file string, f *ast.File, con } } else { c := parent.classes[f] + classType = c.tname proj, ctx.proj = c.proj, c.proj ctx.autoimps = proj.autoimps - classType = c.tname - if isGoxTestFile(c.ext) { // test classfile + goxTestFile = proj.isTest + if goxTestFile { // test classfile testType = c.tname - goxTestFile, proj.isTest = true, true if !f.IsProj { classType = casePrefix + testNameSuffix(testType) }