forked from matrix-org/matrix-ios-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update regex for email address (matrix-org#1826)
* Update regex for email address * Add changelog Signed-off-by: yostyle <[email protected]> * Add unit test * rename changelog --------- Signed-off-by: yostyle <[email protected]>
- Loading branch information
Showing
3 changed files
with
54 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,6 +68,58 @@ - (void)testMatrixIdentifiers | |
XCTAssertTrue([MXTools isMatrixGroupIdentifier:@"+matrix:matrix.org"]); | ||
} | ||
|
||
- (void)testEmailAddresses | ||
{ | ||
XCTAssertTrue([MXTools isEmailAddress:@"[email protected]"]); | ||
XCTAssertTrue([MXTools isEmailAddress:@"alice@matrix"]); | ||
XCTAssertTrue([MXTools isEmailAddress:@"al-i_ce@matrix"]); | ||
XCTAssertTrue([MXTools isEmailAddress:@"[email protected]"]); | ||
XCTAssertTrue([MXTools isEmailAddress:@"[email protected]"]); | ||
XCTAssertTrue([MXTools isEmailAddress:@"*@example.net"]); | ||
XCTAssertTrue([MXTools isEmailAddress:@"fred&[email protected]"]); | ||
XCTAssertTrue([MXTools isEmailAddress:@"[email protected]"]); | ||
XCTAssertTrue([MXTools isEmailAddress:@"[email protected]"]); | ||
XCTAssertTrue([MXTools isEmailAddress:@"mailbox.sub1.sub2@this-domain"]); | ||
XCTAssertTrue([MXTools isEmailAddress:@"[email protected]"]); | ||
XCTAssertTrue([MXTools isEmailAddress:@"[email protected]"]); | ||
XCTAssertTrue([MXTools isEmailAddress:@"[email protected]"]); | ||
XCTAssertTrue([MXTools isEmailAddress:@"[email protected]"]); | ||
XCTAssertTrue([MXTools isEmailAddress:@"[email protected]"]); | ||
XCTAssertTrue([MXTools isEmailAddress:@"[email protected]"]); | ||
XCTAssertTrue([MXTools isEmailAddress:@"admin@mailserver1"]); | ||
XCTAssertTrue([MXTools isEmailAddress:@"#!$%&'*+-/=?^_`{}|[email protected]"]); | ||
XCTAssertTrue([MXTools isEmailAddress:@"example@localhost"]); | ||
XCTAssertTrue([MXTools isEmailAddress:@"[email protected]"]); | ||
XCTAssertTrue([MXTools isEmailAddress:@"user@localserver"]); | ||
XCTAssertTrue([MXTools isEmailAddress:@"user@tt"]); | ||
XCTAssertTrue([MXTools isEmailAddress:@"[email protected]"]); | ||
XCTAssertTrue([MXTools isEmailAddress:@"[email protected]"]); | ||
|
||
XCTAssertFalse([MXTools isEmailAddress:@"alice.matrix.org"]); | ||
XCTAssertFalse([MXTools isEmailAddress:@"al [email protected]"]); | ||
XCTAssertFalse([MXTools isEmailAddress:@"al([email protected]"]); | ||
XCTAssertFalse([MXTools isEmailAddress:@"alice@"]); | ||
XCTAssertFalse([MXTools isEmailAddress:@"al\n[email protected]"]); | ||
XCTAssertFalse([MXTools isEmailAddress:@"al@[email protected]"]); | ||
XCTAssertFalse([MXTools isEmailAddress:@"al@[email protected]"]); | ||
XCTAssertFalse([MXTools isEmailAddress:@"Just a string"]); | ||
XCTAssertFalse([MXTools isEmailAddress:@"string"]); | ||
XCTAssertFalse([MXTools isEmailAddress:@"me@"]); | ||
XCTAssertFalse([MXTools isEmailAddress:@"@example.com"]); | ||
XCTAssertFalse([MXTools isEmailAddress:@"[email protected]"]); | ||
XCTAssertFalse([MXTools isEmailAddress:@"[email protected]"]); | ||
XCTAssertFalse([MXTools isEmailAddress:@"[email protected]"]); | ||
XCTAssertFalse([MXTools isEmailAddress:@"me\\@example.com"]); | ||
XCTAssertFalse([MXTools isEmailAddress:@"Abc.example.com"]); | ||
XCTAssertFalse([MXTools isEmailAddress:@"A@b@[email protected]"]); | ||
XCTAssertFalse([MXTools isEmailAddress:@"a\"b(c)d,e:f;g<h>i[j\\k][email protected]"]); | ||
XCTAssertFalse([MXTools isEmailAddress:@"just\"not\"[email protected]"]); | ||
XCTAssertFalse([MXTools isEmailAddress:@"this is\"not\\[email protected]"]); | ||
XCTAssertFalse([MXTools isEmailAddress:@"this\\ still\\\"not\\\\[email protected]"]); | ||
XCTAssertFalse([MXTools isEmailAddress:@"[email protected]"]); | ||
XCTAssertFalse([MXTools isEmailAddress:@"[email protected]"]); | ||
} | ||
|
||
|
||
#pragma mark - Strings encoding | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Update regex for email address to be aligned email format in RFC 5322 |