mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2026-01-28 18:54:27 +01:00
100% code coverage for Unity Fixture
Add tests for uncovered lines
This commit is contained in:
@@ -136,6 +136,22 @@ TEST(UnityFixture, FreeNULLSafety)
|
||||
free(NULL);
|
||||
}
|
||||
|
||||
TEST(UnityFixture, ConcludeTestIncrementsFailCount)
|
||||
{
|
||||
_U_UINT savedFails = Unity.TestFailures;
|
||||
_U_UINT savedIgnores = Unity.TestIgnores;
|
||||
UnityOutputCharSpy_Enable(1);
|
||||
Unity.CurrentTestFailed = 1;
|
||||
UnityConcludeFixtureTest(); // Resets TestFailed for this test to pass
|
||||
Unity.CurrentTestIgnored = 1;
|
||||
UnityConcludeFixtureTest(); // Resets TestIgnored
|
||||
UnityOutputCharSpy_Enable(0);
|
||||
TEST_ASSERT_EQUAL(savedFails + 1, Unity.TestFailures);
|
||||
TEST_ASSERT_EQUAL(savedIgnores + 1, Unity.TestIgnores);
|
||||
Unity.TestFailures = savedFails;
|
||||
Unity.TestIgnores = savedIgnores;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------
|
||||
|
||||
TEST_GROUP(UnityCommandOptions);
|
||||
@@ -276,6 +292,21 @@ TEST(UnityCommandOptions, UnknownCommandIsIgnored)
|
||||
TEST_ASSERT_EQUAL(98, UnityFixture.RepeatCount);
|
||||
}
|
||||
|
||||
TEST(UnityCommandOptions, GroupOrNameFilterWithoutStringFails)
|
||||
{
|
||||
TEST_ASSERT_EQUAL(1, UnityGetCommandLineOptions(3, unknownCommand));
|
||||
TEST_ASSERT_EQUAL(1, UnityGetCommandLineOptions(5, unknownCommand));
|
||||
TEST_ASSERT_EQUAL(1, UnityMain(3, unknownCommand, NULL));
|
||||
}
|
||||
|
||||
TEST(UnityCommandOptions, GroupFilterReallyFilters)
|
||||
{
|
||||
_U_UINT saved = Unity.NumberOfTests;
|
||||
TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(4, unknownCommand));
|
||||
UnityIgnoreTest(NULL, "non-matching", NULL);
|
||||
TEST_ASSERT_EQUAL(saved, Unity.NumberOfTests);
|
||||
}
|
||||
|
||||
IGNORE_TEST(UnityCommandOptions, TestShouldBeIgnored)
|
||||
{
|
||||
TEST_FAIL_MESSAGE("This test should not run!");
|
||||
|
||||
Reference in New Issue
Block a user