Skip to content

Commit de4dd4d

Browse files
add unit test for cycle
1 parent 81f975c commit de4dd4d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

jsonschema/infer_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,17 @@ func TestForWithMutation(t *testing.T) {
142142
t.Fatalf("ForWithMutation: expected Required[0] to not be mutated")
143143
}
144144
}
145+
146+
type s struct {
147+
A t
148+
}
149+
type t struct {
150+
B []s
151+
}
152+
153+
func TestForWithCycle(t *testing.T) {
154+
_, err := jsonschema.For[s]()
155+
if err == nil {
156+
t.Fatalf("ForWithCycle: expected error, got nil")
157+
}
158+
}

0 commit comments

Comments
 (0)