mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
23 lines
957 B
C++
23 lines
957 B
C++
|
#include "util/Helpers.hpp"
|
||
|
|
||
|
#include <gtest/gtest.h>
|
||
|
|
||
|
using namespace chatterino;
|
||
|
|
||
|
TEST(Helpers, formatUserMention)
|
||
|
{
|
||
|
const auto userName = "pajlada";
|
||
|
|
||
|
// A user mention that is the first word, that has 'mention with comma' enabled should have a comma appended at the end.
|
||
|
EXPECT_EQ(formatUserMention(userName, true, true), "pajlada,");
|
||
|
|
||
|
// A user mention that is not the first word, but has 'mention with comma' enabled should not have a comma appended at the end.
|
||
|
EXPECT_EQ(formatUserMention(userName, false, true), "pajlada");
|
||
|
|
||
|
// A user mention that is the first word, but has 'mention with comma' disabled should not have a comma appended at the end.
|
||
|
EXPECT_EQ(formatUserMention(userName, true, false), "pajlada");
|
||
|
|
||
|
// A user mention that is neither the first word, nor has 'mention with comma' enabled should not have a comma appended at the end.
|
||
|
EXPECT_EQ(formatUserMention(userName, false, false), "pajlada");
|
||
|
}
|