Skip to content

Commit 1ce4213

Browse files
authored
tests: add a missing shared map test (#19322)
1 parent 140b5a3 commit 1ce4213

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

vlib/v/tests/shared_map_ptr_test.v

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
struct Abc {
2+
f shared map[string]&Abc
3+
}
4+
5+
fn test_main() {
6+
c := Abc{}
7+
b := Abc{}
8+
a := Abc{
9+
f: b.f
10+
}
11+
12+
lock a.f, b.f {
13+
a.f['a'] = &c
14+
}
15+
lock b.f {
16+
b.f['b'] = &c
17+
}
18+
19+
dump(b.f)
20+
rlock b.f {
21+
assert b.f.len == 2
22+
}
23+
}

0 commit comments

Comments
 (0)