24#include <catch2/catch.hpp>
30TEST_CASE(
"nawa::mail::EmailAddress class",
"[unit][email][emailaddress]") {
31 SECTION(
"Validity check") {
32 CHECK_FALSE(mail::EmailAddress(
"hello world@example.com").isValid());
33 CHECK(mail::EmailAddress(
"test@bärlin.xy").isValid());
35 SECTION(
"Correct representation") {
36 mail::EmailAddress ea1(
"John Doe",
"john.doe@example.com");
37 mail::EmailAddress ea2(
"john.doe@example.com");
38 mail::EmailAddress ea3(
"test@bärlin.xy");
39 CHECK(ea1.get() ==
"John Doe <john.doe@example.com>");
40 CHECK(ea1.get(
true) ==
"John Doe <john.doe@example.com>");
41 CHECK(ea1.get(
false) ==
"<john.doe@example.com>");
42 CHECK(ea2.get(
false) ==
"<john.doe@example.com>");
43 CHECK(ea2.get(
true) ==
"<john.doe@example.com>");
44 CHECK(ea3.get() ==
"<test@xn--brlin-gra.xy>");
45 CHECK(ea3.get(
false,
false) ==
"<test@bärlin.xy>");
Structure representing an email address.
TEST_CASE("nawa::mail::EmailAddress class", "[unit][email][emailaddress]")