mv cases to _cmptest

This commit is contained in:
xushiwei
2024-06-23 01:00:02 +08:00
parent cd6d4021b1
commit adeb5de19f
6 changed files with 1 additions and 1 deletions

View File

@@ -1,9 +0,0 @@
package foo
func Bar() any {
return struct{ V int }{1}
}
func F() any {
return struct{ v int }{1}
}

View File

@@ -1,35 +0,0 @@
package main
import (
"github.com/goplus/llgo/_demo/interf/foo"
)
func Foo() any {
return struct{ v int }{1}
}
func main() {
v := Foo()
if x, ok := v.(struct{ v int }); ok {
println(x.v)
} else {
println("Foo: not ok")
}
bar := foo.Bar()
if x, ok := bar.(struct{ V int }); ok {
println(x.V)
} else {
println("Bar: not ok")
}
if x, ok := foo.F().(struct{ v int }); ok {
println(x.v)
} else {
println("F: not ok")
}
}
/* Expected output:
1
1
F: not ok
*/

View File

@@ -1,13 +0,0 @@
package main
import "reflect"
func main() {
tyIntSlice := reflect.SliceOf(reflect.TypeOf(0))
v := reflect.Zero(tyIntSlice)
v = reflect.Append(v, reflect.ValueOf(1), reflect.ValueOf(2), reflect.ValueOf(3))
for i, n := 0, v.Len(); i < n; i++ {
item := v.Index(i)
println(item.Int())
}
}

View File

@@ -1,14 +0,0 @@
package main
import "reflect"
func main() {
tyIntSlice := reflect.SliceOf(reflect.TypeOf(0))
println(tyIntSlice.String())
v := reflect.Zero(tyIntSlice)
println(v.Len())
v = reflect.ValueOf(100)
println(v.Int())
}

View File

@@ -1,7 +0,0 @@
package main
import "strconv"
func main() {
println(strconv.Itoa(-123))
}

View File

@@ -1,11 +0,0 @@
package main
import "syscall"
func main() {
wd, err := syscall.Getwd()
if err != nil {
panic(err)
}
println("cwd:", wd)
}