1480: Use `EXPECT_*` rather than `ASSERT_*` in tests r=def- a=heinrich5991

`EXPECT_*` allows the test to continue even in the case of failure. Use
this where it makes sense to continue.

Co-authored-by: heinrich5991 <heinrich5991@gmail.com>
This commit is contained in:
bors[bot] 2019-03-12 06:16:24 +00:00
commit a490ed0b2f
2 changed files with 14 additions and 14 deletions

View file

@ -7,6 +7,6 @@ TEST(GitRevision, ExistsOrNull)
{ {
if(GIT_SHORTREV_HASH) if(GIT_SHORTREV_HASH)
{ {
ASSERT_STRNE(GIT_SHORTREV_HASH, ""); EXPECT_STRNE(GIT_SHORTREV_HASH, "");
} }
} }

View file

@ -4,26 +4,26 @@
TEST(NameBan, Empty) TEST(NameBan, Empty)
{ {
ASSERT_FALSE(IsNameBanned("", 0, 0)); EXPECT_FALSE(IsNameBanned("", 0, 0));
ASSERT_FALSE(IsNameBanned("abc", 0, 0)); EXPECT_FALSE(IsNameBanned("abc", 0, 0));
} }
TEST(NameBan, Equality) TEST(NameBan, Equality)
{ {
CNameBan Abc0("abc", 0, 0); CNameBan Abc0("abc", 0, 0);
ASSERT_TRUE(IsNameBanned("abc", &Abc0, 1)); EXPECT_TRUE(IsNameBanned("abc", &Abc0, 1));
ASSERT_TRUE(IsNameBanned(" abc", &Abc0, 1)); EXPECT_TRUE(IsNameBanned(" abc", &Abc0, 1));
ASSERT_TRUE(IsNameBanned("abc ", &Abc0, 1)); EXPECT_TRUE(IsNameBanned("abc ", &Abc0, 1));
ASSERT_TRUE(IsNameBanned("abc foo", &Abc0, 1)); // Maximum name length. EXPECT_TRUE(IsNameBanned("abc foo", &Abc0, 1)); // Maximum name length.
ASSERT_TRUE(IsNameBanned("äbc", &Abc0, 1)); // Confusables EXPECT_TRUE(IsNameBanned("äbc", &Abc0, 1)); // Confusables
ASSERT_FALSE(IsNameBanned("def", &Abc0, 1)); EXPECT_FALSE(IsNameBanned("def", &Abc0, 1));
ASSERT_FALSE(IsNameBanned("abcdef", &Abc0, 1)); EXPECT_FALSE(IsNameBanned("abcdef", &Abc0, 1));
} }
TEST(NameBan, Substring) TEST(NameBan, Substring)
{ {
CNameBan Xyz("xyz", 0, 1); CNameBan Xyz("xyz", 0, 1);
ASSERT_TRUE(IsNameBanned("abcxyz", &Xyz, 1)); EXPECT_TRUE(IsNameBanned("abcxyz", &Xyz, 1));
ASSERT_TRUE(IsNameBanned("abcxyzdef", &Xyz, 1)); EXPECT_TRUE(IsNameBanned("abcxyzdef", &Xyz, 1));
ASSERT_FALSE(IsNameBanned("abcdef", &Xyz, 1)); EXPECT_FALSE(IsNameBanned("abcdef", &Xyz, 1));
} }