]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/test/test-xml.c
1 /* SPDX-License-Identifier: LGPL-2.1+ */
3 This file is part of systemd.
5 Copyright 2013 Lennart Poettering
10 #include "alloc-util.h"
11 #include "string-util.h"
15 static void test_one(const char *data
, ...) {
22 _cleanup_free_
char *name
= NULL
;
26 t
= xml_tokenize(&data
, &name
, &state
, NULL
);
36 nn
= va_arg(ap
, const char *);
37 assert_se(streq_ptr(nn
, name
));
43 int main(int argc
, char *argv
[]) {
45 test_one("", XML_END
);
47 test_one("<foo></foo>",
52 test_one("<foo waldo=piep meh=\"huhu\"/>",
54 XML_ATTRIBUTE_NAME
, "waldo",
55 XML_ATTRIBUTE_VALUE
, "piep",
56 XML_ATTRIBUTE_NAME
, "meh",
57 XML_ATTRIBUTE_VALUE
, "huhu",
58 XML_TAG_CLOSE_EMPTY
, NULL
,
62 "<foo><?xml foo?> <!-- zzzz --> </foo>",