summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-11-23 21:50:51 +0100
committerLennart Poettering <lennart@poettering.net>2012-11-23 21:50:51 +0100
commitaaa870928ffe140783aff0724d4927cea8da56ae (patch)
treefe2f2222d80a2a3fc08976d8a09a3891f8079abc /src
parent3062c15117ab6eac5e8b3a3ceb5351ec22ea4481 (diff)
test: extend calendarspec test a bit
Diffstat (limited to 'src')
-rw-r--r--src/test/test-calendarspec.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/test/test-calendarspec.c b/src/test/test-calendarspec.c
index b0fec8b28a..21b0024388 100644
--- a/src/test/test-calendarspec.c
+++ b/src/test/test-calendarspec.c
@@ -26,7 +26,7 @@
static void test_one(const char *input, const char *output) {
CalendarSpec *c;
- char *p;
+ _cleanup_free_ char *p = NULL, *q = NULL;
usec_t u;
char buf[FORMAT_TIMESTAMP_MAX];
int r;
@@ -37,13 +37,17 @@ static void test_one(const char *input, const char *output) {
printf("\"%s\" → \"%s\"\n", input, p);
assert_se(streq(p, output));
- free(p);
u = now(CLOCK_REALTIME);
r = calendar_spec_next_usec(c, u, &u);
printf("Next: %s\n", r < 0 ? strerror(-r) : format_timestamp(buf, sizeof(buf), u));
+ calendar_spec_free(c);
+ assert_se(calendar_spec_from_string(p, &c) >= 0);
+ assert_se(calendar_spec_to_string(c, &q) >= 0);
calendar_spec_free(c);
+
+ assert_se(streq(q, p));
}
int main(int argc, char* argv[]) {