tests: add a missing shared map test (#19322)

This commit is contained in:
Felipe Pena 2023-09-11 03:06:07 -03:00 committed by GitHub
parent 140b5a3e39
commit 1ce4213afb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View 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
}
}