summaryrefslogtreecommitdiff
path: root/internal/util/statustools_test.go
diff options
context:
space:
mode:
authorLibravatar Tobi Smethurst <31960611+tsmethurst@users.noreply.github.com>2021-07-29 13:18:22 +0200
committerLibravatar GitHub <noreply@github.com>2021-07-29 13:18:22 +0200
commita940a520d301d00f42012743b3999a73f7180848 (patch)
tree50bdd749381d6f773df46dbc4cc33a9b533a4e7b /internal/util/statustools_test.go
parentLink parsing (#120) (diff)
downloadgotosocial-a940a520d301d00f42012743b3999a73f7180848.tar.xz
Link hashtag bug (#121)
* link + hashtag bug * remove printlns * tidy up some duplicated code
Diffstat (limited to 'internal/util/statustools_test.go')
-rw-r--r--internal/util/statustools_test.go15
1 files changed, 11 insertions, 4 deletions
diff --git a/internal/util/statustools_test.go b/internal/util/statustools_test.go
index 2a12c7690..5bdce2d5a 100644
--- a/internal/util/statustools_test.go
+++ b/internal/util/statustools_test.go
@@ -37,17 +37,22 @@ func (suite *StatusTestSuite) TestDeriveMentionsOK() {
@someone_else@testing.best-horse.com can you confirm? @hello@test.lgbt
- @thisisalocaluser ! @NORWILL@THIS.one!!
+ @thisisalocaluser!
+
+ here is a duplicate mention: @hello@test.lgbt @hello@test.lgbt
+
+ @account1@whatever.com @account2@whatever.com
- here is a duplicate mention: @hello@test.lgbt
`
menchies := util.DeriveMentionsFromStatus(statusText)
- assert.Len(suite.T(), menchies, 4)
+ assert.Len(suite.T(), menchies, 6)
assert.Equal(suite.T(), "@dumpsterqueer@example.org", menchies[0])
assert.Equal(suite.T(), "@someone_else@testing.best-horse.com", menchies[1])
assert.Equal(suite.T(), "@hello@test.lgbt", menchies[2])
assert.Equal(suite.T(), "@thisisalocaluser", menchies[3])
+ assert.Equal(suite.T(), "@account1@whatever.com", menchies[4])
+ assert.Equal(suite.T(), "@account2@whatever.com", menchies[5])
}
func (suite *StatusTestSuite) TestDeriveMentionsEmpty() {
@@ -57,12 +62,14 @@ func (suite *StatusTestSuite) TestDeriveMentionsEmpty() {
}
func (suite *StatusTestSuite) TestDeriveHashtagsOK() {
- statusText := `#testing123 #also testing
+ statusText := `weeeeeeee #testing123 #also testing
# testing this one shouldn't work
#thisshouldwork
+ here's a link with a fragment: https://example.org/whatever#ahhh
+
#ThisShouldAlsoWork #not_this_though
#111111 thisalsoshouldn'twork#### ##`