debug test cover more types

This commit is contained in:
Li Jie
2024-09-15 12:05:27 +08:00
parent 7ddc8c6aeb
commit 24995f46cb

View File

@@ -1,51 +1,89 @@
package foo package foo
type IFoo interface { import "errors"
type Base struct {
name string
}
type E struct {
Base
i int
}
type StructWithAllTypeFields struct {
i8 int8
i16 int16
i32 int32
i64 int64
i int
u8 uint8
u16 uint16
u32 uint32
u64 uint64
u uint
f32 float32
f64 float64
c64 complex64
c128 complex128
slice []int
arr [3]int
b bool
s string
e E
pf *StructWithAllTypeFields // resursive
pi *int
intr Interface
m map[string]uint64
c chan int
err error
}
type Interface interface {
Foo(a []int, b string) int Foo(a []int, b string) int
} }
type Foo struct { type Struct struct{}
nexy *Foo
data map[string]uint64
f32 float32
f64 float64
u8 uint8
u16 uint16
u32 uint32
u64 uint64
u uint
i8 int8
i16 int16
i32 int32
i64 int64
i int
b bool
arr [10]int
c64 complex64
c128 complex128
}
func (Foo) Foo(a []int, b string) int { func (s *Struct) Foo(a []int, b string) int {
return 1 return 1
} }
func fn(a int, b float64) int { func FuncWithAllTypeStructParam(s StructWithAllTypeFields) {
return 1 println(&s)
} }
func fn1(fn func(int, float64) int) { // Params is a function with all types of parameters.
fn(1, 1.0) func FuncWithAllTypeParams(
} i8 int8,
i16 int16,
func fn2() { i32 int32,
fn1(fn) i64 int64,
ch := make(chan int) i int,
go func() { u8 uint8,
ch <- 1 u16 uint16,
}() u32 uint32,
<-ch u64 uint64,
u uint,
f := Foo{} f32 float32,
var foo IFoo = f f64 float64,
foo.Foo(nil, "") c64 complex64,
c128 complex128,
slice []int,
arr [3]int,
b bool,
s string,
e E,
f StructWithAllTypeFields,
pf *StructWithAllTypeFields,
pi *int,
intr Interface,
m map[string]uint64,
c chan int,
err error,
) (int, error) {
println(
i8, i16, i32, i64, i, u8, u16, u32, u64, u, f32, f64, c64, c128,
slice, arr[0:], b, s, &e, &f, pf, pi, intr, m, c, err,
)
return 1, errors.New("Some error")
} }