test-xml.c revision bcf3295d2b0d87caefad2e73d221aac080d0c11e
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2013 Lennart Poettering
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <stdarg.h>
#include "xml.h"
#include "util.h"
for (;;) {
int t, tt;
const char *nn;
assert_se(t >= 0);
if (t == XML_END)
break;
}
}
test_one("<foo></foo>",
XML_TAG_OPEN, "foo",
XML_TAG_CLOSE, "foo",
XML_END);
test_one("<foo waldo=piep meh=\"huhu\"/>",
XML_TAG_OPEN, "foo",
XML_ATTRIBUTE_NAME, "waldo",
XML_ATTRIBUTE_VALUE, "piep",
XML_ATTRIBUTE_NAME, "meh",
XML_ATTRIBUTE_VALUE, "huhu",
XML_END);
test_one("xxxx\n"
"<foo><?xml foo?> <!-- zzzz --> </foo>",
XML_TEXT, "xxxx\n",
XML_TAG_OPEN, "foo",
XML_TEXT, " ",
XML_TEXT, " ",
XML_TAG_CLOSE, "foo",
XML_END);
return 0;
}