From 52d19b655f9cf94d64e6ed537538d5b74d938b5c Mon Sep 17 00:00:00 2001 From: Eddie Kohler Date: Mon, 7 Oct 2024 11:27:07 -0400 Subject: [PATCH] Add mention email test Would have caught the bug in dbd1b1a1109fc62786ca623457b0f4f609a7cbf8. --- test/t_mention.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/t_mention.php b/test/t_mention.php index ebfcfdb3a..d311e1a1d 100644 --- a/test/t_mention.php +++ b/test/t_mention.php @@ -140,4 +140,19 @@ function test_priorities() { xassert_eqq($mpxs[2]->pos1, 27); xassert_eqq($mpxs[2]->pos2, 42); } + + function test_name_email_prefix() { + $user_jon = $this->conf->pc_member_by_email("jon@cs.ucl.ac.uk"); + $mpxs = $this->parse_mentions("@Jon Crowcroft fun", [$user_jon], $this->pc); + xassert_eqq(count($mpxs), 1); + xassert_eqq($mpxs[0]->user->email, "jon@cs.ucl.ac.uk"); + xassert_eqq($mpxs[0]->pos1, 0); + xassert_eqq($mpxs[0]->pos2, 14); + + $mpxs = $this->parse_mentions("@pdruschel HELLO", [$user_jon], $this->pc); + xassert_eqq(count($mpxs), 1); + xassert_eqq($mpxs[0]->user->email, "pdruschel@cs.rice.edu"); + xassert_eqq($mpxs[0]->pos1, 0); + xassert_eqq($mpxs[0]->pos2, 10); + } }