Hi,
I got an error when trying to generating a slice of pointers using the code below:
package main
import (
"github.com/leanovate/gopter"
"github.com/leanovate/gopter/gen"
"github.com/leanovate/gopter/prop"
"reflect"
)
type Empty struct {
ID uint
}
func main() {
properties := gopter.NewProperties(nil)
properties.Property("just test pointer", prop.ForAll(
func(nodes []*Empty) bool {
return true
},
gen.SliceOf(gen.Struct(reflect.TypeOf(&Empty{}), map[string]gopter.Gen{
"ID": gen.UInt(),
})),
))
properties.Run(gopter.ConsoleReporter(false))
}
The error was:
! just test pointer: Error on property evaluation after 0 passed tests:
Check paniced: reflect: Call using []main.Empty as type []*main.Empty
ARG_0: []
I think reflect.TypeOf(&Empty{}) returns *main.Empty instead of main.Empty, but according to the error messages, the generated type is []main.Empty; so I just wonder whether there's something wrong with my code here.
Hi,
I got an error when trying to generating a slice of pointers using the code below:
The error was:
I think
reflect.TypeOf(&Empty{})returns*main.Emptyinstead ofmain.Empty, but according to the error messages, the generated type is[]main.Empty; so I just wonder whether there's something wrong with my code here.