Several fixes to cmd line tests.

There were several tests handling two parameters as one string.
Eg. "-I path" which doesn't work correctly. Fixed these
problematic tests.
This commit is contained in:
Kimmo Varis 2011-01-29 19:16:23 +02:00
parent d334a02801
commit b9a0e10b9a
1 changed files with 21 additions and 21 deletions

View File

@ -312,31 +312,31 @@ private:
void includes()
{
REDIRECT;
const char *argv[] = {"cppcheck", "-I include", "file.cpp"};
const char *argv[] = {"cppcheck", "-I", "include", "file.cpp"};
Settings settings;
CmdLineParser parser(&settings);
ASSERT(parser.ParseFromArgs(3, argv));
ASSERT_EQUALS(" include/", settings._includePaths.front());
ASSERT(parser.ParseFromArgs(4, argv));
ASSERT_EQUALS("include/", settings._includePaths.front());
}
void includesslash()
{
REDIRECT;
const char *argv[] = {"cppcheck", "-I include/", "file.cpp"};
const char *argv[] = {"cppcheck", "-I", "include/", "file.cpp"};
Settings settings;
CmdLineParser parser(&settings);
ASSERT(parser.ParseFromArgs(3, argv));
ASSERT_EQUALS(" include/", settings._includePaths.front());
ASSERT(parser.ParseFromArgs(4, argv));
ASSERT_EQUALS("include/", settings._includePaths.front());
}
void includesbackslash()
{
REDIRECT;
const char *argv[] = {"cppcheck", "-I include\\", "file.cpp"};
const char *argv[] = {"cppcheck", "-I", "include\\", "file.cpp"};
Settings settings;
CmdLineParser parser(&settings);
ASSERT(parser.ParseFromArgs(3, argv));
ASSERT_EQUALS(" include/", settings._includePaths.front());
ASSERT(parser.ParseFromArgs(4, argv));
ASSERT_EQUALS("include/", settings._includePaths.front());
}
void includesnospace()
@ -352,13 +352,13 @@ private:
void includes2()
{
REDIRECT;
const char *argv[] = {"cppcheck", "-I include/", "-I framework/", "file.cpp"};
const char *argv[] = {"cppcheck", "-I", "include/", "-I", "framework/", "file.cpp"};
Settings settings;
CmdLineParser parser(&settings);
ASSERT(parser.ParseFromArgs(4, argv));
ASSERT_EQUALS(" include/", settings._includePaths.front());
ASSERT(parser.ParseFromArgs(6, argv));
ASSERT_EQUALS("include/", settings._includePaths.front());
settings._includePaths.pop_front();
ASSERT_EQUALS(" framework/", settings._includePaths.front());
ASSERT_EQUALS("framework/", settings._includePaths.front());
}
void enabledAll()
@ -462,10 +462,10 @@ private:
void fileList()
{
REDIRECT;
const char *argv[] = {"cppcheck", "--file-list files.txt", "file.cpp"};
const char *argv[] = {"cppcheck", "--file-list", "files.txt", "file.cpp"};
Settings settings;
CmdLineParser parser(&settings);
ASSERT(!parser.ParseFromArgs(3, argv));
ASSERT(!parser.ParseFromArgs(4, argv));
}
void inlineSuppr()
@ -480,10 +480,10 @@ private:
void jobs()
{
REDIRECT;
const char *argv[] = {"cppcheck", "-j 3", "file.cpp"};
const char *argv[] = {"cppcheck", "-j", "3", "file.cpp"};
Settings settings;
CmdLineParser parser(&settings);
ASSERT(parser.ParseFromArgs(3, argv));
ASSERT(parser.ParseFromArgs(4, argv));
ASSERT_EQUALS(3, settings._jobs);
}
@ -499,10 +499,10 @@ private:
void jobsInvalid()
{
REDIRECT;
const char *argv[] = {"cppcheck", "-j e", "file.cpp"};
const char *argv[] = {"cppcheck", "-j", "e", "file.cpp"};
Settings settings;
CmdLineParser parser(&settings);
ASSERT(!parser.ParseFromArgs(3, argv));
ASSERT(!parser.ParseFromArgs(4, argv));
}
void reportProgress()
@ -519,10 +519,10 @@ private:
{
// TODO: Fails because there is no suppr.txt file!
REDIRECT;
const char *argv[] = {"cppcheck", "--suppressions suppr.txt", "file.cpp"};
const char *argv[] = {"cppcheck", "--suppressions", "suppr.txt", "file.cpp"};
Settings settings;
CmdLineParser parser(&settings);
ASSERT(!parser.ParseFromArgs(3, argv));
ASSERT(!parser.ParseFromArgs(4, argv));
}
void suppressions()