v2 / vlib / v / tests / shared_int_assign_test.v
18 lines · 16 sloc · 201 bytes · f8b74d7c213ed12c707f0c55848eeed1d445a3f0
Raw
1module main
2
3struct Foo {
4mut:
5 a shared int
6}
7
8fn test_main() {
9 mut x := Foo{}
10 lock x.a {
11 x.a = 100
12 }
13 rlock x.a {
14 k := x.a
15 // can't use assert x.a == 100, to be fixed
16 assert k == 100
17 }
18}
19