Skip to content

Commit

Permalink
added unit-tests for plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
drkameleon committed Aug 27, 2024
1 parent 9bf64c7 commit 541f6e0
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/plugins/email.art
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,19 @@ action: function [str][
; https://stackoverflow.com/a/201378
match? str
{/(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/}
]

;------------------
; tests
;------------------
test: #[
valid: [
"drkameleon@gmail.com"
"yaniszaf@gmail.com"
]

invalid: [
"drkameleongmail.com"
"foobar"
]
]

0 comments on commit 541f6e0

Please sign in to comment.