This commit is contained in:
2026-11-09 19:51:11 +01:00
committed by michael300679
parent bbfbd976ed
commit 269a6e08b1
9 changed files with 387 additions and 73 deletions
+5 -5
View File
@@ -7,11 +7,11 @@ struct MailWorkflowTests {
@Test func searchScopesAndExpressions() {
let mail = MailMessage(id: "1", sender: "anna@example.com", recipient: "", subject: "Rechnung 2026",
date: Date(), body: "Betrag: 123,45 EUR", attachments: [])
#expect(MailSearch(text: "123,45", subject: false, sender: false, body: true, regularExpression: false).matches(mail))
#expect(!MailSearch(text: "123,45", subject: true, sender: true, body: false, regularExpression: false).matches(mail))
#expect(MailSearch(text: #"Rechnung \d{4}$"#, subject: true, sender: false, body: false, regularExpression: true).matches(mail))
#expect(MailSearch(text: "^ANNA@", subject: false, sender: true, body: false, regularExpression: true).matches(mail))
let invalid = MailSearch(text: "[", subject: true, sender: true, body: true, regularExpression: true)
#expect(MailSearch(text: "123,45", caseSensitive: false, regularExpression: false).matches(mail))
#expect(MailSearch(text: #"Rechnung \d{4}$"#, caseSensitive: false, regularExpression: true).matches(mail))
#expect(!MailSearch(text: "^ANNA@", caseSensitive: false, regularExpression: true).matches(mail))
#expect(MailSearch(text: "(?i)^ANNA@", caseSensitive: false, regularExpression: true).matches(mail))
let invalid = MailSearch(text: "[", caseSensitive: false, regularExpression: true)
#expect(invalid.error != nil)
#expect(!invalid.matches(mail))
}