From 1bdf3f5da526d777993595157363813b0212c965 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/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/vclock.cc | 3 ++- test/unit/vy_mem.c | 4 ++-- test/unit/vy_point_lookup.c | 6 +++--- test/unit/xmalloc.c | 2 +- 11 files changed, 38 insertions(+), 36 deletions(-) diff --git a/test/unit/crypto.c b/test/unit/crypto.c index 6b34932328..c29eddf76b 100644 --- a/test/unit/crypto.c +++ b/test/unit/crypto.c @@ -103,7 +103,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 31ff241707..701e2043dc 100644 --- a/test/unit/prbuf.c +++ b/test/unit/prbuf.c @@ -281,7 +281,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(); } @@ -323,7 +323,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 1d2d2a183d..00e6ad0285 100644 --- a/test/unit/tuple_bigref.c +++ b/test/unit/tuple_bigref.c @@ -102,12 +102,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(); @@ -115,13 +115,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(); @@ -129,13 +129,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(); @@ -158,13 +158,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++) @@ -174,14 +174,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++) @@ -192,7 +192,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++) @@ -200,7 +200,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(); @@ -249,7 +249,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/vclock.cc b/test/unit/vclock.cc index 699a8d498f..9e51169ddb 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 a7682071bd..c62a7612f5 100644 --- a/test/unit/vy_mem.c +++ b/test/unit/vy_mem.c @@ -52,9 +52,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 289b8f0e1a..47d73b1c8b 100644 --- a/test/unit/vy_point_lookup.c +++ b/test/unit/vy_point_lookup.c @@ -97,19 +97,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 112e7356fa..36f768b834 100644 --- a/test/unit/xmalloc.c +++ b/test/unit/xmalloc.c @@ -35,7 +35,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(); -- GitLab