Merge branch 'mainline' into remove-old-msgs-beyond-storage-pref

This commit is contained in:
Chris Heywood 2020-05-17 12:03:30 +10:00
commit 71262f0e79
62 changed files with 3163 additions and 1355 deletions

View file

@ -61,7 +61,7 @@ class Geary.AttachmentTest : TestCase {
public override void set_up() {
try {
this.content_type = Mime.ContentType.deserialize(CONTENT_TYPE);
this.content_type = Mime.ContentType.parse(CONTENT_TYPE);
this.default_type = Mime.ContentType.ATTACHMENT_DEFAULT;
this.content_disposition = new Mime.ContentDisposition("attachment", null);

View file

@ -434,7 +434,7 @@ class Geary.App.ConversationMonitorTest : TestCase {
references.message_id
);
}
email.set_send_date(new Geary.RFC822.Date.from_date_time(now));
email.set_send_date(new RFC822.Date(now));
email.set_email_properties(new MockEmailProperties(now));
email.set_full_references(mid, null, refs_list);
return email;

View file

@ -489,7 +489,7 @@ class Geary.App.ConversationSetTest : TestCase {
references.message_id
);
}
email.set_send_date(new Geary.RFC822.Date.from_date_time(now));
email.set_send_date(new RFC822.Date(now));
email.set_email_properties(new MockEmailProperties(now));
email.set_full_references(mid, null, refs_list);
return email;

View file

@ -289,7 +289,7 @@ class Geary.App.ConversationTest : TestCase {
);
email.set_full_references(mid, null, null);
email.set_email_properties(new MockEmailProperties(now));
email.set_send_date(new Geary.RFC822.Date.from_date_time(now));
email.set_send_date(new RFC822.Date(now));
return email;
}

View file

