]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/test/test-replace-var.c
1 /* SPDX-License-Identifier: LGPL-2.1+ */
6 #include "replace-var.h"
7 #include "string-util.h"
9 static char *lookup(const char *variable
, void *userdata
) {
10 return strjoin("<<<", variable
, ">>>");
13 int main(int argc
, char *argv
[]) {
16 assert_se(r
= replace_var("@@@foobar@xyz@HALLO@foobar@test@@testtest@TEST@...@@@", lookup
, NULL
));
18 assert_se(streq(r
, "@@@foobar@xyz<<<HALLO>>>foobar@test@@testtest<<<TEST>>>...@@@"));
21 assert_se(r
= strreplace("XYZFFFFXYZFFFFXYZ", "XYZ", "ABC"));
23 assert_se(streq(r
, "ABCFFFFABCFFFFABC"));