From d8fe8fa5ac56013fd4976019040f4a2102279633 Mon Sep 17 00:00:00 2001 From: Vladimir Davydov <vdavydov@tarantool.org> Date: Thu, 24 Aug 2023 15:18:30 +0300 Subject: [PATCH] test: add missing trailing semicolon after ok/is/isnt unit test helpers The ok/is/isnt macros expand to {} so they may be used without a trailing semicolon. This is going to be fixed so let's add missing semicolons. NO_DOC=code cleanup NO_CHANGELOG=code cleanup (cherry picked from commit 4871b6975926b7b4d28de8ef43b6ade5b093ab87) --- test/unit/bps_tree_view.c | 12 ++++++------ test/unit/crypto.c | 2 +- test/unit/json.c | 15 ++++++++------- test/unit/prbuf.c | 4 ++-- test/unit/raft.c | 2 +- test/unit/swim.c | 8 ++++---- test/unit/swim_errinj.c | 2 +- test/unit/tuple_bigref.c | 26 +++++++++++++------------- test/unit/tweaks.c | 4 ++-- test/unit/vclock.cc | 3 ++- test/unit/vy_mem.c | 4 ++-- test/unit/vy_point_lookup.c | 6 +++--- test/unit/xmalloc.c | 2 +- test/unit/xrow.cc | 6 +++--- 14 files changed, 49 insertions(+), 47 deletions(-) diff --git a/test/unit/bps_tree_view.c b/test/unit/bps_tree_view.c index 22edaa8bf9..dec213e82c 100644 --- a/test/unit/bps_tree_view.c +++ b/test/unit/bps_tree_view.c @@ -139,20 +139,20 @@ test_first(void) test_tree_do_insert(&tree, i); it = test_tree_view_first(&view); p = test_tree_view_iterator_get_elem(&view, &it); - is(p, NULL, "empty view first after tree change") + is(p, NULL, "empty view first after tree change"); test_tree_view_destroy(&view); test_tree_view_create(&view, &tree); it = test_tree_view_first(&view); p = test_tree_view_iterator_get_elem(&view, &it); ok(p != NULL && *p == 0, - "non-empty view first before tree change") + "non-empty view first before tree change"); for (int i = 0; i < 100; i++) test_tree_delete(&tree, i); it = test_tree_view_first(&view); p = test_tree_view_iterator_get_elem(&view, &it); ok(p != NULL && *p == 0, - "non-empty view first after tree change") + "non-empty view first after tree change"); test_tree_view_destroy(&view); test_tree_destroy(&tree); @@ -179,20 +179,20 @@ test_last(void) test_tree_do_insert(&tree, i); it = test_tree_view_last(&view); p = test_tree_view_iterator_get_elem(&view, &it); - is(p, NULL, "empty view last after tree change") + is(p, NULL, "empty view last after tree change"); test_tree_view_destroy(&view); test_tree_view_create(&view, &tree); it = test_tree_view_last(&view); p = test_tree_view_iterator_get_elem(&view, &it); ok(p != NULL && *p == 999, - "non-empty view last before tree change") + "non-empty view last before tree change"); for (int i = 900; i < 1000; i++) test_tree_delete(&tree, i); it = test_tree_view_last(&view); p = test_tree_view_iterator_get_elem(&view, &it); ok(p != NULL && *p == 999, - "non-empty view last after tree change") + "non-empty view last after tree change"); test_tree_view_destroy(&view); test_tree_destroy(&tree); diff --git a/test/unit/crypto.c b/test/unit/crypto.c index 1c86724a93..94359823e6 100644 --- a/test/unit/crypto.c +++ b/test/unit/crypto.c @@ -105,7 +105,7 @@ test_aes128_codec(void) rc = crypto_codec_encrypt(c, iv2, plain, plain_size, buffer2, buffer_size); is(rc, 16, "encrypt with different IV and the same number of written "\ - "bytes returned") + "bytes returned"); isnt(memcmp(buffer2, buffer1, rc), 0, "the encrypted data looks different"); rc = crypto_codec_decrypt(c, iv2, buffer2, 16, buffer1, buffer_size); diff --git a/test/unit/json.c b/test/unit/json.c index 0a384bb7e5..0b6d7f20a8 100644 --- a/test/unit/json.c +++ b/test/unit/json.c @@ -42,7 +42,7 @@ test_basic() is_next_key("field3"); is_next_index(3, 4); - reset_to_new_path("[3].field[2].field") + reset_to_new_path("[3].field[2].field"); is_next_index(3, 2); is_next_key("field"); is_next_index(3, 1); @@ -141,25 +141,26 @@ test_errors() "error on position %d for <%s>", errpos, path); } - reset_to_new_path("f.[2]") + reset_to_new_path("f.[2]"); struct json_token token; json_lexer_next_token(&lexer, &token); - is(json_lexer_next_token(&lexer, &token), 3, "can not write <field.[index]>") + is(json_lexer_next_token(&lexer, &token), 3, + "can not write <field.[index]>"); - reset_to_new_path("[1]key") + reset_to_new_path("[1]key"); json_lexer_next_token(&lexer, &token); is(json_lexer_next_token(&lexer, &token), 4, "can not omit '.' before "\ "not a first key out of []"); - reset_to_new_path("f.") + reset_to_new_path("f."); json_lexer_next_token(&lexer, &token); is(json_lexer_next_token(&lexer, &token), 3, "error in leading <.>"); - reset_to_new_path("fiel d1") + reset_to_new_path("feel d1"); json_lexer_next_token(&lexer, &token); is(json_lexer_next_token(&lexer, &token), 5, "space inside identifier"); - reset_to_new_path("field\t1") + reset_to_new_path("field\t1"); json_lexer_next_token(&lexer, &token); is(json_lexer_next_token(&lexer, &token), 6, "tab inside identifier"); diff --git a/test/unit/prbuf.c b/test/unit/prbuf.c index 3857c12535..4f4d664119 100644 --- a/test/unit/prbuf.c +++ b/test/unit/prbuf.c @@ -282,7 +282,7 @@ test_buffer_prepared(void) size_t new_entry_count = 0; while (prbuf_iterator_next(&iter, &entry) == 0) new_entry_count++; - is(new_entry_count < entry_count, true, "Entry count has decreased") + is(new_entry_count < entry_count, true, "Entry count has decreased"); footer(); } @@ -324,7 +324,7 @@ test_buffer_prepared_large(void) size_t entry_count_after = 0; while (prbuf_iterator_next(&iter, &entry) == 0) entry_count_after++; - is(entry_count_after, entry_count, "Buffer is in correct state") + is(entry_count_after, entry_count, "Buffer is in correct state"); footer(); } diff --git a/test/unit/raft.c b/test/unit/raft.c index 63f13d0979..56e6a53983 100644 --- a/test/unit/raft.c +++ b/test/unit/raft.c @@ -2267,7 +2267,7 @@ raft_test_pre_vote(void) raft_run_for(node.cfg_death_timeout / 2); is(raft_leader_idle(&node.raft), node.cfg_death_timeout / 2, - "leader_idle counts from 0 on a previous leader") + "leader_idle counts from 0 on a previous leader"); raft_node_cfg_is_enabled(&node, false); diff --git a/test/unit/swim.c b/test/unit/swim.c index 83926dca59..96ad568c10 100644 --- a/test/unit/swim.c +++ b/test/unit/swim.c @@ -358,7 +358,7 @@ swim_test_probe(void) is(swim_probe_member(s1, NULL), -1, "probe validates URI"); is(swim_probe_member(s1, s2_uri), 0, "send probe"); is(swim_cluster_wait_fullmesh(cluster, 0.1), 0, - "receive ACK on probe and get fullmesh") + "receive ACK on probe and get fullmesh"); swim_cluster_delete(cluster); swim_finish_test(); @@ -514,7 +514,7 @@ swim_test_quit(void) swim_member_unref(s0_self); is(swim_cluster_wait_status_everywhere(cluster, 0, MEMBER_LEFT, 0), 0, "'quit' is sent to all the members without delays between "\ - "dispatches") + "dispatches"); /* * Return the instance back and check that it refutes the * old LEFT status. @@ -557,7 +557,7 @@ swim_test_quit(void) swim_cluster_unblock_io(cluster, 1); is(swim_cluster_wait_incarnation(cluster, 1, 1, 1, 1, 0), 0, "S2 finally got 'quit' message from S1, but with its 'own' UUID - "\ - "refute it") + "refute it"); swim_cluster_delete(cluster); /** @@ -1081,7 +1081,7 @@ swim_test_member_by_uuid(void) struct swim *s1 = swim_cluster_member(cluster, 0); const struct swim_member *s1_self = swim_self(s1); is(swim_member_by_uuid(s1, swim_member_uuid(s1_self)), s1_self, - "found by UUID") + "found by UUID"); struct tt_uuid uuid = uuid_nil; uuid.time_low = 1000; diff --git a/test/unit/swim_errinj.c b/test/unit/swim_errinj.c index 00b59f63c5..085a912fc1 100644 --- a/test/unit/swim_errinj.c +++ b/test/unit/swim_errinj.c @@ -165,7 +165,7 @@ swim_test_payload_refutation(void) swim_cluster_set_drop_out(cluster, 2, 100); is(swim_cluster_wait_payload_everywhere(cluster, 0, s0_new_payload, s0_new_payload_size, 3), 0, - "S3 learns S1's payload from S2") + "S3 learns S1's payload from S2"); swim_cluster_delete(cluster); swim_finish_test(); diff --git a/test/unit/tuple_bigref.c b/test/unit/tuple_bigref.c index d99ec6f9ca..27d5e2d107 100644 --- a/test/unit/tuple_bigref.c +++ b/test/unit/tuple_bigref.c @@ -104,12 +104,12 @@ test_one() tuple = create_tuple(); is(tuple_count, 1, "allocated"); - is(tuple_bigref_tuple_count(), 0, "no bigrefs") + is(tuple_bigref_tuple_count(), 0, "no bigrefs"); tuple_unref(tuple); is(tuple_count, 0, "deallocated"); - is(tuple_bigref_tuple_count(), 0, "no bigrefs") + is(tuple_bigref_tuple_count(), 0, "no bigrefs"); /* few refs */ tuple = create_tuple(); @@ -117,13 +117,13 @@ test_one() tuple_ref(tuple); is(tuple_count, 1, "allocated"); - is(tuple_bigref_tuple_count(), 0, "no bigrefs") + is(tuple_bigref_tuple_count(), 0, "no bigrefs"); for (size_t j = 0; j < FEW_REFS; j++) tuple_unref(tuple); is(tuple_count, 0, "deallocated"); - is(tuple_bigref_tuple_count(), 0, "no bigrefs") + is(tuple_bigref_tuple_count(), 0, "no bigrefs"); /* many refs */ tuple = create_tuple(); @@ -131,13 +131,13 @@ test_one() tuple_ref(tuple); is(tuple_count, 1, "allocated"); - is(tuple_bigref_tuple_count(), 1, "bigrefs") + is(tuple_bigref_tuple_count(), 1, "bigrefs"); for (size_t j = 0; j < MANY_REFS; j++) tuple_unref(tuple); is(tuple_count, 0, "all deallocated"); - is(tuple_bigref_tuple_count(), 0, "no bigrefs") + is(tuple_bigref_tuple_count(), 0, "no bigrefs"); footer(); check_plan(); @@ -160,13 +160,13 @@ test_batch() tuples[i] = create_tuple(); is(tuple_count, TEST_MAX_TUPLE_COUNT, "all allocated"); - is(tuple_bigref_tuple_count(), 0, "no bigrefs") + is(tuple_bigref_tuple_count(), 0, "no bigrefs"); for (size_t i = 0; i < TEST_MAX_TUPLE_COUNT; i++) tuple_unref(tuples[i]); is(tuple_count, 0, "all deallocated"); - is(tuple_bigref_tuple_count(), 0, "no bigrefs") + is(tuple_bigref_tuple_count(), 0, "no bigrefs"); /* few refs */ for (size_t i = 0; i < TEST_MAX_TUPLE_COUNT; i++) @@ -176,14 +176,14 @@ test_batch() tuple_ref(tuples[i]); is(tuple_count, TEST_MAX_TUPLE_COUNT, "all allocated"); - is(tuple_bigref_tuple_count(), 0, "no bigrefs") + is(tuple_bigref_tuple_count(), 0, "no bigrefs"); for (size_t i = 0; i < TEST_MAX_TUPLE_COUNT; i++) for (size_t j = 0; j < FEW_REFS; j++) tuple_unref(tuples[i]); is(tuple_count, 0, "all deallocated"); - is(tuple_bigref_tuple_count(), 0, "no bigrefs") + is(tuple_bigref_tuple_count(), 0, "no bigrefs"); /* many refs */ for (size_t i = 0; i < TEST_MAX_TUPLE_COUNT; i++) @@ -194,7 +194,7 @@ test_batch() } is(tuple_count, TEST_MAX_TUPLE_COUNT, "all allocated"); - is(tuple_bigref_tuple_count(), TEST_MAX_TUPLE_COUNT, "all bigrefs") + is(tuple_bigref_tuple_count(), TEST_MAX_TUPLE_COUNT, "all bigrefs"); for (size_t i = 0; i < TEST_MAX_TUPLE_COUNT; i++) { for (size_t j = 0; j < MANY_REFS; j++) @@ -202,7 +202,7 @@ test_batch() } is(tuple_count, 0, "all deallocated"); - is(tuple_bigref_tuple_count(), 0, "no bigrefs") + is(tuple_bigref_tuple_count(), 0, "no bigrefs"); footer(); check_plan(); @@ -251,7 +251,7 @@ test_random() tuple_unref(allocated_tuples[0]); ok(no_erros, "no errors"); - is(tuple_bigref_tuple_count(), 0, "no bigrefs") + is(tuple_bigref_tuple_count(), 0, "no bigrefs"); footer(); check_plan(); diff --git a/test/unit/tweaks.c b/test/unit/tweaks.c index fe5a415d4d..56504b7e4e 100644 --- a/test/unit/tweaks.c +++ b/test/unit/tweaks.c @@ -132,7 +132,7 @@ test_bool_var(void) v.type = TWEAK_VALUE_BOOL; v.bval = false; is(tweak_set(t, &v), 0, "set tweak value"); - is(bool_var, false, "var value after set") + is(bool_var, false, "var value after set"); tweak_get(t, &v); is(v.type, TWEAK_VALUE_BOOL, "tweak value type after set"); is(v.bval, false, "tweak value after set"); @@ -171,7 +171,7 @@ test_int_var(void) v.type = TWEAK_VALUE_INT; v.ival = 11; is(tweak_set(t, &v), 0, "set tweak value"); - is(int_var, 11, "var value after set") + is(int_var, 11, "var value after set"); tweak_get(t, &v); is(v.type, TWEAK_VALUE_INT, "tweak value type after set"); is(v.ival, 11, "tweak value after set"); diff --git a/test/unit/vclock.cc b/test/unit/vclock.cc index 230812d5f7..235e562df6 100644 --- a/test/unit/vclock.cc +++ b/test/unit/vclock.cc @@ -346,7 +346,8 @@ test_fromstring() struct vclock tmp; \ vclock_create(&tmp); \ is(vclock_from_string(&tmp, str), offset, \ - "fromstring \"%s\" => %u", str, offset)}) + "fromstring \"%s\" => %u", str, offset); \ +}) int test_fromstring_invalid() diff --git a/test/unit/vy_mem.c b/test/unit/vy_mem.c index 5d4b7038d8..e91aa458a3 100644 --- a/test/unit/vy_mem.c +++ b/test/unit/vy_mem.c @@ -48,9 +48,9 @@ test_basic(void) /* Check version */ entry = vy_mem_insert_template(mem, &stmts[4]); - is(mem->version, 8, "vy_mem->version") + is(mem->version, 8, "vy_mem->version"); vy_mem_commit_stmt(mem, entry); - is(mem->version, 9, "vy_mem->version") + is(mem->version, 9, "vy_mem->version"); /* Clean up */ vy_mem_delete(mem); diff --git a/test/unit/vy_point_lookup.c b/test/unit/vy_point_lookup.c index e646cb2730..59ceb6c569 100644 --- a/test/unit/vy_point_lookup.c +++ b/test/unit/vy_point_lookup.c @@ -96,19 +96,19 @@ test_basic() struct vy_lsm *pk = vy_lsm_new(&lsm_env, &cache_env, &mem_env, index_def, format, NULL, 0); - isnt(pk, NULL, "lsm is not NULL") + isnt(pk, NULL, "lsm is not NULL"); struct vy_range *range = vy_range_new(1, vy_entry_none(), vy_entry_none(), pk->cmp_def); - isnt(pk, NULL, "range is not NULL") + isnt(pk, NULL, "range is not NULL"); vy_lsm_add_range(pk, range); struct rlist read_views = RLIST_HEAD_INITIALIZER(read_views); char dir_tmpl[] = "./vy_point_test.XXXXXX"; char *dir_name = mkdtemp(dir_tmpl); - isnt(dir_name, NULL, "temp dir name is not NULL") + isnt(dir_name, NULL, "temp dir name is not NULL"); char path[PATH_MAX]; strcpy(path, dir_name); strcat(path, "/512"); diff --git a/test/unit/xmalloc.c b/test/unit/xmalloc.c index cee6416880..9c836de539 100644 --- a/test/unit/xmalloc.c +++ b/test/unit/xmalloc.c @@ -36,7 +36,7 @@ test_xcalloc(void) if (p[i] != 0) is_zeroed = false; } - ok(is_zeroed, "p is zeroed") + ok(is_zeroed, "p is zeroed"); free(p); } check_plan(); diff --git a/test/unit/xrow.cc b/test/unit/xrow.cc index 25ea54db63..f4bcf4e651 100644 --- a/test/unit/xrow.cc +++ b/test/unit/xrow.cc @@ -407,16 +407,16 @@ test_xrow_encode_dml(void) is(memcmp(data, r.key, strlen(r.key)), 0, "decoded key"); data += strlen(r.key); - is(mp_decode_uint(&data), IPROTO_OPS, "decoded ops key") + is(mp_decode_uint(&data), IPROTO_OPS, "decoded ops key"); is(memcmp(data, r.ops, strlen(r.ops)), 0, "decoded ops"); data += strlen(r.ops); - is(mp_decode_uint(&data), IPROTO_TUPLE_META, "decoded meta key") + is(mp_decode_uint(&data), IPROTO_TUPLE_META, "decoded meta key"); is(memcmp(data, r.tuple_meta, strlen(r.tuple_meta)), 0, "decoded meta"); data += strlen(r.tuple_meta); - is(mp_decode_uint(&data), IPROTO_TUPLE, "decoded tuple key") + is(mp_decode_uint(&data), IPROTO_TUPLE, "decoded tuple key"); is(memcmp(data, r.tuple, strlen(r.tuple)), 0, "decoded tuple"); data += strlen(r.tuple); -- GitLab