@@ -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}
@@ -328,10 +328,6 @@ func TestFileClassType(t *testing.T) {
328328 {true , true , false , "Abc_test.gox" , "caseAbc" , true , true },
329329 {true , true , false , "main_test.gox" , "case_main" , true , true },
330330
331- {true , false , false , "get.yap" , "get" , false , true },
332- {true , false , false , "get_p_#id.yap" , "get_p_id" , false , true },
333- {true , false , true , "main.yap" , "AppV2" , false , true },
334-
335331 {true , false , false , "abc_yap.gox" , "abc" , false , true },
336332 {true , false , false , "Abc_yap.gox" , "Abc" , false , true },
337333 {true , false , false , "chan_yap.gox" , "_chan" , false , true },
@@ -349,11 +345,6 @@ func TestFileClassType(t *testing.T) {
349345 }
350346 lookupClass := func (ext string ) (c * Project , ok bool ) {
351347 switch ext {
352- case ".yap" :
353- return & modfile.Project {
354- Ext : ".yap" , Class : "AppV2" ,
355- Works : []* modfile.Class {{Ext : ".yap" , Class : "Handler" }},
356- PkgPaths : []string {"github.com/goplus/yap" }}, true
357348 case "_yap.gox" :
358349 return & modfile.Project {
359350 Ext : "_yap.gox" , Class : "App" ,
@@ -504,22 +495,22 @@ func TestClRangeStmt(t *testing.T) {
504495// -----------------------------------------------------------------------------
505496
506497func TestGetStringConst (t * testing.T ) {
507- spx := gogen.PkgRef {Types : types .NewPackage ("" , "foo" )}
508- if v := getStringConst (spx , "unknown" ); v != "" {
498+ pkg := gogen.PkgRef {Types : types .NewPackage ("" , "foo" )}
499+ if v := getStringConst (pkg , "unknown" ); v != "" {
509500 t .Fatal ("getStringConst:" , v )
510501 }
511502}
512503
513- func TestSpxRef (t * testing.T ) {
504+ func TestClassPkgRef (t * testing.T ) {
514505 defer func () {
515506 if e := recover (); ! isError (e , "foo.bar not found" ) {
516- t .Fatal ("TestSpxRef :" , e )
507+ t .Fatal ("TestClassPkgRef :" , e )
517508 }
518509 }()
519510 pkg := gogen.PkgRef {
520511 Types : types .NewPackage ("foo" , "foo" ),
521512 }
522- spxRef (pkg , "bar" )
513+ classPkgRef (pkg , "bar" )
523514}
524515
525516func isError (e any , msg string ) bool {
@@ -534,28 +525,28 @@ func isError(e any, msg string) bool {
534525 return false
535526}
536527
537- func TestGmxProject (t * testing.T ) {
528+ func TestClassProject (t * testing.T ) {
538529 pkg := gogen .NewPackage ("" , "foo" , goxConf )
539530 ctx := & pkgCtx {
540- projs : make (map [string ]* gmxProject ),
541- classes : make (map [* ast.File ]* gmxClass ),
531+ projs : make (map [string ]* classProject ),
532+ classes : make (map [* ast.File ]* classFile ),
542533 }
543- gmx := loadClass (ctx , pkg , "main.t2gmx" , & ast.File {IsProj : true }, & Config {
534+ proj := loadClass (ctx , pkg , "main.t2gmx" , & ast.File {IsProj : true }, & Config {
544535 LookupClass : lookupClass ,
545536 })
546- scheds := gmx .getScheds (pkg .CB ())
537+ scheds := proj .getScheds (pkg .CB ())
547538 if len (scheds ) != 2 || scheds [0 ] == nil || scheds [0 ] != scheds [1 ] {
548- t .Fatal ("TestGmxProject failed" )
539+ t .Fatal ("TestClassProject failed" )
549540 }
550- gmx .hasScheds = false
551- if gmx .getScheds (nil ) != nil {
552- t .Fatal ("TestGmxProject failed: hasScheds?" )
541+ proj .hasScheds = false
542+ if proj .getScheds (nil ) != nil {
543+ t .Fatal ("TestClassProject failed: hasScheds?" )
553544 }
554545
555546 func () {
556547 defer func () {
557548 if e := recover (); e != "class not found: .abcx" {
558- t .Fatal ("TestGmxProject failed:" , e )
549+ t .Fatal ("TestClassProject failed:" , e )
559550 }
560551 }()
561552 loadClass (nil , pkg , "main.abcx" , & ast.File {IsProj : true }, & Config {
@@ -565,7 +556,7 @@ func TestGmxProject(t *testing.T) {
565556 func () {
566557 defer func () {
567558 if e := recover (); e != "multiple project files found: main, main" {
568- t .Fatal ("TestGmxProject failed:" , e )
559+ t .Fatal ("TestClassProject failed:" , e )
569560 }
570561 }()
571562 loadClass (ctx , pkg , "main.t2gmx" , & ast.File {IsProj : true }, & Config {
@@ -574,13 +565,13 @@ func TestGmxProject(t *testing.T) {
574565 }()
575566}
576567
577- func TestSpxLookup (t * testing.T ) {
568+ func TestClassPkgLookup (t * testing.T ) {
578569 defer func () {
579570 if e := recover (); e == nil {
580- t .Fatal ("TestSpxLookup failed: no error?" )
571+ t .Fatal ("TestClassPkgLookup failed: no error?" )
581572 }
582573 }()
583- spxLookup (nil , "foo" )
574+ classPkgLookup (nil , "foo" )
584575}
585576
586577func lookupClass (ext string ) (c * modfile.Project , ok bool ) {
@@ -655,7 +646,7 @@ func testPanic(t *testing.T, panicMsg string, doPanic func()) {
655646
656647func TestClassFileEnd (t * testing.T ) {
657648 fset := token .NewFileSet ()
658- f , err := parser .ParseFile (fset , "get.yap " , `json {"id": ${id} }` , parser .ParseXGoClass )
649+ f , err := parser .ParseFile (fset , "get_app.gox " , `json {"id": ${id} }` , parser .ParseXGoClass )
659650 if err != nil {
660651 t .Fatal (err )
661652 }
0 commit comments