Fixed comma appended to username completion when not at the beginning of the message (#3060)
Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
#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");
|
||||
}
|
||||
Reference in New Issue
Block a user