Library: Fixed formatstr handling
This commit is contained in:
parent
b74db1b791
commit
2c1f579b3b
|
@ -115,9 +115,9 @@ bool Library::load(const tinyxml2::XMLDocument &doc)
|
|||
else if (strcmp(argnode->Name(), "not-uninit") == 0)
|
||||
notuninit = true;
|
||||
else if (strcmp(argnode->Name(), "formatstr") == 0)
|
||||
notuninit = true;
|
||||
formatstr = true;
|
||||
else if (strcmp(argnode->Name(), "strz") == 0)
|
||||
notuninit = true;
|
||||
strz = true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ private:
|
|||
void run() {
|
||||
TEST_CASE(empty);
|
||||
TEST_CASE(function);
|
||||
TEST_CASE(function_arg);
|
||||
TEST_CASE(memory);
|
||||
}
|
||||
|
||||
|
@ -61,6 +62,35 @@ private:
|
|||
ASSERT(library.isnotnoreturn("foo"));
|
||||
}
|
||||
|
||||
void function_arg() {
|
||||
const char xmldata[] = "<?xml version=\"1.0\"?>\n"
|
||||
"<def>\n"
|
||||
" <function name=\"foo\">\n"
|
||||
" <arg nr=\"1\">\n"
|
||||
" <not-uninit/>\n"
|
||||
" </arg>\n"
|
||||
" <arg nr=\"2\">\n"
|
||||
" <not-null/>\n"
|
||||
" </arg>\n"
|
||||
" <arg nr=\"3\">\n"
|
||||
" <formatstr/>\n"
|
||||
" </arg>\n"
|
||||
" <arg nr=\"4\">\n"
|
||||
" <strz/>\n"
|
||||
" </arg>\n"
|
||||
" </function>\n"
|
||||
"</def>";
|
||||
tinyxml2::XMLDocument doc;
|
||||
doc.Parse(xmldata, sizeof(xmldata));
|
||||
|
||||
Library library;
|
||||
library.load(doc);
|
||||
ASSERT_EQUALS(true, library.argumentChecks["foo"][1].notuninit);
|
||||
ASSERT_EQUALS(true, library.argumentChecks["foo"][2].notnull);
|
||||
ASSERT_EQUALS(true, library.argumentChecks["foo"][3].formatstr);
|
||||
ASSERT_EQUALS(true, library.argumentChecks["foo"][4].strz);
|
||||
}
|
||||
|
||||
void memory() {
|
||||
const char xmldata[] = "<?xml version=\"1.0\"?>\n"
|
||||
"<def>\n"
|
||||
|
|
Loading…
Reference in New Issue