devzat icon indicating copy to clipboard operation
devzat copied to clipboard

Greedy mention

Open Arkaeriit opened this issue 3 years ago • 1 comments

The @<username> mentions are greedy so that if user1 and user11 are both connected, @user11 always mentions user11 and never user1.

This PR also introduces unit test that I wrote for the greedy mention feature but that could be used in other contexts.

As of writing this message, the PR is not ready to be merged yet. I am opening it now if you want to review the unit tests @quackduck.

Arkaeriit avatar Sep 01 '22 07:09 Arkaeriit

I think the PR is now ready to be merged.

Arkaeriit avatar Sep 01 '22 15:09 Arkaeriit

I'm unsure whether we need unit tests (testing is nice when functions are mostly pure). Greedy mentions sound great!

quackduck avatar Sep 23 '22 02:09 quackduck

Even if we know we won't have 100 % test coverage in Devzat, some unit tests can't hurt. The unit test for the coloring of mentions might help us catch bugs in the future caused by changes in the room or user struct. Furthermore, a framework to test Devzat without spinning up an instance can help a lot when we want to add in new features.

Arkaeriit avatar Sep 23 '22 07:09 Arkaeriit

I just added a bit of code to the mention function and the unit test saved me a lot of time. I am sure that some similar situation will come in the future.

Arkaeriit avatar Sep 23 '22 08:09 Arkaeriit

TBH the LOC the tests were adding was why I was a little hesitant. I think we can try out tests and they could be useful. Thanks!

quackduck avatar Sep 23 '22 15:09 quackduck

Looks great! Thanks

quackduck avatar Sep 26 '22 15:09 quackduck