mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2026-01-27 18:24:27 +01:00
Added stricter error checks by the compiler, and adapted all impacted code.
Primarily - * Added "static" to static functions. * Added proper signature with "void" to functions without arguments. * Marked unused arguments with "(void)". * Removed entirely unused static functions. * Added "const" to preserve const-correctness. * Added function prototypes for external functions.
This commit is contained in:
@@ -7,14 +7,14 @@
|
||||
|
||||
#include "unity_fixture.h"
|
||||
|
||||
static void runAllTests()
|
||||
static void runAllTests(void)
|
||||
{
|
||||
RUN_TEST_GROUP(UnityFixture);
|
||||
RUN_TEST_GROUP(UnityCommandOptions);
|
||||
RUN_TEST_GROUP(LeakDetection)
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, const char* argv[])
|
||||
{
|
||||
return UnityMain(argc, argv, runAllTests);
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ TEST_TEAR_DOWN(UnityCommandOptions)
|
||||
}
|
||||
|
||||
|
||||
static char* noOptions[] = {
|
||||
static const char* noOptions[] = {
|
||||
"testrunner.exe"
|
||||
};
|
||||
|
||||
@@ -171,7 +171,7 @@ TEST(UnityCommandOptions, DefaultOptions)
|
||||
TEST_ASSERT_EQUAL(1, UnityFixture.RepeatCount);
|
||||
}
|
||||
|
||||
static char* verbose[] = {
|
||||
static const char* verbose[] = {
|
||||
"testrunner.exe",
|
||||
"-v"
|
||||
};
|
||||
@@ -182,7 +182,7 @@ TEST(UnityCommandOptions, OptionVerbose)
|
||||
TEST_ASSERT_EQUAL(1, UnityFixture.Verbose);
|
||||
}
|
||||
|
||||
static char* group[] = {
|
||||
static const char* group[] = {
|
||||
"testrunner.exe",
|
||||
"-g", "groupname"
|
||||
};
|
||||
@@ -193,7 +193,7 @@ TEST(UnityCommandOptions, OptionSelectTestByGroup)
|
||||
STRCMP_EQUAL("groupname", UnityFixture.GroupFilter);
|
||||
}
|
||||
|
||||
static char* name[] = {
|
||||
static const char* name[] = {
|
||||
"testrunner.exe",
|
||||
"-n", "testname"
|
||||
};
|
||||
@@ -204,7 +204,7 @@ TEST(UnityCommandOptions, OptionSelectTestByName)
|
||||
STRCMP_EQUAL("testname", UnityFixture.NameFilter);
|
||||
}
|
||||
|
||||
static char* repeat[] = {
|
||||
static const char* repeat[] = {
|
||||
"testrunner.exe",
|
||||
"-r", "99"
|
||||
};
|
||||
@@ -221,7 +221,7 @@ TEST(UnityCommandOptions, OptionSelectRepeatTestsSpecificCount)
|
||||
TEST_ASSERT_EQUAL(99, UnityFixture.RepeatCount);
|
||||
}
|
||||
|
||||
static char* multiple[] = {
|
||||
static const char* multiple[] = {
|
||||
"testrunner.exe",
|
||||
"-v",
|
||||
"-g", "groupname",
|
||||
@@ -238,7 +238,7 @@ TEST(UnityCommandOptions, MultipleOptions)
|
||||
TEST_ASSERT_EQUAL(98, UnityFixture.RepeatCount);
|
||||
}
|
||||
|
||||
static char* dashRNotLast[] = {
|
||||
static const char* dashRNotLast[] = {
|
||||
"testrunner.exe",
|
||||
"-v",
|
||||
"-g", "gggg",
|
||||
@@ -255,7 +255,7 @@ TEST(UnityCommandOptions, MultipleOptionsDashRNotLastAndNoValueSpecified)
|
||||
TEST_ASSERT_EQUAL(2, UnityFixture.RepeatCount);
|
||||
}
|
||||
|
||||
static char* unknownCommand[] = {
|
||||
static const char* unknownCommand[] = {
|
||||
"testrunner.exe",
|
||||
"-v",
|
||||
"-g", "groupname",
|
||||
|
||||
@@ -25,7 +25,7 @@ void UnityOutputCharSpy_Create(int s)
|
||||
memset(buffer, 0, size);
|
||||
}
|
||||
|
||||
void UnityOutputCharSpy_Destroy()
|
||||
void UnityOutputCharSpy_Destroy(void)
|
||||
{
|
||||
size = 0;
|
||||
free(buffer);
|
||||
@@ -45,7 +45,7 @@ int UnityOutputCharSpy_OutputChar(int c)
|
||||
return c;
|
||||
}
|
||||
|
||||
const char * UnityOutputCharSpy_Get()
|
||||
const char * UnityOutputCharSpy_Get(void)
|
||||
{
|
||||
return buffer;
|
||||
}
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
#define D_unity_output_Spy_H
|
||||
|
||||
void UnityOutputCharSpy_Create(int s);
|
||||
void UnityOutputCharSpy_Destroy();
|
||||
void UnityOutputCharSpy_Destroy(void);
|
||||
int UnityOutputCharSpy_OutputChar(int c);
|
||||
const char * UnityOutputCharSpy_Get();
|
||||
const char * UnityOutputCharSpy_Get(void);
|
||||
void UnityOutputCharSpy_Enable(int enable);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user