From 4871b6975926b7b4d28de8ef43b6ade5b093ab87 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 --- test/unit/bps_tree_view.c | 12 ++++++------ test/unit/crypto.c | 2 +- test/unit/event.c | 10 +++++----- test/unit/json.c | 15 ++++++++------- test/unit/lua_func_adapter.c | 8 ++++---- test/unit/lua_utils.c | 2 +- test/unit/prbuf.c | 2 +- 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 | 8 ++++---- 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 +++--- 17 files changed, 60 insertions(+), 58 deletions(-) diff --git a/test/unit/bps_tree_view.c b/test/unit/bps_tree_view.c index fd731f2e85..a095e9b1c2 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/event.c b/test/unit/event.c index d5aba3e6a6..3f956853ea 100644 --- a/test/unit/event.c +++ b/test/unit/event.c @@ -63,9 +63,9 @@ test_basic(void) old = event_find_trigger(event, trg_name); is(old, &func, "New trigger must be found"); ok(event_has_triggers(event), "Event must not be empty"); - is(func_destroy_count, 0, "Func must not be destroyed yet") + is(func_destroy_count, 0, "Func must not be destroyed yet"); event_reset_trigger(event, trg_name, NULL); - is(func_destroy_count, 1, "Func must be destroyed") + is(func_destroy_count, 1, "Func must be destroyed"); old = event_find_trigger(event, trg_name); is(old, NULL, "Deleted trigger must not be found"); ok(!event_has_triggers(event), "Event must be empty"); @@ -248,7 +248,7 @@ test_event_iterator_stability_del_step(int breakpoint, const char *del_mask, const char *name = NULL; for (int i = 0; i <= breakpoint; i++) { bool ok = event_trigger_iterator_next(&it, &trg, &name); - ok(ok, "Iterator must not be exhausted yet") + ok(ok, "Iterator must not be exhausted yet"); const char *trg_name = tt_sprintf("%d", i); is(strcmp(name, trg_name), 0, "Triggers must be traversed in reversed order"); @@ -314,7 +314,7 @@ test_event_iterator_stability_replace_step(int breakpoint, const char *name = NULL; for (int i = 0; i <= breakpoint; i++) { bool ok = event_trigger_iterator_next(&it, &trg, &name); - ok(ok, "Iterator must not be exhausted yet") + ok(ok, "Iterator must not be exhausted yet"); const char *trg_name = tt_sprintf("%d", i); is(strcmp(name, trg_name), 0, "Triggers must be traversed in reversed order"); @@ -328,7 +328,7 @@ test_event_iterator_stability_replace_step(int breakpoint, ok(event_has_triggers(event), "Event must not be empty"); for (int i = breakpoint + 1; i < trigger_num; ++i) { bool ok = event_trigger_iterator_next(&it, &trg, &name); - ok(ok, "Traversal must continue") + ok(ok, "Traversal must continue"); const char *trg_name = tt_sprintf("%d", i); is(strcmp(name, trg_name), 0, "Triggers must be traversed in reversed order"); 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/lua_func_adapter.c b/test/unit/lua_func_adapter.c index 8089c5d3fa..6f30f8f4bd 100644 --- a/test/unit/lua_func_adapter.c +++ b/test/unit/lua_func_adapter.c @@ -104,7 +104,7 @@ test_tuple(void) func_adapter_pop_tuple(func, &ctx, tuples + i); isnt(tuples[i], NULL, "Returned tuple must not be NULL"); } - ok(func_adapter_is_null(func, &ctx), "Expected null - no values left") + ok(func_adapter_is_null(func, &ctx), "Expected null - no values left"); func_adapter_end(func, &ctx); func_adapter_destroy(func); lua_settop(tarantool_L, 0); @@ -158,7 +158,7 @@ test_string(void) strncpy(buf, s1, s1_len); strcpy(buf + s1_len, s2); is(strcmp(retval, buf), 0, "Expected %s", buf); - ok(func_adapter_is_null(func, &ctx), "Expected null - no values left") + ok(func_adapter_is_null(func, &ctx), "Expected null - no values left"); func_adapter_end(func, &ctx); func_adapter_destroy(func); lua_settop(tarantool_L, 0); @@ -185,13 +185,13 @@ test_null(void) int rc = func_adapter_call(func, &ctx); fail_if(rc != 0); for (size_t i = 0; i < null_count; ++i) { - ok(func_adapter_is_null(func, &ctx), "Expected null") + ok(func_adapter_is_null(func, &ctx), "Expected null"); func_adapter_pop_null(func, &ctx); } ok(func_adapter_is_double(func, &ctx), "Expected double"); double double_retval = 0; func_adapter_pop_double(func, &ctx, &double_retval); - ok(func_adapter_is_null(func, &ctx), "Expected null - no values left") + ok(func_adapter_is_null(func, &ctx), "Expected null - no values left"); func_adapter_end(func, &ctx); func_adapter_destroy(func); lua_settop(tarantool_L, 0); diff --git a/test/unit/lua_utils.c b/test/unit/lua_utils.c index fb5b41b3ae..514a0b3336 100644 --- a/test/unit/lua_utils.c +++ b/test/unit/lua_utils.c @@ -131,7 +131,7 @@ test_tolstring_strict(lua_State *L) lua_pop(L, 1); lua_pushnumber(L, 42); - is(luaL_tolstring_strict(L, -1, &len), NULL, "number") + is(luaL_tolstring_strict(L, -1, &len), NULL, "number"); lua_pop(L, 1); footer(); diff --git a/test/unit/prbuf.c b/test/unit/prbuf.c index 1b648f14c6..34088e72b0 100644 --- a/test/unit/prbuf.c +++ b/test/unit/prbuf.c @@ -468,7 +468,7 @@ test_buffer_prepared_large(void) fill_buffer(&buf, payload_small, payload_size, entry_count); int entry_count_after = count_records(mem, buffer_size); ok(entry_count_after == entry_count, "entry count after is %d", - entry_count_after) + entry_count_after); footer(); check_plan(); 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 6466eb54cd..46c7a5d36a 100644 --- a/test/unit/tweaks.c +++ b/test/unit/tweaks.c @@ -139,7 +139,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"); @@ -178,7 +178,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"); @@ -217,14 +217,14 @@ test_double_var(void) v.type = TWEAK_VALUE_INT; v.ival = 11; is(tweak_set(t, &v), 0, "set tweak value to int"); - is(double_var, 11, "var value after set to int") + is(double_var, 11, "var value after set to int"); tweak_get(t, &v); is(v.type, TWEAK_VALUE_DOUBLE, "tweak value type after set to int"); is(v.dval, 11, "tweak value after set to int"); v.type = TWEAK_VALUE_DOUBLE; v.dval = 0.5; is(tweak_set(t, &v), 0, "set tweak value to double"); - is(double_var, 0.5, "var value after set to double") + is(double_var, 0.5, "var value after set to double"); tweak_get(t, &v); is(v.type, TWEAK_VALUE_DOUBLE, "tweak value type after set to double"); is(v.dval, 0.5, "tweak value after set to double"); 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