1
0
mirror of https://github.com/golang/go synced 2024-11-23 09:30:03 -07:00

Add recursiveSliceCycle case

This commit is contained in:
lujjjh 2020-09-17 22:36:52 +08:00
parent d80d86b4c3
commit 6f874944f4

View File

@ -183,11 +183,14 @@ type PointerCycleIndirect struct {
Ptrs []interface{}
}
type RecursiveSlice []RecursiveSlice
var (
pointerCycleIndirect = &PointerCycleIndirect{}
mapCycle = make(map[string]interface{})
sliceCycle = []interface{}{nil}
sliceNoCycle = []interface{}{nil, nil}
recursiveSliceCycle = []RecursiveSlice{nil}
)
func init() {
@ -204,6 +207,7 @@ func init() {
for i := startDetectingCyclesAfter; i > 0; i-- {
sliceNoCycle = []interface{}{sliceNoCycle}
}
recursiveSliceCycle[0] = recursiveSliceCycle
}
func TestSamePointerNoCycle(t *testing.T) {
@ -226,6 +230,7 @@ var unsupportedValues = []interface{}{
pointerCycleIndirect,
mapCycle,
sliceCycle,
recursiveSliceCycle,
}
func TestUnsupportedValues(t *testing.T) {