v2 / vlib / v / tests / builtin_strings_and_interpolation / str_circular_test.v
21 lines · 19 sloc · 203 bytes · 6488041a749df9762348d019c4223908c476f2e2
Raw
1@[heap]
2struct Aa {
3mut:
4 bs []Bb
5}
6
7struct Bb {
8mut:
9 a &Aa = unsafe { nil }
10}
11
12fn test_circular() {
13 mut b := Bb{
14 a: &Aa{
15 bs: []Bb{cap: 1}
16 }
17 }
18 b.a.bs << b
19 s := b.str()
20 assert s.len < 3500
21}
22