]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/test/test-xml.c
1 /* SPDX-License-Identifier: LGPL-2.1+ */
5 #include "alloc-util.h"
6 #include "string-util.h"
10 static void test_one(const char *data
, ...) {
17 _cleanup_free_
char *name
= NULL
;
21 t
= xml_tokenize(&data
, &name
, &state
, NULL
);
31 nn
= va_arg(ap
, const char *);
32 assert_se(streq_ptr(nn
, name
));
38 int main(int argc
, char *argv
[]) {
40 test_one("", XML_END
);
42 test_one("<foo></foo>",
47 test_one("<foo waldo=piep meh=\"huhu\"/>",
49 XML_ATTRIBUTE_NAME
, "waldo",
50 XML_ATTRIBUTE_VALUE
, "piep",
51 XML_ATTRIBUTE_NAME
, "meh",
52 XML_ATTRIBUTE_VALUE
, "huhu",
53 XML_TAG_CLOSE_EMPTY
, NULL
,
57 "<foo><?xml foo?> <!-- zzzz --> </foo>",