lock locks in tests

pull/13954/head
crthpl 2022-04-06 12:32:04 -07:00
parent a3b884f8f2
commit e53037a53b
No known key found for this signature in database
GPG Key ID: B8BBDB4002CB6F74
3 changed files with 16 additions and 8 deletions

View File

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

View File

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

View File

@ -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')
}