summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2014-03-11 10:41:22 -0400
committerDave Reisner <dreisner@archlinux.org>2014-08-13 20:41:41 -0400
commit8085f163c50d998f3e30a6ddfc72c73d5dc57747 (patch)
tree36184a2129cd3ee2743b1815242ed7ab5c2ee0f7 /src/test
parentd06441da04cd5102816858d8d1e4aa367c00156b (diff)
util: allow strappenda to take any number of args
This makes strappenda3 redundant, so we remove its usage and definition. Add a few tests along the way for sanity.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test-util.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/test/test-util.c b/src/test/test-util.c
index 16f89b4716..69e3f5d3ae 100644
--- a/src/test/test-util.c
+++ b/src/test/test-util.c
@@ -907,6 +907,19 @@ static void test_strshorten(void) {
assert_se(strlen(strshorten(s, 0)) == 0);
}
+static void test_strappenda(void) {
+ char *actual;
+
+ actual = strappenda("", "foo", "bar");
+ assert_se(streq(actual, "foobar"));
+
+ actual = strappenda("foo", "bar", "baz");
+ assert_se(streq(actual, "foobarbaz"));
+
+ actual = strappenda("foo", "", "bar", "baz");
+ assert_se(streq(actual, "foobarbaz"));
+}
+
int main(int argc, char *argv[]) {
log_parse_environment();
log_open();
@@ -965,6 +978,7 @@ int main(int argc, char *argv[]) {
test_read_one_char();
test_ignore_signals();
test_strshorten();
+ test_strappenda();
return 0;
}