Skip to content

Commit

Permalink
Add mention email test
Browse files Browse the repository at this point in the history
Would have caught the bug in dbd1b1a.
  • Loading branch information
kohler committed Oct 7, 2024
1 parent b8bc5a9 commit 52d19b6
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/t_mention.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

0 comments on commit 52d19b6

Please sign in to comment.