@ -10,6 +10,7 @@ class Geary.Mime.ContentTypeTest : TestCase {
public ContentTypeTest() {
base("Geary.Mime.ContentTypeTest");
add_test("static_defaults", static_defaults);
add_test("parse", parse);
add_test("get_file_name_extension", get_file_name_extension);
add_test("guess_type_from_name", guess_type_from_name);
add_test("guess_type_from_buf", guess_type_from_buf);
@ -26,6 +27,26 @@ class Geary.Mime.ContentTypeTest : TestCase {
);
}
public void parse() throws GLib.Error {
var test_article = ContentType.parse("text/plain");
assert_string("text", test_article.media_type);
assert_string("plain", test_article.media_subtype);
try {
ContentType.parse("");
assert_not_reached();
} catch (MimeError.PARSE error) {
// All good
}
try {
ContentType.parse("textplain");
assert_not_reached();
} catch (MimeError.PARSE error) {
// All good
}
}
public void get_file_name_extension() throws Error {
assert(new ContentType("image", "jpeg", null).get_file_name_extension() == ".jpeg");
assert(new ContentType("test", "unknown", null).get_file_name_extension() == null);

View file

@ -24,7 +24,7 @@ class Geary.RFC822.MailboxAddressTest : TestCase {
add_test("equal_to", equal_to);
}
public void is_valid_address() throws Error {
public void is_valid_address() throws GLib.Error {
assert(Geary.RFC822.MailboxAddress.is_valid_address("john@dep.aol.museum") == true);
assert(Geary.RFC822.MailboxAddress.is_valid_address("test@example.com") == true);
assert(Geary.RFC822.MailboxAddress.is_valid_address("test.other@example.com") == true);
@ -44,7 +44,7 @@ class Geary.RFC822.MailboxAddressTest : TestCase {
assert(Geary.RFC822.MailboxAddress.is_valid_address("\"Surname, Name\" <mail@example.com>") == true);
}
public void unescaped_constructor() throws Error {
public void unescaped_constructor() throws GLib.Error {
MailboxAddress addr1 = new MailboxAddress("test1", "test2@example.com");
assert(addr1.name == "test1");
assert(addr1.address == "test2@example.com");
@ -72,7 +72,7 @@ class Geary.RFC822.MailboxAddressTest : TestCase {
assert(addr5.domain == "");
}
public void from_rfc822_string_encoded() throws Error {
public void from_rfc822_string_encoded() throws GLib.Error {
try {
MailboxAddress addr = new MailboxAddress.from_rfc822_string("test@example.com");
assert(addr.name == null);
@ -172,7 +172,7 @@ class Geary.RFC822.MailboxAddressTest : TestCase {
assert(addr.name == "Firstname ¯_(ツ)_/¯ Lastname via=?UTF-8?Q?_Vendor=22_");
}
public void has_distinct_name() throws Error {
public void has_distinct_name() throws GLib.Error {
assert(new MailboxAddress("example", "example@example.com").has_distinct_name() == true);
assert(new MailboxAddress("", "example@example.com").has_distinct_name() == false);
@ -185,7 +185,7 @@ class Geary.RFC822.MailboxAddressTest : TestCase {
assert(new MailboxAddress("'prefix-example@example.com'", "example@example.com").has_distinct_name() == true);
}
public void is_spoofed() throws Error {
public void is_spoofed() throws GLib.Error {
assert(new MailboxAddress(null, "example@example.com").is_spoofed() == false);
assert(new MailboxAddress("", "example@example.com").is_spoofed() == false);
assert(new MailboxAddress("", "example@example.com").is_spoofed() == false);
@ -213,7 +213,7 @@ class Geary.RFC822.MailboxAddressTest : TestCase {
}
}
public void to_full_display() throws Error {
public void to_full_display() throws GLib.Error {
assert(new MailboxAddress("", "example@example.com").to_full_display() ==
"example@example.com");
assert(new MailboxAddress("Test", "example@example.com").to_full_display() ==
@ -229,7 +229,7 @@ class Geary.RFC822.MailboxAddressTest : TestCase {
);
}
public void to_short_display() throws Error {
public void to_short_display() throws GLib.Error {
assert(new MailboxAddress("", "example@example.com").to_short_display() ==
"example@example.com");
assert(new MailboxAddress("Test", "example@example.com").to_short_display() ==
@ -288,7 +288,7 @@ class Geary.RFC822.MailboxAddressTest : TestCase {
}
public void to_rfc822_string() throws Error {
public void to_rfc822_string() throws GLib.Error {
assert(new MailboxAddress("", "example@example.com").to_rfc822_string() ==
"example@example.com");
assert(new MailboxAddress(" ", "example@example.com").to_rfc822_string() ==

View file

@ -16,7 +16,7 @@ class Geary.RFC822.MailboxAddressesTest : TestCase {
add_test("hash", hash);
}
public void from_rfc822_string_encoded() throws Error {
public void from_rfc822_string_encoded() throws GLib.Error {
MailboxAddresses addrs = new MailboxAddresses.from_rfc822_string("test@example.com");
assert(addrs.size == 1);
@ -43,7 +43,7 @@ class Geary.RFC822.MailboxAddressesTest : TestCase {
assert_string("\"Surname, Name\" <mail@example.com>", addrs.to_rfc822_string());
}
public void to_rfc822_string() throws Error {
public void to_rfc822_string() throws GLib.Error {
assert(new MailboxAddresses().to_rfc822_string() == "");
assert(new_addreses({ "test1@example.com" })
.to_rfc822_string() == "test1@example.com");
@ -51,7 +51,7 @@ class Geary.RFC822.MailboxAddressesTest : TestCase {
.to_rfc822_string() == "test1@example.com, test2@example.com");
}
public void equal_to() throws Error {
public void equal_to() throws GLib.Error {
var mailboxes_a = new_addreses({ "test1@example.com" });
var mailboxes_b = new_addreses({ "test1@example.com" });
var mailboxes_c = new_addreses({ "test2@example.com" });
@ -83,7 +83,7 @@ class Geary.RFC822.MailboxAddressesTest : TestCase {
);
}
public void hash() throws Error {
public void hash() throws GLib.Error {
var mailboxes_a = new_addreses({ "test1@example.com" });
var mailboxes_b = new_addreses({ "test1@example.com" });
var mailboxes_c = new_addreses({ "test2@example.com" });

View file

@ -17,7 +17,7 @@ class Geary.RFC822.MessageDataTest : TestCase {
add_test("PreviewText.with_header", preview_text_with_header);
}
public void preview_text_with_header() throws Error {
public void preview_text_with_header() throws GLib.Error {
PreviewText plain_preview1 = new PreviewText.with_header(
new Geary.Memory.StringBuffer(PLAIN_BODY1_HEADERS),
new Geary.Memory.StringBuffer(PLAIN_BODY1_ENCODED)
@ -61,7 +61,7 @@ class Geary.RFC822.MessageDataTest : TestCase {
public void date_from_rfc822() throws GLib.Error {
const string FULL_HOUR_TZ = "Thu, 28 Feb 2019 00:00:00 -0100";
Date full_hour_tz = new Date(FULL_HOUR_TZ);
Date full_hour_tz = new Date.from_rfc822_string(FULL_HOUR_TZ);
assert_int64(
((int64) (-1 * 3600)) * 1000 * 1000,
full_hour_tz.value.get_utc_offset(),
@ -81,7 +81,7 @@ class Geary.RFC822.MessageDataTest : TestCase {
);
const string HALF_HOUR_TZ = "Thu, 28 Feb 2019 00:00:00 +1030";
Date half_hour_tz = new Date(HALF_HOUR_TZ);
Date half_hour_tz = new Date.from_rfc822_string(HALF_HOUR_TZ);
assert_int64(
((int64) (10.5 * 3600)) * 1000 * 1000,
half_hour_tz.value.get_utc_offset()
@ -96,15 +96,15 @@ class Geary.RFC822.MessageDataTest : TestCase {
public void date_to_rfc822() throws GLib.Error {
const string FULL_HOUR_TZ = "Thu, 28 Feb 2019 00:00:00 -0100";
Date full_hour_tz = new Date(FULL_HOUR_TZ);
Date full_hour_tz = new Date.from_rfc822_string(FULL_HOUR_TZ);
assert_string(FULL_HOUR_TZ, full_hour_tz.to_rfc822_string());
const string HALF_HOUR_TZ = "Thu, 28 Feb 2019 00:00:00 +1030";
Date half_hour_tz = new Date(HALF_HOUR_TZ);
Date half_hour_tz = new Date.from_rfc822_string(HALF_HOUR_TZ);
assert_string(HALF_HOUR_TZ, half_hour_tz.to_rfc822_string());
const string NEG_HALF_HOUR_TZ = "Thu, 28 Feb 2019 00:00:00 -1030";
Date neg_half_hour_tz = new Date(NEG_HALF_HOUR_TZ);
Date neg_half_hour_tz = new Date.from_rfc822_string(NEG_HALF_HOUR_TZ);
assert_string(NEG_HALF_HOUR_TZ, neg_half_hour_tz.to_rfc822_string());
}

View file

@ -59,12 +59,13 @@ This is the second line.
add_test("get_searchable_recipients", get_searchable_recipients);
add_test("from_composed_email", from_composed_email);
add_test("from_composed_email_inline_attachments", from_composed_email_inline_attachments);
add_test("get_network_buffer", get_network_buffer);
add_test("get_network_buffer_dot_stuff", get_network_buffer_dot_stuff);
add_test("get_network_buffer_long_ascii_line", get_network_buffer_long_ascii_line);
add_test("get_rfc822_buffer", get_rfc822_buffer);
add_test("get_rfc822_buffer_dot_stuff", get_rfc822_buffer_dot_stuff);
add_test("get_rfc822_buffer_no_bcc", get_rfc822_buffer_no_bcc);
add_test("get_rfc822_buffer_long_ascii_line", get_rfc822_buffer_long_ascii_line);
}
public void basic_message_from_buffer() throws Error {
public void basic_message_from_buffer() throws GLib.Error {
Message basic = resource_to_message(BASIC_TEXT_PLAIN);
assert_data(basic.subject, "Re: Basic text/plain message");
@ -74,21 +75,21 @@ This is the second line.
assert_addresses(basic.to, "Charlie <charlie@example.net>");
assert_addresses(basic.cc, "Dave <dave@example.net>");
assert_addresses(basic.bcc, "Eve <eve@example.net>");
//assert_data(basic.message_id, "<3456@example.net>");
assert_data(basic.message_id, "3456@example.net");
assert_message_id_list(basic.in_reply_to, "<1234@local.machine.example>");
assert_message_id_list(basic.references, "<1234@local.machine.example>");
assert_data(basic.date, "Fri, 21 Nov 1997 10:01:10 -0600");
assert_data(basic.date, "1997-11-21T10:01:10-0600");
assert(basic.mailer == "Geary Test Suite 1.0");
}
public void encoded_recipient() throws Error {
public void encoded_recipient() throws GLib.Error {
Message enc = string_to_message(ENCODED_TO);
// Courtesy Mailsploit https://www.mailsploit.com
assert(enc.to[0].name == "potus@whitehouse.gov <test>");
assert_string("potus@whitehouse.gov <test>", enc.to[0].name);
}
public void duplicate_mailbox() throws Error {
public void duplicate_mailbox() throws GLib.Error {
Message dup = string_to_message(DUPLICATE_TO);
assert(dup.to.size == 2);
@ -97,16 +98,16 @@ This is the second line.
);
}
public void duplicate_message_id() throws Error {
public void duplicate_message_id() throws GLib.Error {
Message dup = string_to_message(DUPLICATE_REFERENCES);
assert(dup.references.list.size == 2);
assert(dup.references.size == 2);
assert_message_id_list(
dup.references, "<1234@local.machine.example> <5678@local.machine.example>"
);
}
public void text_plain_as_plain() throws Error {
public void text_plain_as_plain() throws GLib.Error {
Message test = resource_to_message(BASIC_TEXT_PLAIN);
assert_true(test.has_plain_body(), "Expected plain body");
@ -114,7 +115,7 @@ This is the second line.
assert_string(BASIC_PLAIN_BODY, test.get_plain_body(false, null));
}
public void text_plain_as_html() throws Error {
public void text_plain_as_html() throws GLib.Error {
Message test = resource_to_message(BASIC_TEXT_PLAIN);
assert_true(test.has_plain_body(), "Expected plain body");
@ -125,7 +126,7 @@ This is the second line.
);
}
public void text_html_as_html() throws Error {
public void text_html_as_html() throws GLib.Error {
Message test = resource_to_message(BASIC_TEXT_HTML);
assert_true(test.has_html_body(), "Expected html body");
@ -133,7 +134,7 @@ This is the second line.
assert_string(BASIC_HTML_BODY, test.get_html_body(null));
}
public void text_html_as_plain() throws Error {
public void text_html_as_plain() throws GLib.Error {
Message test = resource_to_message(BASIC_TEXT_HTML);
assert_true(test.has_html_body(), "Expected html body");
@ -141,7 +142,7 @@ This is the second line.
assert_string(BASIC_HTML_BODY, test.get_html_body(null));
}
public void tnef_extract_attachments() throws Error {
public void tnef_extract_attachments() throws GLib.Error {
Message test = resource_to_message(BASIC_MULTIPART_TNEF);
Gee.List<Part> attachments = test.get_attachments();
assert_true(attachments.size == 2);
@ -149,7 +150,7 @@ This is the second line.
assert_true(attachments[1].get_clean_filename() == "bookmark.htm");
}
public void multipart_alternative_as_plain() throws Error {
public void multipart_alternative_as_plain() throws GLib.Error {
Message test = resource_to_message(BASIC_MULTIPART_ALTERNATIVE);
assert_true(test.has_plain_body(), "Expected plain body");
@ -157,7 +158,7 @@ This is the second line.
assert_string(BASIC_PLAIN_BODY, test.get_plain_body(false, null));
}
public void multipart_alternative_as_converted_html() throws Error {
public void multipart_alternative_as_converted_html() throws GLib.Error {
Message test = resource_to_message(BASIC_MULTIPART_ALTERNATIVE);
assert_true(test.has_plain_body(), "Expected plain body");
@ -168,7 +169,7 @@ This is the second line.
);
}
public void multipart_alternative_as_html() throws Error {
public void multipart_alternative_as_html() throws GLib.Error {
Message test = resource_to_message(BASIC_MULTIPART_ALTERNATIVE);
assert_true(test.has_plain_body(), "Expected plain body");
@ -176,13 +177,13 @@ This is the second line.
assert_string(BASIC_HTML_BODY, test.get_html_body(null));
}
public void get_preview() throws Error {
public void get_preview() throws GLib.Error {
Message multipart_signed = string_to_message(MULTIPART_SIGNED_MESSAGE_TEXT);
assert(multipart_signed.get_preview() == MULTIPART_SIGNED_MESSAGE_PREVIEW);
}
public void get_recipients() throws Error {
public void get_recipients() throws GLib.Error {
Message test = string_to_message(SIMPLE_MULTIRECIPIENT_TO_CC_BCC);
Gee.List<RFC822.MailboxAddress>? addresses = test.get_recipients();
@ -195,14 +196,14 @@ This is the second line.
assert_addresses_list(addresses, verify_list, "get_recipients");
}
public void get_searchable_body() throws Error {
public void get_searchable_body() throws GLib.Error {
Message test = resource_to_message(BASIC_TEXT_HTML);
string searchable = test.get_searchable_body();
assert_true(searchable.contains("This is the first line"), "Expected body text");
assert_false(searchable.contains("<P>"), "Expected html removed");
}
public void get_searchable_recipients() throws Error {
public void get_searchable_recipients() throws GLib.Error {
Message test = string_to_message(SIMPLE_MULTIRECIPIENT_TO_CC_BCC);
string searchable = test.get_searchable_recipients();
assert_true(searchable.contains("Jane Doe <jdoe@somewhere.tld>"), "Expected to address");
@ -210,13 +211,13 @@ This is the second line.
assert_true(searchable.contains("Jane Doe BCC <jdoe_bcc@somewhere.tld>"), "Expected bcc address");
}
public void get_network_buffer() throws Error {
public void get_rfc822_buffer() throws GLib.Error {
Message test = resource_to_message(BASIC_TEXT_PLAIN);
Memory.Buffer buffer = test.get_network_buffer(true);
Memory.Buffer buffer = test.get_rfc822_buffer(NONE);
assert_true(buffer.to_string() == NETWORK_BUFFER_EXPECTED, "Network buffer differs");
}
public void get_network_buffer_dot_stuff() throws GLib.Error {
public void get_rfc822_buffer_dot_stuff() throws GLib.Error {
RFC822.MailboxAddress to = new RFC822.MailboxAddress(
"Test", "test@example.com"
);
@ -235,11 +236,42 @@ This is the second line.
);
Geary.RFC822.Message message = message_from_composed_email.end(async_result());
string message_data = message.get_network_buffer(true).to_string();
string message_data = message.get_rfc822_buffer(SMTP_FORMAT).to_string();
assert_true(message_data.has_suffix("..newline\r\n..\r\n"));
}
public void get_network_buffer_long_ascii_line() throws GLib.Error {
public void get_rfc822_buffer_no_bcc() throws GLib.Error {
RFC822.MailboxAddress to = new RFC822.MailboxAddress(
"Test", "test@example.com"
);
RFC822.MailboxAddress bcc = new RFC822.MailboxAddress(
"BCC", "bcc@example.com"
);
RFC822.MailboxAddress from = new RFC822.MailboxAddress(
"Sender", "sender@example.com"
);
Geary.ComposedEmail composed = new Geary.ComposedEmail(
new GLib.DateTime.now_local(),
new Geary.RFC822.MailboxAddresses.single(from)
).set_to(
new Geary.RFC822.MailboxAddresses.single(to)
).set_bcc(
new Geary.RFC822.MailboxAddresses.single(bcc)
);
composed.body_text = "\nbody\n";
this.message_from_composed_email.begin(
composed,
this.async_completion
);
Geary.RFC822.Message message = message_from_composed_email.end(async_result());
string message_data = message.get_rfc822_buffer(SMTP_FORMAT).to_string();
assert_true("To: Test <test@example.com>\r\n" in message_data);
assert_false("bcc" in message_data.down());
}
public void get_rfc822_buffer_long_ascii_line() throws GLib.Error {
RFC822.MailboxAddress to = new RFC822.MailboxAddress(
"Test", "test@example.com"
);
@ -265,7 +297,7 @@ This is the second line.
);
Geary.RFC822.Message message = message_from_composed_email.end(async_result());
string message_data = message.get_network_buffer(true).to_string();
string message_data = message.get_rfc822_buffer(SMTP_FORMAT).to_string();
foreach (var line in message_data.split("\n")) {
assert_true(line.length < 1000, line);
}
@ -318,7 +350,7 @@ This is the second line.
);
}
public void from_composed_email_inline_attachments() throws Error {
public void from_composed_email_inline_attachments() throws GLib.Error {
RFC822.MailboxAddress to = new RFC822.MailboxAddress(
"Test", "test@example.com"
);
@ -371,7 +403,8 @@ This is the second line.
assert_true(out_buffer.size > (buffer.size+buffer2.size), "Expected sizeable message");
}
private async Geary.RFC822.Message message_from_composed_email(Geary.ComposedEmail composed) {
private async Message message_from_composed_email(ComposedEmail composed)
throws GLib.Error {
return yield new Geary.RFC822.Message.from_composed_email(
composed,
GMime.utils_generate_message_id(composed.from.get(0).domain),
@ -379,7 +412,7 @@ This is the second line.
);
}
private Message resource_to_message(string path) throws Error {
private Message resource_to_message(string path) throws GLib.Error {
GLib.File resource =
GLib.File.new_for_uri(RESOURCE_URI).resolve_relative_path(path);
@ -391,7 +424,7 @@ This is the second line.
);
}
private Message string_to_message(string message_text) throws Error {
private Message string_to_message(string message_text) throws GLib.Error {
return new Message.from_buffer(
new Geary.Memory.StringBuffer(message_text)
);
@ -399,21 +432,21 @@ This is the second line.
private void assert_data(Geary.MessageData.AbstractMessageData? actual,
string expected)
throws Error {
throws GLib.Error {
assert_non_null(actual, expected);
assert_string(expected, actual.to_string());
}
private void assert_address(Geary.RFC822.MailboxAddress? address,
string expected)
throws Error {
throws GLib.Error {
assert_non_null(address, expected);
assert_string(expected, address.to_rfc822_string());
}
private void assert_addresses(Geary.RFC822.MailboxAddresses? addresses,
string expected)
throws Error {
throws GLib.Error {
assert_non_null(addresses, expected);
assert_string(expected, addresses.to_rfc822_string());
}
@ -421,7 +454,7 @@ This is the second line.
private void assert_addresses_list(Gee.List<RFC822.MailboxAddress>? addresses,
Gee.List<string> expected,
string context)
throws Error {
throws GLib.Error {
assert_non_null(addresses, context + " not null");
assert_true(addresses.size == expected.size, context + " size");
foreach (RFC822.MailboxAddress address in addresses) {
@ -431,9 +464,9 @@ This is the second line.
private void assert_message_id_list(Geary.RFC822.MessageIDList? ids,
string expected)
throws Error {
assert_non_null(ids, expected);
assert(ids.to_rfc822_string() == expected);
throws GLib.Error {
assert_non_null(ids, "ids are null");
assert_string(expected, ids.to_rfc822_string());
}
// Courtesy Mailsploit https://www.mailsploit.com

View file

@ -23,7 +23,7 @@ class Geary.RFC822.PartTest : TestCase {
add_test("write_to_buffer_plain_utf8", write_to_buffer_plain_utf8);
}
public void new_from_minimal_mime_part() throws Error {
public void new_from_minimal_mime_part() throws GLib.Error {
Part test = new Part(new_part("test/plain", CR_BODY.data));
assert_null_string(test.content_id, "content_id");
@ -31,7 +31,7 @@ class Geary.RFC822.PartTest : TestCase {
assert_null(test.content_disposition, "content_disposition");
}
public void new_from_complete_mime_part() throws Error {
public void new_from_complete_mime_part() throws GLib.Error {
const string TYPE = "text/plain";
const string ID = "test-id";
const string DESC = "test description";
@ -58,7 +58,7 @@ class Geary.RFC822.PartTest : TestCase {
);
}
public void write_to_buffer_plain() throws Error {
public void write_to_buffer_plain() throws GLib.Error {
Part test = new Part(new_part("text/plain", CR_BODY.data));
Memory.Buffer buf = test.write_to_buffer(Part.EncodingConversion.NONE);
@ -66,7 +66,7 @@ class Geary.RFC822.PartTest : TestCase {
assert_string(CR_BODY, buf.to_string());
}
public void write_to_buffer_plain_crlf() throws Error {
public void write_to_buffer_plain_crlf() throws GLib.Error {
Part test = new Part(new_part("text/plain", CRLF_BODY.data));
Memory.Buffer buf = test.write_to_buffer(Part.EncodingConversion.NONE);
@ -75,7 +75,7 @@ class Geary.RFC822.PartTest : TestCase {
assert_string(CR_BODY, buf.to_string());
}
public void write_to_buffer_plain_ical() throws Error {
public void write_to_buffer_plain_ical() throws GLib.Error {
Part test = new Part(new_part("text/calendar", ICAL_BODY.data));
Memory.Buffer buf = test.write_to_buffer(Part.EncodingConversion.NONE);

View file

@ -15,7 +15,7 @@ class Geary.RFC822.Utils.Test : TestCase {
add_test("best_encoding_binary", best_encoding_binary);
}
public void to_preview_text() throws Error {
public void to_preview_text() throws GLib.Error {
assert(Geary.RFC822.Utils.to_preview_text(PLAIN_BODY_ENCODED, Geary.RFC822.TextFormat.PLAIN) ==
PLAIN_BODY_EXPECTED);
assert(Geary.RFC822.Utils.to_preview_text(HTML_BODY_ENCODED, Geary.RFC822.TextFormat.HTML) ==

View file

@ -118,7 +118,8 @@ class Integration.Smtp.ClientSession : TestCase {
}
private async Geary.RFC822.Message new_message(Geary.RFC822.MailboxAddress from,
Geary.RFC822.MailboxAddress to) {
Geary.RFC822.MailboxAddress to)
throws Geary.RFC822.Error {
Geary.ComposedEmail composed = new Geary.ComposedEmail(
new GLib.DateTime.now_local(),
new Geary.RFC822.MailboxAddresses.single(from)

View file

@ -52,14 +52,14 @@ geary_test_engine_sources = [
'engine/imap-db/imap-db-folder-test.vala',
'engine/imap-engine/account-processor-test.vala',
'engine/imap-engine/imap-engine-generic-account-test.vala',
'engine/mime-content-type-test.vala',
'engine/mime/mime-content-type-test.vala',
'engine/outbox/outbox-email-identifier-test.vala',
'engine/rfc822-mailbox-address-test.vala',
'engine/rfc822-mailbox-addresses-test.vala',
'engine/rfc822-message-test.vala',
'engine/rfc822-message-data-test.vala',
'engine/rfc822-part-test.vala',
'engine/rfc822-utils-test.vala',
'engine/rfc822/rfc822-mailbox-address-test.vala',
'engine/rfc822/rfc822-mailbox-addresses-test.vala',
'engine/rfc822/rfc822-message-test.vala',
'engine/rfc822/rfc822-message-data-test.vala',
'engine/rfc822/rfc822-part-test.vala',
'engine/rfc822/rfc822-utils-test.vala',
'engine/util-ascii-test.vala',
'engine/util-config-file-test.vala',
'engine/util-html-test.vala',

View file

@ -83,10 +83,12 @@ int main(string[] args) {
engine.add_suite(new Geary.Outbox.EmailIdentifierTest().get_suite());
engine.add_suite(new Geary.RFC822.MailboxAddressTest().get_suite());
engine.add_suite(new Geary.RFC822.MailboxAddressesTest().get_suite());
engine.add_suite(new Geary.RFC822.MessageTest().get_suite());
engine.add_suite(new Geary.RFC822.MessageDataTest().get_suite());
engine.add_suite(new Geary.RFC822.PartTest().get_suite());
engine.add_suite(new Geary.RFC822.Utils.Test().get_suite());
// Message requires all of the rest of the package working, so put
// last
engine.add_suite(new Geary.RFC822.MessageTest().get_suite());
engine.add_suite(new Geary.String.Test().get_suite());
engine.add_suite(new Geary.ComposedEmailTest().get_suite());

View file

@ -132,6 +132,10 @@ public class TestServer : GLib.Object {
foreach (var line in this.script) {
result.line = line;
switch (line.action) {
case CONNECTED:
// no-op
break;
case SEND_LINE:
debug("Sending: %s", line.value);
try {