File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change 45
45
(defn valid-email-domain?
46
46
" Returns true if the domain of the supplied email address has a MX DNS entry."
47
47
[email]
48
- (let [domain (second (re-matches #".*@(.*)" email))]
48
+ (if- let [domain (second (re-matches #".*@(.*)" email))]
49
49
(boolean (dns-lookup domain " MX" ))))
50
50
51
51
(defn integer-string?
Original file line number Diff line number Diff line change 12
12
(is ((matches #"..." ) " foo" ))
13
13
(is (not ((matches #"..." ) " foobar" ))))
14
14
15
+ (deftest test-email-address?
16
+ (is (email-address? " foo@example.com" ))
17
+ (is (email-address? " foo+bar@example.com" ))
18
+ (is (email-address? " foo-bar@example.com" ))
19
+ (is (email-address? " foo.bar@example.com" ))
20
+ (is (email-address? " foo@example.co.uk" ))
21
+ (is (not (email-address? " foo" )))
22
+ (is (not (email-address? " foo@bar" )))
23
+ (is (not (email-address? " foo bar@example.com" )))
24
+ (is (not (email-address? " foo@foo_bar.com" ))))
25
+
26
+ (deftest test-valid-email-domain?
27
+ (is (valid-email-domain? " example@google.com" ))
28
+ (is (not (valid-email-domain? " foo@example.com" )))
29
+ (is (not (valid-email-domain? " foo@google.com.nospam" )))
30
+ (is (not (valid-email-domain? " foo" ))))
31
+
15
32
(deftest test-integer-string?
16
33
(is (integer-string? " 10" ))
17
34
(is (integer-string? " -9" ))
You can’t perform that action at this time.
0 commit comments