From e53037a53b053c979ef3e3a8af21d8b449c86fd0 Mon Sep 17 00:00:00 2001 From: crthpl Date: Wed, 6 Apr 2022 12:32:04 -0700 Subject: [PATCH] lock locks in tests --- vlib/v/tests/shared_autolock_test.v | 8 ++++++-- vlib/v/tests/shared_in_test.v | 12 +++++++----- vlib/vweb/tests/vweb_test_server.v | 4 +++- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/vlib/v/tests/shared_autolock_test.v b/vlib/v/tests/shared_autolock_test.v index cf9f6b6418..fc41047f90 100644 --- a/vlib/v/tests/shared_autolock_test.v +++ b/vlib/v/tests/shared_autolock_test.v @@ -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 + } } diff --git a/vlib/v/tests/shared_in_test.v b/vlib/v/tests/shared_in_test.v index 1fbe2c0975..0cd29cd90a 100644 --- a/vlib/v/tests/shared_in_test.v +++ b/vlib/v/tests/shared_in_test.v @@ -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 + } } diff --git a/vlib/vweb/tests/vweb_test_server.v b/vlib/vweb/tests/vweb_test_server.v index 5d4cbff1e5..6af589aff3 100644 --- a/vlib/vweb/tests/vweb_test_server.v +++ b/vlib/vweb/tests/vweb_test_server.v @@ -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') }