@@ -66,15 +66,15 @@ func TestProjFile(t *testing.T) {
6666 }
6767}
6868
69- func TestSpriteOf (t * testing.T ) {
70- proj := & gmxProject {}
71- if getSpxObj (proj , "a" ) != nil {
72- t .Fatal ("spriteOf : not nil?" )
69+ func TestGetWorkClass (t * testing.T ) {
70+ proj := & classProject {}
71+ if getWorkClass (proj , "a" ) != nil {
72+ t .Fatal ("getWorkClass : not nil?" )
7373 }
7474}
7575
7676func TestGetGameClass (t * testing.T ) {
77- proj := & gmxProject {
77+ proj := & classProject {
7878 gameIsPtr : true ,
7979 hasMain_ : false ,
8080 gameClass_ : "" ,
@@ -84,7 +84,7 @@ func TestGetGameClass(t *testing.T) {
8484 },
8585 }
8686 ctx := & pkgCtx {
87- projs : map [string ]* gmxProject {".gmx " : proj , ".spx " : proj },
87+ projs : map [string ]* classProject {".a " : proj , ".b " : proj },
8888 nproj : 2 ,
8989 }
9090 if v := proj .getGameClass (ctx ); v != "BarApp" {
@@ -237,25 +237,25 @@ func TestErrParseTypeEmbedName(t *testing.T) {
237237 parseTypeEmbedName (& ast.StructType {})
238238}
239239
240- func TestGmxCheckProjs (t * testing.T ) {
241- _ , multi := gmxCheckProjs (nil , & pkgCtx {
242- projs : map [string ]* gmxProject {
240+ func TestCheckClassProjectsWithMain (t * testing.T ) {
241+ _ , multi := checkClassProjects (nil , & pkgCtx {
242+ projs : map [string ]* classProject {
243243 ".a" : {hasMain_ : true }, ".b" : {hasMain_ : true },
244244 },
245245 })
246246 if ! multi {
247- t .Fatal ("gmxCheckProjs : not multi?" )
247+ t .Fatal ("checkClassProjects : not multi?" )
248248 }
249249}
250250
251- func TestGmxCheckProjs2 (t * testing.T ) {
252- _ , multi := gmxCheckProjs (nil , & pkgCtx {
253- projs : map [string ]* gmxProject {
251+ func TestCheckClassProjectsWithoutMain (t * testing.T ) {
252+ _ , multi := checkClassProjects (nil , & pkgCtx {
253+ projs : map [string ]* classProject {
254254 ".a" : {}, ".b" : {},
255255 },
256256 })
257257 if ! multi {
258- t .Fatal ("gmxCheckProjs : not multi?" )
258+ t .Fatal ("checkClassProjects : not multi?" )
259259 }
260260}
261261
@@ -290,8 +290,8 @@ func TestClassNameAndExt(t *testing.T) {
290290 if name != "bar_abc" || clsfile != "bar.abc" || ext != "_yap.gox" {
291291 t .Fatal ("classNameAndExt:" , name , ext )
292292 }
293- name , clsfile , ext = ClassNameAndExt ("/foo/get-bar_:id.yap " )
294- if name != "get_bar_id" || clsfile != "get-bar_:id" || ext != ".yap " {
293+ name , clsfile , ext = ClassNameAndExt ("/foo/get-bar_:id_app.gox " )
294+ if name != "get_bar_id" || clsfile != "get-bar_:id" || ext != "_app.gox " {
295295 t .Fatal ("classNameAndExt:" , name , ext )
296296 }
297297}
@@ -326,10 +326,6 @@ func TestFileClassType(t *testing.T) {
326326 {true , true , false , "Abc_test.gox" , "caseAbc" , true , true },
327327 {true , true , false , "main_test.gox" , "case_main" , true , true },
328328
329- {true , false , false , "get.yap" , "get" , false , true },
330- {true , false , false , "get_p_#id.yap" , "get_p_id" , false , true },
331- {true , false , true , "main.yap" , "AppV2" , false , true },
332-
333329 {true , false , false , "abc_yap.gox" , "abc" , false , true },
334330 {true , false , false , "Abc_yap.gox" , "Abc" , false , true },
335331 {true , false , true , "main_yap.gox" , "App" , false , true },
@@ -344,11 +340,6 @@ func TestFileClassType(t *testing.T) {
344340 }
345341 lookupClass := func (ext string ) (c * Project , ok bool ) {
346342 switch ext {
347- case ".yap" :
348- return & modfile.Project {
349- Ext : ".yap" , Class : "AppV2" ,
350- Works : []* modfile.Class {{Ext : ".yap" , Class : "Handler" }},
351- PkgPaths : []string {"github.com/goplus/yap" }}, true
352343 case "_yap.gox" :
353344 return & modfile.Project {
354345 Ext : "_yap.gox" , Class : "App" ,
@@ -492,22 +483,22 @@ func TestClRangeStmt(t *testing.T) {
492483// -----------------------------------------------------------------------------
493484
494485func TestGetStringConst (t * testing.T ) {
495- spx := gogen.PkgRef {Types : types .NewPackage ("" , "foo" )}
496- if v := getStringConst (spx , "unknown" ); v != "" {
486+ pkg := gogen.PkgRef {Types : types .NewPackage ("" , "foo" )}
487+ if v := getStringConst (pkg , "unknown" ); v != "" {
497488 t .Fatal ("getStringConst:" , v )
498489 }
499490}
500491
501- func TestSpxRef (t * testing.T ) {
492+ func TestClassPkgRef (t * testing.T ) {
502493 defer func () {
503494 if e := recover (); ! isError (e , "foo.bar not found" ) {
504- t .Fatal ("TestSpxRef :" , e )
495+ t .Fatal ("TestClassPkgRef :" , e )
505496 }
506497 }()
507498 pkg := gogen.PkgRef {
508499 Types : types .NewPackage ("foo" , "foo" ),
509500 }
510- spxRef (pkg , "bar" )
501+ classPkgRef (pkg , "bar" )
511502}
512503
513504func isError (e any , msg string ) bool {
@@ -522,28 +513,28 @@ func isError(e any, msg string) bool {
522513 return false
523514}
524515
525- func TestGmxProject (t * testing.T ) {
516+ func TestClassProject (t * testing.T ) {
526517 pkg := gogen .NewPackage ("" , "foo" , goxConf )
527518 ctx := & pkgCtx {
528- projs : make (map [string ]* gmxProject ),
529- classes : make (map [* ast.File ]* gmxClass ),
519+ projs : make (map [string ]* classProject ),
520+ classes : make (map [* ast.File ]* classFile ),
530521 }
531- gmx := loadClass (ctx , pkg , "main.t2gmx" , & ast.File {IsProj : true }, & Config {
522+ proj := loadClass (ctx , pkg , "main.t2gmx" , & ast.File {IsProj : true }, & Config {
532523 LookupClass : lookupClass ,
533524 })
534- scheds := gmx .getScheds (pkg .CB ())
525+ scheds := proj .getScheds (pkg .CB ())
535526 if len (scheds ) != 2 || scheds [0 ] == nil || scheds [0 ] != scheds [1 ] {
536- t .Fatal ("TestGmxProject failed" )
527+ t .Fatal ("TestClassProject failed" )
537528 }
538- gmx .hasScheds = false
539- if gmx .getScheds (nil ) != nil {
540- t .Fatal ("TestGmxProject failed: hasScheds?" )
529+ proj .hasScheds = false
530+ if proj .getScheds (nil ) != nil {
531+ t .Fatal ("TestClassProject failed: hasScheds?" )
541532 }
542533
543534 func () {
544535 defer func () {
545536 if e := recover (); e != "class not found: .abcx" {
546- t .Fatal ("TestGmxProject failed:" , e )
537+ t .Fatal ("TestClassProject failed:" , e )
547538 }
548539 }()
549540 loadClass (nil , pkg , "main.abcx" , & ast.File {IsProj : true }, & Config {
@@ -553,7 +544,7 @@ func TestGmxProject(t *testing.T) {
553544 func () {
554545 defer func () {
555546 if e := recover (); e != "multiple project files found: main, main" {
556- t .Fatal ("TestGmxProject failed:" , e )
547+ t .Fatal ("TestClassProject failed:" , e )
557548 }
558549 }()
559550 loadClass (ctx , pkg , "main.t2gmx" , & ast.File {IsProj : true }, & Config {
@@ -562,13 +553,13 @@ func TestGmxProject(t *testing.T) {
562553 }()
563554}
564555
565- func TestSpxLookup (t * testing.T ) {
556+ func TestClassPkgLookup (t * testing.T ) {
566557 defer func () {
567558 if e := recover (); e == nil {
568- t .Fatal ("TestSpxLookup failed: no error?" )
559+ t .Fatal ("TestClassPkgLookup failed: no error?" )
569560 }
570561 }()
571- spxLookup (nil , "foo" )
562+ classPkgLookup (nil , "foo" )
572563}
573564
574565func lookupClass (ext string ) (c * modfile.Project , ok bool ) {
@@ -643,7 +634,7 @@ func testPanic(t *testing.T, panicMsg string, doPanic func()) {
643634
644635func TestClassFileEnd (t * testing.T ) {
645636 fset := token .NewFileSet ()
646- f , err := parser .ParseFile (fset , "get.yap " , `json {"id": ${id} }` , parser .ParseXGoClass )
637+ f , err := parser .ParseFile (fset , "get_app.gox " , `json {"id": ${id} }` , parser .ParseXGoClass )
647638 if err != nil {
648639 t .Fatal (err )
649640 }
0 commit comments