mirror of
https://github.com/vlang/v.git
synced 2025-09-13 22:42:26 +03:00
tests: add a missing shared map test (#19322)
This commit is contained in:
parent
140b5a3e39
commit
1ce4213afb
1 changed files with 23 additions and 0 deletions
23
vlib/v/tests/shared_map_ptr_test.v
Normal file
23
vlib/v/tests/shared_map_ptr_test.v
Normal file
|
@ -0,0 +1,23 @@
|
|||
struct Abc {
|
||||
f shared map[string]&Abc
|
||||
}
|
||||
|
||||
fn test_main() {
|
||||
c := Abc{}
|
||||
b := Abc{}
|
||||
a := Abc{
|
||||
f: b.f
|
||||
}
|
||||
|
||||
lock a.f, b.f {
|
||||
a.f['a'] = &c
|
||||
}
|
||||
lock b.f {
|
||||
b.f['b'] = &c
|
||||
}
|
||||
|
||||
dump(b.f)
|
||||
rlock b.f {
|
||||
assert b.f.len == 2
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue