log_test_helpers: remove semicolons from end of macros

We want our code to require semicolons after use of these macros,
so that our code formatters and/or analysis tools don't get
confused.
This commit is contained in:
Nick Mathewson 2020-01-10 10:54:35 -05:00
parent 60f01da78e
commit efa5020a9c
2 changed files with 15 additions and 15 deletions

View File

@ -78,7 +78,7 @@ void mock_dump_saved_logs(void);
mock_saved_log_n_entries() == 1, \ mock_saved_log_n_entries() == 1, \
("expected log to contain exactly 1 message \"%s\"", \ ("expected log to contain exactly 1 message \"%s\"", \
str)); \ str)); \
} while (0); } while (0)
#define expect_single_log_msg_containing(str) \ #define expect_single_log_msg_containing(str) \
do { \ do { \
@ -86,30 +86,30 @@ void mock_dump_saved_logs(void);
mock_saved_log_n_entries() == 1 , \ mock_saved_log_n_entries() == 1 , \
("expected log to contain 1 message, containing \"%s\"",\ ("expected log to contain 1 message, containing \"%s\"",\
str)); \ str)); \
} while (0); } while (0)
#define expect_no_log_msg(str) \ #define expect_no_log_msg(str) \
assert_log_predicate(!mock_saved_log_has_message(str), \ assert_log_predicate(!mock_saved_log_has_message(str), \
("expected log to not contain \"%s\"",str)); ("expected log to not contain \"%s\"",str))
#define expect_no_log_msg_containing(str) \ #define expect_no_log_msg_containing(str) \
assert_log_predicate(!mock_saved_log_has_message_containing(str), \ assert_log_predicate(!mock_saved_log_has_message_containing(str), \
("expected log to not contain \"%s\"", str)); ("expected log to not contain \"%s\"", str))
#define expect_log_severity(severity) \ #define expect_log_severity(severity) \
assert_log_predicate(mock_saved_log_has_severity(severity), \ assert_log_predicate(mock_saved_log_has_severity(severity), \
("expected log to contain severity " # severity)); ("expected log to contain severity " # severity))
#define expect_no_log_severity(severity) \ #define expect_no_log_severity(severity) \
assert_log_predicate(!mock_saved_log_has_severity(severity), \ assert_log_predicate(!mock_saved_log_has_severity(severity), \
("expected log to not contain severity " # severity)); ("expected log to not contain severity " # severity))
#define expect_log_entry() \ #define expect_log_entry() \
assert_log_predicate(mock_saved_log_has_entry(), \ assert_log_predicate(mock_saved_log_has_entry(), \
("expected log to contain entries")); ("expected log to contain entries"))
#define expect_no_log_entry() \ #define expect_no_log_entry() \
assert_log_predicate(!mock_saved_log_has_entry(), \ assert_log_predicate(!mock_saved_log_has_entry(), \
("expected log to not contain entries")); ("expected log to not contain entries"))
#endif /* !defined(TOR_LOG_TEST_HELPERS_H) */ #endif /* !defined(TOR_LOG_TEST_HELPERS_H) */

View File

@ -1030,7 +1030,7 @@ test_consdiff_apply_diff(void *arg)
/* diff doesn't have enough lines. */ /* diff doesn't have enough lines. */
cons2 = consdiff_apply_diff(cons1, diff, &digests1); cons2 = consdiff_apply_diff(cons1, diff, &digests1);
tt_ptr_op(NULL, OP_EQ, cons2); tt_ptr_op(NULL, OP_EQ, cons2);
expect_single_log_msg_containing("too short") expect_single_log_msg_containing("too short");
/* first line doesn't match format-version string. */ /* first line doesn't match format-version string. */
smartlist_add_linecpy(diff, area, "foo-bar"); smartlist_add_linecpy(diff, area, "foo-bar");
@ -1038,7 +1038,7 @@ test_consdiff_apply_diff(void *arg)
mock_clean_saved_logs(); mock_clean_saved_logs();
cons2 = consdiff_apply_diff(cons1, diff, &digests1); cons2 = consdiff_apply_diff(cons1, diff, &digests1);
tt_ptr_op(NULL, OP_EQ, cons2); tt_ptr_op(NULL, OP_EQ, cons2);
expect_single_log_msg_containing("format is not known") expect_single_log_msg_containing("format is not known");
/* The first word of the second header line is not "hash". */ /* The first word of the second header line is not "hash". */
smartlist_clear(diff); smartlist_clear(diff);
@ -1048,7 +1048,7 @@ test_consdiff_apply_diff(void *arg)
mock_clean_saved_logs(); mock_clean_saved_logs();
cons2 = consdiff_apply_diff(cons1, diff, &digests1); cons2 = consdiff_apply_diff(cons1, diff, &digests1);
tt_ptr_op(NULL, OP_EQ, cons2); tt_ptr_op(NULL, OP_EQ, cons2);
expect_single_log_msg_containing("does not include the necessary digests") expect_single_log_msg_containing("does not include the necessary digests");
/* Wrong number of words after "hash". */ /* Wrong number of words after "hash". */
smartlist_clear(diff); smartlist_clear(diff);
@ -1057,7 +1057,7 @@ test_consdiff_apply_diff(void *arg)
mock_clean_saved_logs(); mock_clean_saved_logs();
cons2 = consdiff_apply_diff(cons1, diff, &digests1); cons2 = consdiff_apply_diff(cons1, diff, &digests1);
tt_ptr_op(NULL, OP_EQ, cons2); tt_ptr_op(NULL, OP_EQ, cons2);
expect_single_log_msg_containing("does not include the necessary digests") expect_single_log_msg_containing("does not include the necessary digests");
/* base16 digests do not have the expected length. */ /* base16 digests do not have the expected length. */
smartlist_clear(diff); smartlist_clear(diff);
@ -1067,7 +1067,7 @@ test_consdiff_apply_diff(void *arg)
cons2 = consdiff_apply_diff(cons1, diff, &digests1); cons2 = consdiff_apply_diff(cons1, diff, &digests1);
tt_ptr_op(NULL, OP_EQ, cons2); tt_ptr_op(NULL, OP_EQ, cons2);
expect_single_log_msg_containing("includes base16-encoded digests of " expect_single_log_msg_containing("includes base16-encoded digests of "
"incorrect size") "incorrect size");
/* base16 digests contain non-base16 characters. */ /* base16 digests contain non-base16 characters. */
smartlist_clear(diff); smartlist_clear(diff);
@ -1078,7 +1078,7 @@ test_consdiff_apply_diff(void *arg)
mock_clean_saved_logs(); mock_clean_saved_logs();
cons2 = consdiff_apply_diff(cons1, diff, &digests1); cons2 = consdiff_apply_diff(cons1, diff, &digests1);
tt_ptr_op(NULL, OP_EQ, cons2); tt_ptr_op(NULL, OP_EQ, cons2);
expect_single_log_msg_containing("includes malformed digests") expect_single_log_msg_containing("includes malformed digests");
/* Invalid ed diff. /* Invalid ed diff.
* As tested in apply_ed_diff, but check that apply_diff does return NULL if * As tested in apply_ed_diff, but check that apply_diff does return NULL if
@ -1095,7 +1095,7 @@ test_consdiff_apply_diff(void *arg)
cons2 = consdiff_apply_diff(cons1, diff, &digests1); cons2 = consdiff_apply_diff(cons1, diff, &digests1);
tt_ptr_op(NULL, OP_EQ, cons2); tt_ptr_op(NULL, OP_EQ, cons2);
expect_single_log_msg_containing("because an ed command was missing a line " expect_single_log_msg_containing("because an ed command was missing a line "
"number") "number");
/* Base consensus doesn't match its digest as found in the diff. */ /* Base consensus doesn't match its digest as found in the diff. */
smartlist_clear(diff); smartlist_clear(diff);