Files
llgo/_demo/go/issue1370_geometry/geometry.go
xgopilot 0ee2530c2e refactor: move issue #1370 regression tests to _demo/go
Move the three regression test cases from _demo/ to _demo/go/:
- issue1370_gotypes (go/types.Object test)
- issue1370_goast (go/ast.Expr test)
- issue1370_geometry (custom interface test)

Updated import path in geometry.go to reflect new location.

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <51194195+luoliwoshang@users.noreply.github.com>
2025-10-27 07:25:20 +00:00

33 lines
561 B
Go

package main
import (
"fmt"
"github.com/goplus/llgo/_demo/go/issue1370_geometry/geometry"
)
func main() {
rect := geometry.NewRectangle(5.0, 3.0)
err := geometry.RegisterShape(rect, 42)
if err != nil {
println("FAIL: RegisterShape returned error")
return
}
if rect.GetID() != 42 {
println("FAIL: ID not set correctly")
return
}
area := rect.Area()
fmt.Printf("Area: %.1f\n", area)
if area != 15.0 {
println("FAIL: Area calculation incorrect")
return
}
println("SUCCESS: Custom interface with private methods works correctly")
}