summaryrefslogtreecommitdiff
path: root/src/test/test-unit-name.c
diff options
context:
space:
mode:
authorThomas Hindoe Paaboel Andersen <phomes@gmail.com>2014-10-04 23:51:45 +0200
committerThomas Hindoe Paaboel Andersen <phomes@gmail.com>2014-10-04 23:55:35 +0200
commitbdf7026e9557349cd3eeb291c01655d5f2a55db8 (patch)
tree10d269fed663e99d659c34e2f8e89fe5b3f55ecd /src/test/test-unit-name.c
parent2355af60dc0c0ec2b7fbe69f15a77d980b017b3f (diff)
test: only use assert_se
The asserts used in the tests should never be allowed to be optimized away
Diffstat (limited to 'src/test/test-unit-name.c')
-rw-r--r--src/test/test-unit-name.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/test/test-unit-name.c b/src/test/test-unit-name.c
index b733173742..256e820c22 100644
--- a/src/test/test-unit-name.c
+++ b/src/test/test-unit-name.c
@@ -43,7 +43,7 @@ static void test_replacements(void) {
_cleanup_free_ char *t = \
unit_name_replace_instance(pattern, repl); \
puts(t); \
- assert(streq(t, expected)); \
+ assert_se(streq(t, expected)); \
}
expect("foo@.service", "waldo", "foo@waldo.service");
@@ -64,7 +64,7 @@ static void test_replacements(void) {
puts(t); \
k = unit_name_to_path(t); \
puts(k); \
- assert(streq(k, expected ? expected : path)); \
+ assert_se(streq(k, expected ? expected : path)); \
}
expect("/waldo", ".mount", NULL);
@@ -80,7 +80,7 @@ static void test_replacements(void) {
_cleanup_free_ char *t = \
unit_name_from_path_instance(pattern, path, suffix); \
puts(t); \
- assert(streq(t, expected)); \
+ assert_se(streq(t, expected)); \
}
expect("waldo", "/waldo", ".mount", "waldo@waldo.mount");
@@ -130,7 +130,7 @@ static int test_unit_printf(void) {
puts("manager_new: Permission denied. Skipping test.");
return EXIT_TEST_SKIP;
}
- assert(r == 0);
+ assert_se(r == 0);
#define expect(unit, pattern, expected) \
{ \
@@ -139,9 +139,9 @@ static int test_unit_printf(void) {
assert_se(unit_full_printf(unit, pattern, &t) >= 0); \
printf("result: %s\nexpect: %s\n", t, expected); \
if ((e = endswith(expected, "*"))) \
- assert(strncmp(t, e, e-expected)); \
+ assert_se(strncmp(t, e, e-expected)); \
else \
- assert(streq(t, expected)); \
+ assert_se(streq(t, expected)); \
}
assert_se(setenv("USER", "root", 1) == 0);