debug test cover more types
This commit is contained in:
@@ -1,51 +1,89 @@
|
||||
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
|
||||
}
|
||||
|
||||
type Foo 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
|
||||
}
|
||||
type Struct struct{}
|
||||
|
||||
func (Foo) Foo(a []int, b string) int {
|
||||
func (s *Struct) Foo(a []int, b string) int {
|
||||
return 1
|
||||
}
|
||||
|
||||
func fn(a int, b float64) int {
|
||||
return 1
|
||||
func FuncWithAllTypeStructParam(s StructWithAllTypeFields) {
|
||||
println(&s)
|
||||
}
|
||||
|
||||
func fn1(fn func(int, float64) int) {
|
||||
fn(1, 1.0)
|
||||
}
|
||||
|
||||
func fn2() {
|
||||
fn1(fn)
|
||||
ch := make(chan int)
|
||||
go func() {
|
||||
ch <- 1
|
||||
}()
|
||||
<-ch
|
||||
|
||||
f := Foo{}
|
||||
var foo IFoo = f
|
||||
foo.Foo(nil, "")
|
||||
// Params is a function with all types of parameters.
|
||||
func FuncWithAllTypeParams(
|
||||
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,
|
||||
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")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user