lock locks in tests
parent
a3b884f8f2
commit
e53037a53b
|
|
@ -13,7 +13,9 @@ fn test_autolock_array() {
|
|||
a[2]++
|
||||
}
|
||||
t.wait()
|
||||
assert a[2] == 2 * iterations + 7
|
||||
rlock a {
|
||||
assert a[2] == 2 * iterations + 7
|
||||
}
|
||||
}
|
||||
|
||||
fn inc_map_elem(shared b map[string]int, k string) {
|
||||
|
|
@ -34,5 +36,7 @@ fn test_autolock_map() {
|
|||
m['asd']++
|
||||
}
|
||||
t.wait()
|
||||
assert m['asd'] == 2 * iterations + 7
|
||||
rlock m {
|
||||
assert m['asd'] == 2 * iterations + 7
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
fn test_shared_in() {
|
||||
shared a := [1, 3, 7, 3]
|
||||
assert 1 in a
|
||||
assert 0 !in a
|
||||
assert 7 in a
|
||||
assert 3 in a
|
||||
assert 1238941 !in a
|
||||
rlock a {
|
||||
assert 1 in a
|
||||
assert 0 !in a
|
||||
assert 7 in a
|
||||
assert 3 in a
|
||||
assert 1238941 !in a
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,9 @@ fn main() {
|
|||
//}
|
||||
|
||||
pub fn (mut app App) index() vweb.Result {
|
||||
assert app.global_config.max_ping == 50
|
||||
rlock app.global_config {
|
||||
assert app.global_config.max_ping == 50
|
||||
}
|
||||
return app.text('Welcome to VWeb')
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue