Update existing tests to work with ValaUnit
This commit is contained in:
parent
6b1bad28b9
commit
0ae633d88f
53 changed files with 773 additions and 756 deletions
|
|
@ -80,8 +80,8 @@ class Accounts.ManagerTest : TestCase {
|
|||
);
|
||||
this.test.create_account.end(async_result());
|
||||
|
||||
assert_int(1, this.test.size, "Account manager size");
|
||||
assert_equal(account, this.test.get_account(TEST_ID), "Is not contained");
|
||||
assert_equal<int?>(this.test.size, 1, "Account manager size");
|
||||
assert_equal(this.test.get_account(TEST_ID), account, "Is not contained");
|
||||
assert_true(was_added, "Was not added");
|
||||
assert_true(was_enabled, "Was not enabled");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,13 +36,13 @@ class Application.ClientTest : TestCase {
|
|||
int status;
|
||||
this.test_article.local_command_line(ref unowned_args, out status);
|
||||
|
||||
assert_string(
|
||||
_INSTALL_PREFIX + "/share/geary",
|
||||
this.test_article.get_resource_directory().get_path()
|
||||
assert_equal(
|
||||
this.test_article.get_resource_directory().get_path(),
|
||||
_INSTALL_PREFIX + "/share/geary"
|
||||
);
|
||||
assert_string(
|
||||
_INSTALL_PREFIX + "/share/applications",
|
||||
this.test_article.get_desktop_directory().get_path()
|
||||
assert_equal(
|
||||
this.test_article.get_desktop_directory().get_path(),
|
||||
_INSTALL_PREFIX + "/share/applications"
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ public abstract class ClientWebViewTestCase<V> : TestCase {
|
|||
try {
|
||||
ClientWebView.load_resources(GLib.File.new_for_path("/tmp"));
|
||||
} catch (GLib.Error err) {
|
||||
assert_not_reached();
|
||||
GLib.assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ public class Composer.WebViewTest : ClientWebViewTestCase<Composer.WebView> {
|
|||
load_body_fixture(BODY);
|
||||
this.test_view.get_html.begin(this.async_completion);
|
||||
string html = this.test_view.get_html.end(async_result());
|
||||
assert_string(PageStateTest.CLEAN_BODY_TEMPLATE.printf(BODY), html);
|
||||
assert_equal(html, PageStateTest.CLEAN_BODY_TEMPLATE.printf(BODY));
|
||||
}
|
||||
|
||||
public void get_html_for_draft() throws GLib.Error {
|
||||
|
|
@ -64,7 +64,7 @@ public class Composer.WebViewTest : ClientWebViewTestCase<Composer.WebView> {
|
|||
load_body_fixture(BODY);
|
||||
this.test_view.get_html_for_draft.begin(this.async_completion);
|
||||
string html = this.test_view.get_html.end(async_result());
|
||||
assert_string(PageStateTest.COMPLETE_BODY_TEMPLATE.printf(BODY), html);
|
||||
assert_equal(html, PageStateTest.COMPLETE_BODY_TEMPLATE.printf(BODY));
|
||||
}
|
||||
|
||||
public void get_text() throws Error {
|
||||
|
|
|
|||
|
|
@ -13,24 +13,32 @@ public class Util.Avatar.Test : TestCase {
|
|||
}
|
||||
|
||||
public void extract_initials() throws GLib.Error {
|
||||
assert_string("A", extract_initials_from_name("aardvark"));
|
||||
assert_string("AB", extract_initials_from_name("aardvark baardvark"));
|
||||
assert_string("AB", extract_initials_from_name("aardvark baardvark"));
|
||||
assert_string("AC", extract_initials_from_name("aardvark baardvark caardvark"));
|
||||
assert_equal(extract_initials_from_name("aardvark"), "A");
|
||||
assert_equal(extract_initials_from_name("aardvark baardvark"), "AB");
|
||||
assert_equal(extract_initials_from_name("aardvark baardvark"), "AB");
|
||||
assert_equal(
|
||||
extract_initials_from_name("aardvark baardvark caardvark"), "AC"
|
||||
);
|
||||
|
||||
assert_string("A", extract_initials_from_name("!aardvark"));
|
||||
assert_string("AB", extract_initials_from_name("aardvark !baardvark"));
|
||||
assert_string("AC", extract_initials_from_name("aardvark baardvark !caardvark"));
|
||||
assert_equal(
|
||||
extract_initials_from_name("!aardvark"), "A"
|
||||
);
|
||||
assert_equal(
|
||||
extract_initials_from_name("aardvark !baardvark"), "AB"
|
||||
);
|
||||
assert_equal(
|
||||
extract_initials_from_name("aardvark baardvark !caardvark"), "AC"
|
||||
);
|
||||
|
||||
assert_string("Ó", extract_initials_from_name("óvári"));
|
||||
assert_equal(extract_initials_from_name("óvári"), "Ó");
|
||||
|
||||
assert_true(extract_initials_from_name("") == null);
|
||||
assert_true(extract_initials_from_name(" ") == null);
|
||||
assert_true(extract_initials_from_name(" ") == null);
|
||||
assert_true(extract_initials_from_name("!") == null);
|
||||
assert_true(extract_initials_from_name("!!") == null);
|
||||
assert_true(extract_initials_from_name("! !") == null);
|
||||
assert_true(extract_initials_from_name("! !!") == null);
|
||||
assert_null(extract_initials_from_name(""));
|
||||
assert_null(extract_initials_from_name(" "));
|
||||
assert_null(extract_initials_from_name(" "));
|
||||
assert_null(extract_initials_from_name("!"));
|
||||
assert_null(extract_initials_from_name("!!"));
|
||||
assert_null(extract_initials_from_name("! !"));
|
||||
assert_null(extract_initials_from_name("! !!"));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,32 +22,32 @@ public class Util.Cache.Test : TestCase {
|
|||
Lru<string> test_article = new Lru<string>(2);
|
||||
|
||||
assert_true(test_article.is_empty);
|
||||
assert_uint(0, test_article.size);
|
||||
assert_equal(test_article.size, 0);
|
||||
|
||||
assert_true(test_article.get_entry(A) == null);
|
||||
test_article.set_entry(A, A);
|
||||
assert_string(A, test_article.get_entry(A));
|
||||
assert_equal(test_article.get_entry(A), A);
|
||||
|
||||
assert_false(test_article.is_empty);
|
||||
assert_uint(1, test_article.size);
|
||||
assert_equal<uint?>(test_article.size, 1);
|
||||
|
||||
test_article.set_entry(B, B);
|
||||
assert_string(B, test_article.get_entry(B));
|
||||
assert_uint(2, test_article.size);
|
||||
assert_equal(test_article.get_entry(B), B);
|
||||
assert_equal<uint?>(test_article.size, 2);
|
||||
|
||||
test_article.set_entry(C, C);
|
||||
assert_string(C, test_article.get_entry(C));
|
||||
assert_uint(2, test_article.size);
|
||||
assert_equal(test_article.get_entry(C), C);
|
||||
assert_equal<uint?>(test_article.size, 2);
|
||||
assert_true(test_article.get_entry(A) == null);
|
||||
|
||||
test_article.set_entry(D, D);
|
||||
assert_string(D, test_article.get_entry(D));
|
||||
assert_uint(2, test_article.size);
|
||||
assert_equal(test_article.get_entry(D), D);
|
||||
assert_equal<uint?>(test_article.size, 2);
|
||||
assert_true(test_article.get_entry(B) == null);
|
||||
|
||||
test_article.clear();
|
||||
assert_true(test_article.is_empty);
|
||||
assert_uint(0, test_article.size);
|
||||
assert_equal<uint?>(test_article.size, 0);
|
||||
}
|
||||
|
||||
public void lru_eviction() throws GLib.Error {
|
||||
|
|
@ -63,8 +63,8 @@ public class Util.Cache.Test : TestCase {
|
|||
test_article.get_entry(A);
|
||||
test_article.set_entry(C, C);
|
||||
|
||||
assert_string(C, test_article.get_entry(C));
|
||||
assert_string(A, test_article.get_entry(A));
|
||||
assert_equal(test_article.get_entry(C), C);
|
||||
assert_equal(test_article.get_entry(A), A);
|
||||
assert_true(test_article.get_entry(B) == null);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,8 +35,8 @@ public class Util.Email.Test : TestCase {
|
|||
);
|
||||
|
||||
assert_non_null(originator);
|
||||
assert_string("from", originator.name);
|
||||
assert_string("from@example.com", originator.address);
|
||||
assert_equal(originator.name, "from");
|
||||
assert_equal(originator.address, "from@example.com");
|
||||
}
|
||||
|
||||
public void sender_originator() throws GLib.Error {
|
||||
|
|
@ -49,8 +49,8 @@ public class Util.Email.Test : TestCase {
|
|||
);
|
||||
|
||||
assert_non_null(originator);
|
||||
assert_string("sender", originator.name);
|
||||
assert_string("sender@example.com", originator.address);
|
||||
assert_equal(originator.name, "sender");
|
||||
assert_equal(originator.address, "sender@example.com");
|
||||
}
|
||||
|
||||
public void reply_to_originator() throws GLib.Error {
|
||||
|
|
@ -63,8 +63,8 @@ public class Util.Email.Test : TestCase {
|
|||
);
|
||||
|
||||
assert_non_null(originator);
|
||||
assert_string("reply-to", originator.name);
|
||||
assert_string("reply-to@example.com", originator.address);
|
||||
assert_equal(originator.name, "reply-to");
|
||||
assert_equal(originator.address, "reply-to@example.com");
|
||||
}
|
||||
|
||||
public void reply_to_via_originator() throws GLib.Error {
|
||||
|
|
@ -77,8 +77,8 @@ public class Util.Email.Test : TestCase {
|
|||
);
|
||||
|
||||
assert_non_null(originator);
|
||||
assert_string("test", originator.name);
|
||||
assert_string("test@example.com", originator.address);
|
||||
assert_equal(originator.name, "test");
|
||||
assert_equal(originator.address, "test@example.com");
|
||||
}
|
||||
|
||||
public void plain_via_originator() throws GLib.Error {
|
||||
|
|
@ -91,8 +91,8 @@ public class Util.Email.Test : TestCase {
|
|||
);
|
||||
|
||||
assert_non_null(originator);
|
||||
assert_string("test", originator.name);
|
||||
assert_string("bot@example.com", originator.address);
|
||||
assert_equal(originator.name, "test");
|
||||
assert_equal(originator.address, "bot@example.com");
|
||||
}
|
||||
|
||||
private Geary.Email new_email(Geary.RFC822.MailboxAddress? from,
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ public class Util.JS.Test : TestCase {
|
|||
add_test("escape_string", escape_string);
|
||||
}
|
||||
|
||||
public void escape_string() throws Error {
|
||||
public void escape_string() throws GLib.Error {
|
||||
assert(Util.JS.escape_string("\n") == """\n""");
|
||||
assert(Util.JS.escape_string("\r") == """\r""");
|
||||
assert(Util.JS.escape_string("\t") == """\t""");
|
||||
|
|
|
|||
|
|
@ -88,39 +88,35 @@ class Geary.AccountInformationTest : TestCase {
|
|||
|
||||
public void test_service_label() throws GLib.Error {
|
||||
AccountInformation test = new_information();
|
||||
assert_string("", test.service_label);
|
||||
assert_equal(test.service_label, "");
|
||||
|
||||
test = new_information();
|
||||
test.incoming.host = "example.com";
|
||||
assert_string(
|
||||
"example.com", test.service_label, "Email domain equals host name"
|
||||
);
|
||||
assert_equal(test.service_label, "example.com");
|
||||
|
||||
test = new_information();
|
||||
test.incoming.host = "test.example.com";
|
||||
assert_string(
|
||||
"example.com", test.service_label, "Email domain host name suffix"
|
||||
);
|
||||
assert_equal(test.service_label, "example.com");
|
||||
|
||||
test = new_information();
|
||||
test.incoming.host = "other.com";
|
||||
test.outgoing.host = "other.com";
|
||||
assert_string("other.com", test.service_label);
|
||||
assert_equal(test.service_label, "other.com");
|
||||
|
||||
test = new_information();
|
||||
test.incoming.host = "mail.other.com";
|
||||
test.outgoing.host = "mail.other.com";
|
||||
assert_string("other.com", test.service_label);
|
||||
assert_equal(test.service_label, "other.com");
|
||||
|
||||
test = new_information();
|
||||
test.incoming.host = "imap.other.com";
|
||||
test.outgoing.host = "smtp.other.com";
|
||||
assert_string("other.com", test.service_label);
|
||||
assert_equal(test.service_label, "other.com");
|
||||
|
||||
test = new_information();
|
||||
test.incoming.host = "not-mail.other.com";
|
||||
test.outgoing.host = "not-mail.other.com";
|
||||
assert_string("other.com", test.service_label);
|
||||
assert_equal(test.service_label, "other.com");
|
||||
}
|
||||
|
||||
private AccountInformation new_information(ServiceProvider provider =
|
||||
|
|
|
|||
|
|
@ -5,7 +5,9 @@
|
|||
* (version 2.1 or later). See the COPYING file in this distribution.
|
||||
*/
|
||||
|
||||
public class Geary.MockAccount : Account, MockObject {
|
||||
public class Geary.MockAccount : Account,
|
||||
ValaUnit.TestAssertions,
|
||||
ValaUnit.MockObject {
|
||||
|
||||
|
||||
public class MockSearchQuery : SearchQuery {
|
||||
|
|
@ -47,8 +49,8 @@ public class Geary.MockAccount : Account, MockObject {
|
|||
}
|
||||
|
||||
|
||||
protected Gee.Queue<ExpectedCall> expected {
|
||||
get; set; default = new Gee.LinkedList<ExpectedCall>();
|
||||
protected Gee.Queue<ValaUnit.ExpectedCall> expected {
|
||||
get; set; default = new Gee.LinkedList<ValaUnit.ExpectedCall>();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -59,17 +59,13 @@ class Geary.AttachmentTest : TestCase {
|
|||
get_safe_file_name_with_unknown_content_type);
|
||||
}
|
||||
|
||||
public override void set_up() {
|
||||
try {
|
||||
public override void set_up() throws GLib.Error {
|
||||
this.content_type = Mime.ContentType.parse(CONTENT_TYPE);
|
||||
this.default_type = Mime.ContentType.ATTACHMENT_DEFAULT;
|
||||
this.content_disposition = new Mime.ContentDisposition("attachment", null);
|
||||
|
||||
File source = File.new_for_path(_SOURCE_ROOT_DIR);
|
||||
this.file = source.get_child(FILE_PATH);
|
||||
} catch (Error err) {
|
||||
assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
||||
public void get_safe_file_name_with_content_name() throws Error {
|
||||
|
|
@ -219,7 +215,7 @@ class Geary.AttachmentTest : TestCase {
|
|||
|
||||
test.get_safe_file_name.begin(null, this.async_completion);
|
||||
|
||||
assert_string(TEST_FILENAME, test.get_safe_file_name.end(async_result()));
|
||||
assert_equal(test.get_safe_file_name.end(async_result()), TEST_FILENAME);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,10 +5,11 @@
|
|||
* (version 2.1 or later). See the COPYING file in this distribution.
|
||||
*/
|
||||
|
||||
internal class Geary.ContactStoreMock : ContactStore, MockObject, GLib.Object {
|
||||
internal class Geary.ContactStoreMock : GLib.Object,
|
||||
ContactStore, ValaUnit.TestAssertions, ValaUnit.MockObject {
|
||||
|
||||
protected Gee.Queue<ExpectedCall> expected {
|
||||
get; set; default = new Gee.LinkedList<ExpectedCall>();
|
||||
protected Gee.Queue<ValaUnit.ExpectedCall> expected {
|
||||
get; set; default = new Gee.LinkedList<ValaUnit.ExpectedCall>();
|
||||
}
|
||||
|
||||
public async Contact? get_by_rfc822(Geary.RFC822.MailboxAddress address,
|
||||
|
|
|
|||
|
|
@ -6,11 +6,14 @@
|
|||
*/
|
||||
|
||||
public class Geary.MockCredentialsMediator :
|
||||
GLib.Object, CredentialsMediator, MockObject {
|
||||
GLib.Object,
|
||||
CredentialsMediator,
|
||||
ValaUnit.TestAssertions,
|
||||
ValaUnit.MockObject {
|
||||
|
||||
|
||||
protected Gee.Queue<ExpectedCall> expected {
|
||||
get; set; default = new Gee.LinkedList<ExpectedCall>();
|
||||
protected Gee.Queue<ValaUnit.ExpectedCall> expected {
|
||||
get; set; default = new Gee.LinkedList<ValaUnit.ExpectedCall>();
|
||||
}
|
||||
|
||||
public virtual async bool load_token(AccountInformation account,
|
||||
|
|
|
|||
|
|
@ -55,15 +55,11 @@ class Geary.EngineTest : TestCase {
|
|||
this.account.set_account_directories(this.tmp, this.tmp);
|
||||
}
|
||||
|
||||
public override void tear_down () {
|
||||
public override void tear_down() throws GLib.Error {
|
||||
this.account = null;
|
||||
try {
|
||||
this.res.delete();
|
||||
this.tmp.delete();
|
||||
this.tmp = null;
|
||||
} catch (Error err) {
|
||||
assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
||||
public void add_account() throws GLib.Error {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,9 @@
|
|||
* (version 2.1 or later). See the COPYING file in this distribution.
|
||||
*/
|
||||
|
||||
public class Geary.MockFolder : Folder, MockObject {
|
||||
public class Geary.MockFolder : Folder,
|
||||
ValaUnit.TestAssertions,
|
||||
ValaUnit.MockObject {
|
||||
|
||||
|
||||
public override Account account {
|
||||
|
|
@ -28,8 +30,8 @@ public class Geary.MockFolder : Folder, MockObject {
|
|||
get { return this._opening_monitor; }
|
||||
}
|
||||
|
||||
protected Gee.Queue<ExpectedCall> expected {
|
||||
get; set; default = new Gee.LinkedList<ExpectedCall>();
|
||||
protected Gee.Queue<ValaUnit.ExpectedCall> expected {
|
||||
get; set; default = new Gee.LinkedList<ValaUnit.ExpectedCall>();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -41,16 +41,12 @@ public class Geary.FolderPathTest : TestCase {
|
|||
}
|
||||
|
||||
public void get_child_from_root() throws GLib.Error {
|
||||
assert_string(
|
||||
"test",
|
||||
this.root.get_child("test").name
|
||||
);
|
||||
assert_equal(this.root.get_child("test").name, "test");
|
||||
}
|
||||
|
||||
public void get_child_from_child() throws GLib.Error {
|
||||
assert_string(
|
||||
"test2",
|
||||
this.root.get_child("test1").get_child("test2").name
|
||||
assert_equal(
|
||||
this.root.get_child("test1").get_child("test2").name, "test2"
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -63,32 +59,20 @@ public class Geary.FolderPathTest : TestCase {
|
|||
}
|
||||
|
||||
public void as_array() throws GLib.Error {
|
||||
assert_true(this.root.as_array().length == 0, "Root list");
|
||||
assert_int(
|
||||
1,
|
||||
this.root.get_child("test").as_array().length,
|
||||
"Child array length"
|
||||
);
|
||||
assert_string(
|
||||
"test",
|
||||
this.root.get_child("test").as_array()[0],
|
||||
"Child array contents"
|
||||
);
|
||||
assert_int(
|
||||
2,
|
||||
this.root.get_child("test1").get_child("test2").as_array().length,
|
||||
"Descendent array length"
|
||||
);
|
||||
assert_string(
|
||||
"test1",
|
||||
this.root.get_child("test1").get_child("test2").as_array()[0],
|
||||
"Descendent first child"
|
||||
);
|
||||
assert_string(
|
||||
"test2",
|
||||
this.root.get_child("test1").get_child("test2").as_array()[1],
|
||||
"Descendent second child"
|
||||
);
|
||||
assert_array(
|
||||
this.root.as_array(),
|
||||
"Root list"
|
||||
).size(0);
|
||||
|
||||
assert_array(
|
||||
this.root.get_child("test").as_array(),
|
||||
"Child array"
|
||||
).size(1).contains("test");
|
||||
|
||||
assert_array(
|
||||
this.root.get_child("test1").get_child("test2").as_array(),
|
||||
"Descendent array"
|
||||
).size(2).first_is("test1").at_index_is(1, "test2");
|
||||
}
|
||||
|
||||
public void is_top_level() throws GLib.Error {
|
||||
|
|
@ -115,24 +99,25 @@ public class Geary.FolderPathTest : TestCase {
|
|||
}
|
||||
|
||||
public void path_to_string() throws GLib.Error {
|
||||
assert_string(">", this.root.to_string());
|
||||
assert_string(">test", this.root.get_child("test").to_string());
|
||||
assert_string(
|
||||
">test1>test2",
|
||||
this.root.get_child("test1").get_child("test2").to_string()
|
||||
assert_equal(this.root.to_string(), ">");
|
||||
assert_equal(this.root.get_child("test").to_string(), ">test");
|
||||
assert_equal(
|
||||
this.root.get_child("test1").get_child("test2").to_string(),
|
||||
">test1>test2"
|
||||
);
|
||||
}
|
||||
|
||||
public void path_parent() throws GLib.Error {
|
||||
assert_null(this.root.parent, "Root parent");
|
||||
assert_string(
|
||||
"",
|
||||
this.root.get_child("test").parent.name,
|
||||
"Root child parent");
|
||||
assert_string(
|
||||
"test1",
|
||||
"Root child parent"
|
||||
).is_empty();
|
||||
assert_equal(
|
||||
this.root.get_child("test1").get_child("test2").parent.name,
|
||||
"Child parent");
|
||||
"test1",
|
||||
"Child parent"
|
||||
);
|
||||
}
|
||||
|
||||
public void path_equal() throws GLib.Error {
|
||||
|
|
@ -170,138 +155,148 @@ public class Geary.FolderPathTest : TestCase {
|
|||
}
|
||||
|
||||
public void path_compare() throws GLib.Error {
|
||||
assert_int(0, this.root.compare_to(this.root), "Root equality");
|
||||
assert_int(0,
|
||||
// / == /
|
||||
assert_compare_eq(this.root.compare_to(this.root), "Root equality");
|
||||
// /a == /a
|
||||
assert_compare_eq(
|
||||
this.root.get_child("a").compare_to(this.root.get_child("a")),
|
||||
"Equal child comparison"
|
||||
);
|
||||
|
||||
// a is less than b
|
||||
assert_true(
|
||||
this.root.get_child("a").compare_to(this.root.get_child("b")) < 0,
|
||||
"Greater than child comparison"
|
||||
);
|
||||
|
||||
// b is greater than than a
|
||||
assert_true(
|
||||
this.root.get_child("b").compare_to(this.root.get_child("a")) > 0,
|
||||
// /a < /b
|
||||
assert_compare_lt(
|
||||
this.root.get_child("a").compare_to(this.root.get_child("b")),
|
||||
"Less than child comparison"
|
||||
);
|
||||
|
||||
assert_true(
|
||||
this.root.get_child("a").get_child("test")
|
||||
.compare_to(this.root.get_child("a")) > 0,
|
||||
"Greater than descendant"
|
||||
// /b > /a
|
||||
assert_compare_gt(
|
||||
this.root.get_child("b").compare_to(this.root.get_child("a")),
|
||||
"Greater than child comparison"
|
||||
);
|
||||
assert_true(
|
||||
|
||||
// /a < /a/test
|
||||
assert_compare_lt(
|
||||
this.root.get_child("a")
|
||||
.compare_to(this.root.get_child("a").get_child("test")) < 0,
|
||||
.compare_to(this.root.get_child("a").get_child("test")),
|
||||
"Less than descendant"
|
||||
);
|
||||
|
||||
assert_true(
|
||||
// /a/test > /a
|
||||
assert_compare_gt(
|
||||
this.root.get_child("a").get_child("test")
|
||||
.compare_to(this.root.get_child("a")),
|
||||
"Greater than descendant"
|
||||
);
|
||||
|
||||
// /a/b == /a/b
|
||||
assert_compare_eq(
|
||||
this.root.get_child("a").get_child("b")
|
||||
.compare_to(this.root.get_child("a").get_child("b")) == 0,
|
||||
.compare_to(this.root.get_child("a").get_child("b")),
|
||||
"N-path equality"
|
||||
);
|
||||
|
||||
assert_true(
|
||||
// /a/test < /b/test
|
||||
assert_compare_lt(
|
||||
this.root.get_child("a").get_child("test")
|
||||
.compare_to(this.root.get_child("b").get_child("test")) < 0,
|
||||
"Greater than disjoint paths"
|
||||
);
|
||||
assert_true(
|
||||
this.root.get_child("b").get_child("test")
|
||||
.compare_to(this.root.get_child("a").get_child("test")) > 0,
|
||||
.compare_to(this.root.get_child("b").get_child("test")),
|
||||
"Less than disjoint paths"
|
||||
);
|
||||
|
||||
assert_true(
|
||||
this.root.get_child("a").get_child("d")
|
||||
.compare_to(this.root.get_child("b").get_child("c")) < 0,
|
||||
"Greater than double disjoint"
|
||||
// /b/test > /a/test
|
||||
assert_compare_gt(
|
||||
this.root.get_child("b").get_child("test")
|
||||
.compare_to(this.root.get_child("a").get_child("test")),
|
||||
"Greater than disjoint paths"
|
||||
);
|
||||
assert_true(
|
||||
|
||||
// /a/d < /b/c
|
||||
assert_compare_lt(
|
||||
this.root.get_child("a").get_child("d")
|
||||
.compare_to(this.root.get_child("b").get_child("c")),
|
||||
"Less than double disjoint"
|
||||
);
|
||||
|
||||
// /b/c > /a/d
|
||||
assert_compare_gt(
|
||||
this.root.get_child("b").get_child("c")
|
||||
.compare_to(this.root.get_child("a").get_child("d")) > 0,
|
||||
.compare_to(this.root.get_child("a").get_child("d")),
|
||||
"Less than double disjoint"
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public void path_compare_normalised() throws GLib.Error {
|
||||
assert_int(0, this.root.compare_normalized_ci(this.root), "Root equality");
|
||||
assert_int(0,
|
||||
assert_compare_eq(
|
||||
this.root.compare_normalized_ci(this.root), "Root equality"
|
||||
);
|
||||
assert_compare_eq(
|
||||
this.root.get_child("a").compare_normalized_ci(this.root.get_child("a")),
|
||||
"Equal child comparison"
|
||||
);
|
||||
|
||||
// a is less than b
|
||||
assert_true(
|
||||
this.root.get_child("a").compare_normalized_ci(this.root.get_child("b")) < 0,
|
||||
assert_compare_lt(
|
||||
this.root.get_child("a").compare_normalized_ci(this.root.get_child("b")),
|
||||
"Greater than child comparison"
|
||||
);
|
||||
|
||||
// b is greater than than a
|
||||
assert_true(
|
||||
this.root.get_child("b").compare_normalized_ci(this.root.get_child("a")) > 0,
|
||||
assert_compare_gt(
|
||||
this.root.get_child("b").compare_normalized_ci(this.root.get_child("a")),
|
||||
"Less than child comparison"
|
||||
);
|
||||
|
||||
assert_true(
|
||||
assert_compare_lt(
|
||||
this.root.get_child("a").get_child("test")
|
||||
.compare_normalized_ci(this.root.get_child("b").get_child("test")) < 0,
|
||||
.compare_normalized_ci(this.root.get_child("b").get_child("test")),
|
||||
"Greater than disjoint parents"
|
||||
);
|
||||
assert_true(
|
||||
assert_compare_gt(
|
||||
this.root.get_child("b").get_child("test")
|
||||
.compare_normalized_ci(this.root.get_child("a").get_child("test")) > 0,
|
||||
.compare_normalized_ci(this.root.get_child("a").get_child("test")),
|
||||
"Less than disjoint parents"
|
||||
);
|
||||
|
||||
assert_true(
|
||||
assert_compare_gt(
|
||||
this.root.get_child("a").get_child("test")
|
||||
.compare_normalized_ci(this.root.get_child("a")) > 0,
|
||||
.compare_normalized_ci(this.root.get_child("a")),
|
||||
"Greater than descendant"
|
||||
);
|
||||
assert_true(
|
||||
assert_compare_lt(
|
||||
this.root.get_child("a")
|
||||
.compare_normalized_ci(this.root.get_child("a").get_child("test")) < 0,
|
||||
.compare_normalized_ci(this.root.get_child("a").get_child("test")),
|
||||
"Less than descendant"
|
||||
);
|
||||
}
|
||||
|
||||
public void root_instances_compare() throws GLib.Error {
|
||||
assert_int(
|
||||
0, this.root.compare_to(new FolderRoot(TEST_LABEL, false)),
|
||||
assert_compare_eq(
|
||||
this.root.compare_to(new FolderRoot(TEST_LABEL, false)),
|
||||
"Root equality"
|
||||
);
|
||||
assert_int(
|
||||
0, this.root.get_child("a").compare_to(new FolderRoot(TEST_LABEL, false).get_child("a")),
|
||||
assert_compare_eq(
|
||||
this.root.get_child("a").compare_to(new FolderRoot(TEST_LABEL, false).get_child("a")),
|
||||
"Equal child comparison"
|
||||
);
|
||||
|
||||
assert_true(
|
||||
assert_compare_gt(
|
||||
this.root.get_child("a").compare_to(
|
||||
new FolderRoot("#other", false).get_child("a")) > 0,
|
||||
new FolderRoot("#other", false).get_child("a")),
|
||||
"Root label inequality with children"
|
||||
);
|
||||
|
||||
// a is less than b
|
||||
assert_true(
|
||||
this.root.get_child("a").compare_to(new FolderRoot(TEST_LABEL, false).get_child("b")) < 0,
|
||||
assert_compare_lt(
|
||||
this.root.get_child("a").compare_to(new FolderRoot(TEST_LABEL, false).get_child("b")),
|
||||
"Greater than child comparison"
|
||||
);
|
||||
|
||||
// b is greater than than a
|
||||
assert_true(
|
||||
this.root.get_child("b").compare_to(new FolderRoot(TEST_LABEL, false).get_child("a")) > 0,
|
||||
assert_compare_gt(
|
||||
this.root.get_child("b").compare_to(new FolderRoot(TEST_LABEL, false).get_child("a")),
|
||||
"Less than child comparison"
|
||||
);
|
||||
|
||||
assert_true(
|
||||
assert_compare_gt(
|
||||
this.root.get_child("a").get_child("test")
|
||||
.compare_to(new FolderRoot(TEST_LABEL, false).get_child("a")) > 0,
|
||||
.compare_to(new FolderRoot(TEST_LABEL, false).get_child("a")),
|
||||
"Greater than descendant"
|
||||
);
|
||||
assert_true(
|
||||
|
|
@ -310,20 +305,20 @@ public class Geary.FolderPathTest : TestCase {
|
|||
"Less than descendant"
|
||||
);
|
||||
|
||||
assert_true(
|
||||
assert_compare_eq(
|
||||
this.root.get_child("a").get_child("b")
|
||||
.compare_to(new FolderRoot(TEST_LABEL, false).get_child("a").get_child("b")) == 0,
|
||||
.compare_to(new FolderRoot(TEST_LABEL, false).get_child("a").get_child("b")),
|
||||
"N-path equality"
|
||||
);
|
||||
|
||||
assert_true(
|
||||
assert_compare_lt(
|
||||
this.root.get_child("a").get_child("a")
|
||||
.compare_to(new FolderRoot(TEST_LABEL, false).get_child("b").get_child("b")) < 0,
|
||||
.compare_to(new FolderRoot(TEST_LABEL, false).get_child("b").get_child("b")),
|
||||
"Less than double disjoint"
|
||||
);
|
||||
assert_true(
|
||||
assert_compare_gt(
|
||||
this.root.get_child("b").get_child("a")
|
||||
.compare_to(new FolderRoot(TEST_LABEL, false).get_child("a").get_child("a")) > 0,
|
||||
.compare_to(new FolderRoot(TEST_LABEL, false).get_child("a").get_child("a")),
|
||||
"Greater than double disjoint"
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -15,18 +15,18 @@ class Geary.TlsNegotiationMethodTest : TestCase {
|
|||
}
|
||||
|
||||
public void to_value() throws GLib.Error {
|
||||
assert_string("start-tls", TlsNegotiationMethod.START_TLS.to_value());
|
||||
assert_equal(TlsNegotiationMethod.START_TLS.to_value(), "start-tls");
|
||||
}
|
||||
|
||||
public void for_value() throws GLib.Error {
|
||||
assert_int(
|
||||
TlsNegotiationMethod.START_TLS,
|
||||
TlsNegotiationMethod.for_value("start-tls"),
|
||||
assert_equal(
|
||||
TlsNegotiationMethod.for_value("start-tls").to_string(),
|
||||
TlsNegotiationMethod.START_TLS.to_string(),
|
||||
"start-tls"
|
||||
);
|
||||
assert_int(
|
||||
TlsNegotiationMethod.START_TLS,
|
||||
TlsNegotiationMethod.for_value("Start-TLS"),
|
||||
assert_equal(
|
||||
TlsNegotiationMethod.for_value("Start-TLS").to_string(),
|
||||
TlsNegotiationMethod.START_TLS.to_string(),
|
||||
"Start-TLS"
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ class Geary.App.ConversationMonitorTest : TestCase {
|
|||
this.base_folder, Email.Field.NONE, 10
|
||||
);
|
||||
|
||||
ExpectedCall open = this.base_folder
|
||||
ValaUnit.ExpectedCall open = this.base_folder
|
||||
.expect_call("open_async")
|
||||
.throws(new EngineError.SERVER_UNAVAILABLE("Mock error"));
|
||||
|
||||
|
|
@ -129,7 +129,7 @@ class Geary.App.ConversationMonitorTest : TestCase {
|
|||
this.base_folder, Email.Field.NONE, 10
|
||||
);
|
||||
|
||||
ExpectedCall open = this.base_folder
|
||||
ValaUnit.ExpectedCall open = this.base_folder
|
||||
.expect_call("open_async")
|
||||
.async_call(PAUSE)
|
||||
.throws(new GLib.IOError.CANCELLED("Mock error"));
|
||||
|
|
@ -137,10 +137,10 @@ class Geary.App.ConversationMonitorTest : TestCase {
|
|||
.expect_call("close_async")
|
||||
.throws(new EngineError.ALREADY_CLOSED("Mock error"));
|
||||
|
||||
var start_waiter = new AsyncResultWaiter(this.main_loop);
|
||||
var start_waiter = new ValaUnit.AsyncResultWaiter(this.main_loop);
|
||||
monitor.start_monitoring.begin(NONE, null, start_waiter.async_completion);
|
||||
|
||||
var stop_waiter = new AsyncResultWaiter(this.main_loop);
|
||||
var stop_waiter = new ValaUnit.AsyncResultWaiter(this.main_loop);
|
||||
monitor.stop_monitoring.begin(null, stop_waiter.async_completion);
|
||||
|
||||
open.async_resume();
|
||||
|
|
@ -161,7 +161,7 @@ class Geary.App.ConversationMonitorTest : TestCase {
|
|||
this.base_folder, Email.Field.NONE, 10
|
||||
);
|
||||
|
||||
ExpectedCall open = this.base_folder
|
||||
ValaUnit.ExpectedCall open = this.base_folder
|
||||
.expect_call("open_async")
|
||||
.throws(new EngineError.SERVER_UNAVAILABLE("Mock error"));
|
||||
this.base_folder
|
||||
|
|
@ -191,9 +191,9 @@ class Geary.App.ConversationMonitorTest : TestCase {
|
|||
|
||||
ConversationMonitor monitor = setup_monitor({e1}, paths);
|
||||
|
||||
assert_int(1, monitor.size, "Conversation count");
|
||||
assert_equal<int?>(monitor.size, 1, "Conversation count");
|
||||
assert_non_null(monitor.window_lowest, "Lowest window id");
|
||||
assert_equal(e1.id, monitor.window_lowest, "Lowest window id");
|
||||
assert_equal(monitor.window_lowest, e1.id, "Lowest window id");
|
||||
|
||||
Conversation c1 = Collection.first(monitor.read_only_view);
|
||||
assert_equal(e1, c1.get_email_by_id(e1.id), "Email not present in conversation");
|
||||
|
|
@ -212,9 +212,9 @@ class Geary.App.ConversationMonitorTest : TestCase {
|
|||
|
||||
ConversationMonitor monitor = setup_monitor({e3, e2, e1}, paths);
|
||||
|
||||
assert_int(3, monitor.size, "Conversation count");
|
||||
assert_equal<int?>(monitor.size, 3, "Conversation count");
|
||||
assert_non_null(monitor.window_lowest, "Lowest window id");
|
||||
assert_equal(e1.id, monitor.window_lowest, "Lowest window id");
|
||||
assert_equal(monitor.window_lowest, e1.id, "Lowest window id");
|
||||
}
|
||||
|
||||
public void load_related_message() throws Error {
|
||||
|
|
@ -233,13 +233,13 @@ class Geary.App.ConversationMonitorTest : TestCase {
|
|||
|
||||
ConversationMonitor monitor = setup_monitor({e2}, paths, {related_paths});
|
||||
|
||||
assert_int(1, monitor.size, "Conversation count");
|
||||
assert_equal<int?>(monitor.size, 1, "Conversation count");
|
||||
assert_non_null(monitor.window_lowest, "Lowest window id");
|
||||
assert_equal(e2.id, monitor.window_lowest, "Lowest window id");
|
||||
assert_equal(monitor.window_lowest, e2.id, "Lowest window id");
|
||||
|
||||
Conversation c1 = Collection.first(monitor.read_only_view);
|
||||
assert_equal(e1, c1.get_email_by_id(e1.id), "Related email not present in conversation");
|
||||
assert_equal(e2, c1.get_email_by_id(e2.id), "In folder not present in conversation");
|
||||
assert_equal(c1.get_email_by_id(e1.id), e1, "Related email not present in conversation");
|
||||
assert_equal(c1.get_email_by_id(e2.id), e2, "In folder not present in conversation");
|
||||
}
|
||||
|
||||
public void base_folder_message_appended() throws Error {
|
||||
|
|
@ -250,7 +250,7 @@ class Geary.App.ConversationMonitorTest : TestCase {
|
|||
paths.set(e1.id, this.base_folder.path);
|
||||
|
||||
ConversationMonitor monitor = setup_monitor();
|
||||
assert_int(0, monitor.size, "Initial conversation count");
|
||||
assert_equal<int?>(monitor.size, 0, "Initial conversation count");
|
||||
|
||||
this.base_folder.expect_call("list_email_by_sparse_id_async")
|
||||
.returns_object(new Gee.ArrayList<Email>.wrap({e1}));
|
||||
|
|
@ -269,7 +269,7 @@ class Geary.App.ConversationMonitorTest : TestCase {
|
|||
this.base_folder.assert_expectations();
|
||||
this.account.assert_expectations();
|
||||
|
||||
assert_int(1, monitor.size, "Conversation count");
|
||||
assert_equal<int?>(monitor.size, 1, "Conversation count");
|
||||
}
|
||||
|
||||
public void base_folder_message_removed() throws Error {
|
||||
|
|
@ -291,17 +291,17 @@ class Geary.App.ConversationMonitorTest : TestCase {
|
|||
ConversationMonitor monitor = setup_monitor(
|
||||
{e3, e2}, paths, {null, e2_related_paths}
|
||||
);
|
||||
assert_int(2, monitor.size, "Initial conversation count");
|
||||
assert_equal(e2.id, monitor.window_lowest, "Lowest window id");
|
||||
assert_equal<int?>(monitor.size, 2, "Initial conversation count");
|
||||
assert_equal(monitor.window_lowest, e2.id, "Lowest window id");
|
||||
|
||||
this.base_folder.email_removed(new Gee.ArrayList<EmailIdentifier>.wrap({e2.id}));
|
||||
wait_for_signal(monitor, "conversations-removed");
|
||||
assert_int(1, monitor.size, "Conversation count");
|
||||
assert_equal(e3.id, monitor.window_lowest, "Lowest window id");
|
||||
assert_equal<int?>(monitor.size, 1, "Conversation count");
|
||||
assert_equal(monitor.window_lowest, e3.id, "Lowest window id");
|
||||
|
||||
this.base_folder.email_removed(new Gee.ArrayList<EmailIdentifier>.wrap({e3.id}));
|
||||
wait_for_signal(monitor, "conversations-removed");
|
||||
assert_int(0, monitor.size, "Conversation count");
|
||||
assert_equal<int?>(monitor.size, 0, "Conversation count");
|
||||
assert_null(monitor.window_lowest, "Lowest window id");
|
||||
|
||||
// Close the monitor to cancel the final load so it does not
|
||||
|
|
@ -330,7 +330,7 @@ class Geary.App.ConversationMonitorTest : TestCase {
|
|||
related_paths.set(e3, this.other_folder.path);
|
||||
|
||||
ConversationMonitor monitor = setup_monitor({e1}, paths);
|
||||
assert_int(1, monitor.size, "Initial conversation count");
|
||||
assert_equal<int?>(monitor.size, 1, "Initial conversation count");
|
||||
|
||||
this.other_folder.expect_call("open_async");
|
||||
this.other_folder.expect_call("list_email_by_sparse_id_async")
|
||||
|
|
@ -389,11 +389,11 @@ class Geary.App.ConversationMonitorTest : TestCase {
|
|||
this.other_folder.assert_expectations();
|
||||
this.account.assert_expectations();
|
||||
|
||||
assert_int(1, monitor.size, "Conversation count");
|
||||
assert_equal<int?>(monitor.size, 1, "Conversation count");
|
||||
|
||||
Conversation c1 = Collection.first(monitor.read_only_view);
|
||||
assert_int(2, c1.get_count(), "Conversation message count");
|
||||
assert_equal(e3, c1.get_email_by_id(e3.id),
|
||||
assert_equal<int?>(c1.get_count(), 2, "Conversation message count");
|
||||
assert_equal(c1.get_email_by_id(e3.id), e3,
|
||||
"Appended email not present in conversation");
|
||||
}
|
||||
|
||||
|
|
@ -405,7 +405,7 @@ class Geary.App.ConversationMonitorTest : TestCase {
|
|||
paths.set(e1.id, this.base_folder.path);
|
||||
|
||||
ConversationMonitor monitor = setup_monitor({e1}, paths);
|
||||
assert_int(1, monitor.size, "Conversation count");
|
||||
assert_equal<int?>(monitor.size, 1, "Conversation count");
|
||||
|
||||
// Mark message as deleted
|
||||
Gee.HashMap<EmailIdentifier,EmailFlags> flags_changed =
|
||||
|
|
@ -418,7 +418,10 @@ class Geary.App.ConversationMonitorTest : TestCase {
|
|||
|
||||
wait_for_signal(monitor, "email-flags-changed");
|
||||
|
||||
assert_int(0, monitor.size, "Conversation count should now be zero after being marked deleted.");
|
||||
assert_equal<int?>(
|
||||
monitor.size, 0,
|
||||
"Conversation count should now be zero after being marked deleted."
|
||||
);
|
||||
}
|
||||
|
||||
private Email setup_email(int id, Email? references = null) {
|
||||
|
|
@ -465,7 +468,7 @@ class Geary.App.ConversationMonitorTest : TestCase {
|
|||
*/
|
||||
|
||||
this.base_folder.expect_call("open_async");
|
||||
ExpectedCall list_call = this.base_folder
|
||||
ValaUnit.ExpectedCall list_call = this.base_folder
|
||||
.expect_call("list_email_by_id_async")
|
||||
.returns_object(new Gee.ArrayList<Email>.wrap(base_folder_email));
|
||||
|
||||
|
|
@ -491,7 +494,7 @@ class Geary.App.ConversationMonitorTest : TestCase {
|
|||
bool found_related = false;
|
||||
Gee.Set<RFC822.MessageID> seen_ids = new Gee.HashSet<RFC822.MessageID>();
|
||||
foreach (Email base_email in base_folder_email) {
|
||||
ExpectedCall call =
|
||||
ValaUnit.ExpectedCall call =
|
||||
this.account.expect_call("local_search_message_id_async");
|
||||
seen_ids.add(base_email.message_id);
|
||||
if (has_related && related_paths[base_i] != null) {
|
||||
|
|
@ -531,7 +534,7 @@ class Geary.App.ConversationMonitorTest : TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
ExpectedCall contains =
|
||||
ValaUnit.ExpectedCall contains =
|
||||
this.account.expect_call("get_containing_folders_async");
|
||||
if (paths != null) {
|
||||
contains.returns_object(paths);
|
||||
|
|
|
|||
|
|
@ -469,11 +469,11 @@ class Geary.App.ConversationSetTest : TestCase {
|
|||
this.base_folder.path, ids, removed, trimmed
|
||||
);
|
||||
|
||||
assert_int(0, this.test.size, "ConversationSet size");
|
||||
assert_int(0, this.test.get_email_count(), "ConversationSet email size");
|
||||
assert_equal(this.test.size, 0, "ConversationSet size");
|
||||
assert_equal(this.test.get_email_count(), 0, "ConversationSet email size");
|
||||
|
||||
assert_int(1, removed.size, "Removed size");
|
||||
assert_int(0, trimmed.size, "Trimmed size");
|
||||
assert_collection(removed, "Removed size").size(1);
|
||||
assert_equal(trimmed.size, 0, "Trimmed size");
|
||||
}
|
||||
|
||||
private Email setup_email(int id, Email? references = null) {
|
||||
|
|
|
|||
|
|
@ -160,9 +160,9 @@ class Geary.App.ConversationTest : TestCase {
|
|||
Geary.Email e2 = setup_email(2);
|
||||
this.test.add(e2, singleton(other_path));
|
||||
|
||||
assert_int(
|
||||
2, this.test.get_emails(Conversation.Ordering.NONE).size
|
||||
);
|
||||
assert_collection(
|
||||
this.test.get_emails(Conversation.Ordering.NONE)
|
||||
).size(2);
|
||||
}
|
||||
|
||||
public void get_emails_by_location() throws GLib.Error {
|
||||
|
|
@ -173,31 +173,15 @@ class Geary.App.ConversationTest : TestCase {
|
|||
Geary.Email e2 = setup_email(2);
|
||||
this.test.add(e2, singleton(other_path));
|
||||
|
||||
assert_int(
|
||||
1, this.test.get_emails(Conversation.Ordering.NONE,
|
||||
Conversation.Location.IN_FOLDER).size,
|
||||
"Unexpected in-folder size"
|
||||
);
|
||||
assert_equal(
|
||||
e1,
|
||||
traverse(this.test.get_emails(Conversation.Ordering.NONE,
|
||||
Conversation.Location.IN_FOLDER))
|
||||
.first(),
|
||||
assert_collection(
|
||||
this.test.get_emails(NONE, IN_FOLDER),
|
||||
"Unexpected in-folder element"
|
||||
);
|
||||
).size(1).contains(e1);
|
||||
|
||||
assert_int(
|
||||
1, this.test.get_emails(Conversation.Ordering.NONE,
|
||||
Conversation.Location.OUT_OF_FOLDER).size,
|
||||
"Unexpected out-of-folder size"
|
||||
);
|
||||
assert_equal(
|
||||
e2,
|
||||
traverse(this.test.get_emails(Conversation.Ordering.NONE,
|
||||
Conversation.Location.OUT_OF_FOLDER))
|
||||
.first(),
|
||||
assert_collection(
|
||||
this.test.get_emails(NONE, OUT_OF_FOLDER),
|
||||
"Unexpected out-of-folder element"
|
||||
);
|
||||
).size(1).contains(e2);
|
||||
}
|
||||
|
||||
public void get_emails_blacklist() throws GLib.Error {
|
||||
|
|
@ -211,39 +195,17 @@ class Geary.App.ConversationTest : TestCase {
|
|||
Gee.Collection<FolderPath> blacklist = new Gee.ArrayList<FolderPath>();
|
||||
|
||||
blacklist.add(other_path);
|
||||
assert_int(
|
||||
1, this.test.get_emails(Conversation.Ordering.NONE,
|
||||
Conversation.Location.ANYWHERE,
|
||||
blacklist
|
||||
).size,
|
||||
"Unexpected other blacklist size"
|
||||
);
|
||||
assert_equal(
|
||||
e1,
|
||||
traverse(this.test.get_emails(Conversation.Ordering.NONE,
|
||||
Conversation.Location.ANYWHERE,
|
||||
blacklist)
|
||||
).first(),
|
||||
assert_collection(
|
||||
this.test.get_emails(NONE, ANYWHERE, blacklist),
|
||||
"Unexpected other blacklist element"
|
||||
);
|
||||
).size(1).contains(e1);
|
||||
|
||||
blacklist.clear();
|
||||
blacklist.add(this.base_folder.path);
|
||||
assert_int(
|
||||
1, this.test.get_emails(Conversation.Ordering.NONE,
|
||||
Conversation.Location.ANYWHERE,
|
||||
blacklist
|
||||
).size,
|
||||
"Unexpected other blacklist size"
|
||||
);
|
||||
assert_equal(
|
||||
e2,
|
||||
traverse(this.test.get_emails(Conversation.Ordering.NONE,
|
||||
Conversation.Location.ANYWHERE,
|
||||
blacklist)
|
||||
).first(),
|
||||
assert_collection(
|
||||
this.test.get_emails(NONE, ANYWHERE, blacklist),
|
||||
"Unexpected other blacklist element"
|
||||
);
|
||||
).size(1).contains(e2);
|
||||
}
|
||||
|
||||
public void get_emails_marked_for_deletion() throws GLib.Error {
|
||||
|
|
@ -251,25 +213,24 @@ class Geary.App.ConversationTest : TestCase {
|
|||
e1.set_flags(new Geary.EmailFlags.with(Geary.EmailFlags.DELETED));
|
||||
this.test.add(e1, singleton(this.base_folder.path));
|
||||
|
||||
assert_int(
|
||||
0, this.test.get_emails(Conversation.Ordering.NONE,
|
||||
Conversation.Location.ANYWHERE
|
||||
).size,
|
||||
assert_collection(
|
||||
this.test.get_emails(NONE, ANYWHERE),
|
||||
"Message marked for deletion still present in conversation"
|
||||
);
|
||||
).is_empty();
|
||||
}
|
||||
|
||||
public void count_email_in_folder() throws GLib.Error {
|
||||
Geary.Email e1 = setup_email(1);
|
||||
this.test.add(e1, singleton(this.base_folder.path));
|
||||
|
||||
assert_uint(
|
||||
1, this.test.get_count_in_folder(this.base_folder.path),
|
||||
assert_equal<uint?>(
|
||||
this.test.get_count_in_folder(this.base_folder.path),
|
||||
1,
|
||||
"In-folder count"
|
||||
);
|
||||
assert_uint(
|
||||
0,
|
||||
assert_equal<uint?>(
|
||||
this.test.get_count_in_folder(this.folder_root.get_child("other")),
|
||||
0,
|
||||
"Out-folder count"
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,9 @@
|
|||
* (version 2.1 or later). See the COPYING file in this distribution.
|
||||
*/
|
||||
|
||||
internal class Geary.MockContactHarvester : ContactHarvester, GLib.Object {
|
||||
internal class Geary.MockContactHarvester :
|
||||
Geary.BaseObject,
|
||||
ContactHarvester {
|
||||
|
||||
public async void harvest_from_email(Gee.Collection<Email> messages,
|
||||
GLib.Cancellable? cancellable)
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ class Geary.ContactHarvesterImplTest : TestCase {
|
|||
this.senders
|
||||
);
|
||||
this.store.expect_call("get_by_rfc822");
|
||||
ExpectedCall update_call = this.store.expect_call("update_contacts");
|
||||
ValaUnit.ExpectedCall update_call = this.store.expect_call("update_contacts");
|
||||
this.email.set_receivers(
|
||||
new RFC822.MailboxAddresses.single(this.test_address), null, null
|
||||
);
|
||||
|
|
@ -70,13 +70,13 @@ class Geary.ContactHarvesterImplTest : TestCase {
|
|||
this.store.assert_expectations();
|
||||
|
||||
Gee.Collection<Contact> contacts = update_call.called_arg<Gee.Collection<Contact>>(0);
|
||||
assert_int(1, contacts.size, "contacts length");
|
||||
assert_collection(contacts).size(1);
|
||||
Contact? created = Collection.first(contacts) as Contact;
|
||||
assert_non_null(created, "contacts contents");
|
||||
|
||||
assert_string("Test", created.real_name);
|
||||
assert_string("test@example.com", created.email);
|
||||
assert_string("test@example.com", created.normalized_email);
|
||||
assert_equal(created.real_name, "Test");
|
||||
assert_equal(created.email, "test@example.com");
|
||||
assert_equal(created.normalized_email, "test@example.com");
|
||||
}
|
||||
|
||||
public void blacklisted_folder_type() throws GLib.Error {
|
||||
|
|
@ -103,7 +103,7 @@ class Geary.ContactHarvesterImplTest : TestCase {
|
|||
this.senders
|
||||
);
|
||||
this.store.expect_call("get_by_rfc822");
|
||||
ExpectedCall update_call = this.store.expect_call("update_contacts");
|
||||
ValaUnit.ExpectedCall update_call = this.store.expect_call("update_contacts");
|
||||
this.email.set_receivers(
|
||||
new RFC822.MailboxAddresses.single(this.test_address), null, null
|
||||
);
|
||||
|
|
@ -116,9 +116,9 @@ class Geary.ContactHarvesterImplTest : TestCase {
|
|||
|
||||
Gee.Collection<Contact> contacts = update_call.called_arg<Gee.Collection<Contact>>(0);
|
||||
Contact? created = Collection.first(contacts) as Contact;
|
||||
assert_int(
|
||||
Contact.Importance.SEEN,
|
||||
assert_equal<int?>(
|
||||
created.highest_importance,
|
||||
Contact.Importance.SEEN,
|
||||
"call contact importance"
|
||||
);
|
||||
}
|
||||
|
|
@ -130,7 +130,7 @@ class Geary.ContactHarvesterImplTest : TestCase {
|
|||
this.senders
|
||||
);
|
||||
this.store.expect_call("get_by_rfc822");
|
||||
ExpectedCall update_call = this.store.expect_call("update_contacts");
|
||||
ValaUnit.ExpectedCall update_call = this.store.expect_call("update_contacts");
|
||||
this.email.set_receivers(
|
||||
new RFC822.MailboxAddresses.single(this.test_address), null, null
|
||||
);
|
||||
|
|
@ -143,9 +143,9 @@ class Geary.ContactHarvesterImplTest : TestCase {
|
|||
|
||||
Gee.Collection<Contact> contacts = update_call.called_arg<Gee.Collection<Contact>>(0);
|
||||
Contact? created = Collection.first(contacts) as Contact;
|
||||
assert_int(
|
||||
Contact.Importance.SENT_TO,
|
||||
assert_equal<int?>(
|
||||
created.highest_importance,
|
||||
Contact.Importance.SENT_TO,
|
||||
"call contact importance"
|
||||
);
|
||||
}
|
||||
|
|
@ -157,7 +157,7 @@ class Geary.ContactHarvesterImplTest : TestCase {
|
|||
this.senders
|
||||
);
|
||||
this.store.expect_call("get_by_rfc822");
|
||||
ExpectedCall update_call = this.store.expect_call("update_contacts");
|
||||
ValaUnit.ExpectedCall update_call = this.store.expect_call("update_contacts");
|
||||
this.email.set_receivers(
|
||||
new RFC822.MailboxAddresses.single(this.sender_address), null, null
|
||||
);
|
||||
|
|
@ -170,9 +170,9 @@ class Geary.ContactHarvesterImplTest : TestCase {
|
|||
|
||||
Gee.Collection<Contact> contacts = update_call.called_arg<Gee.Collection<Contact>>(0);
|
||||
Contact? created = Collection.first(contacts) as Contact;
|
||||
assert_int(
|
||||
Contact.Importance.RECEIVED_FROM,
|
||||
assert_equal<int?>(
|
||||
created.highest_importance,
|
||||
Contact.Importance.RECEIVED_FROM,
|
||||
"call contact importance"
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,10 +83,10 @@ class Geary.ContactStoreImplTest : TestCase {
|
|||
);
|
||||
Contact? existing = test_article.get_by_rfc822.end(async_result());
|
||||
assert_non_null(existing, "Existing contact");
|
||||
assert_string("Test@example.com", existing.email, "Existing email");
|
||||
assert_string("test@example.com", existing.normalized_email, "Existing normalized_email");
|
||||
assert_string("Test Name", existing.real_name, "Existing real_name");
|
||||
assert_int(50, existing.highest_importance, "Existing highest_importance");
|
||||
assert_equal(existing.email, "Test@example.com", "Existing email");
|
||||
assert_equal(existing.normalized_email, "test@example.com", "Existing normalized_email");
|
||||
assert_equal(existing.real_name, "Test Name", "Existing real_name");
|
||||
assert_equal<int?>(existing.highest_importance, 50, "Existing highest_importance");
|
||||
assert_false(existing.flags.always_load_remote_images(), "Existing flags");
|
||||
|
||||
test_article.get_by_rfc822.begin(
|
||||
|
|
@ -109,7 +109,7 @@ class Geary.ContactStoreImplTest : TestCase {
|
|||
Gee.Collection<Contact> results = test_article.search.end(
|
||||
async_result()
|
||||
);
|
||||
assert_int(0, results.size);
|
||||
assert_equal(results.size, 0);
|
||||
}
|
||||
|
||||
public void search_email_match() throws GLib.Error {
|
||||
|
|
@ -123,13 +123,13 @@ class Geary.ContactStoreImplTest : TestCase {
|
|||
Gee.Collection<Contact> results = test_article.search.end(
|
||||
async_result()
|
||||
);
|
||||
assert_int(1, results.size, "results.size");
|
||||
assert_equal<int?>(results.size, 1, "results.size");
|
||||
|
||||
Contact search_hit = Collection.first(results);
|
||||
assert_string("Test@example.com", search_hit.email, "Existing email");
|
||||
assert_string("test@example.com", search_hit.normalized_email, "Existing normalized_email");
|
||||
assert_string("Test Name", search_hit.real_name, "Existing real_name");
|
||||
assert_int(50, search_hit.highest_importance, "Existing highest_importance");
|
||||
assert_equal(search_hit.email, "Test@example.com", "Existing email");
|
||||
assert_equal(search_hit.normalized_email, "test@example.com", "Existing normalized_email");
|
||||
assert_equal(search_hit.real_name, "Test Name", "Existing real_name");
|
||||
assert_equal<int?>(search_hit.highest_importance, 50, "Existing highest_importance");
|
||||
assert_false(search_hit.flags.always_load_remote_images(), "Existing flags");
|
||||
}
|
||||
|
||||
|
|
@ -144,13 +144,13 @@ class Geary.ContactStoreImplTest : TestCase {
|
|||
Gee.Collection<Contact> results = test_article.search.end(
|
||||
async_result()
|
||||
);
|
||||
assert_int(1, results.size, "results.size");
|
||||
assert_equal<int?>(results.size, 1, "results.size");
|
||||
|
||||
Contact search_hit = Collection.first(results);
|
||||
assert_string("Test@example.com", search_hit.email, "Existing email");
|
||||
assert_string("test@example.com", search_hit.normalized_email, "Existing normalized_email");
|
||||
assert_string("Test Name", search_hit.real_name, "Existing real_name");
|
||||
assert_int(50, search_hit.highest_importance, "Existing highest_importance");
|
||||
assert_equal(search_hit.email, "Test@example.com", "Existing email");
|
||||
assert_equal(search_hit.normalized_email, "test@example.com", "Existing normalized_email");
|
||||
assert_equal(search_hit.real_name, "Test Name", "Existing real_name");
|
||||
assert_equal<int?>(search_hit.highest_importance, 50, "Existing highest_importance");
|
||||
assert_false(search_hit.flags.always_load_remote_images(), "Existing flags");
|
||||
}
|
||||
|
||||
|
|
@ -178,10 +178,10 @@ class Geary.ContactStoreImplTest : TestCase {
|
|||
Gee.Collection<Contact> results = test_article.search.end(
|
||||
async_result()
|
||||
);
|
||||
assert_int(1, results.size, "results.size");
|
||||
assert_equal<int?>(results.size, 1, "results.size");
|
||||
|
||||
Contact search_hit = Collection.first(results);
|
||||
assert_string("Germán", search_hit.real_name, "Existing real_name");
|
||||
assert_equal(search_hit.real_name, "Germán", "Existing real_name");
|
||||
}
|
||||
|
||||
public void search_utf8_multi_byte_names() throws GLib.Error {
|
||||
|
|
@ -209,10 +209,10 @@ class Geary.ContactStoreImplTest : TestCase {
|
|||
Gee.Collection<Contact> results = test_article.search.end(
|
||||
async_result()
|
||||
);
|
||||
assert_int(1, results.size, "results.size");
|
||||
assert_equal<int?>(results.size, 1, "results.size");
|
||||
|
||||
Contact search_hit = Collection.first(results);
|
||||
assert_string("年収1億円目指せ", search_hit.real_name, "Existing real_name");
|
||||
assert_equal(search_hit.real_name, "年収1億円目指せ", "Existing real_name");
|
||||
}
|
||||
|
||||
public void update_new_contact() throws GLib.Error {
|
||||
|
|
@ -237,10 +237,10 @@ class Geary.ContactStoreImplTest : TestCase {
|
|||
);
|
||||
Contact? persisted = test_article.get_by_rfc822.end(async_result());
|
||||
assert_non_null(persisted, "persisted");
|
||||
assert_string("New@example.com", persisted.email, "Persisted email");
|
||||
assert_string("new@example.com", persisted.normalized_email, "Persisted normalized_email");
|
||||
assert_string("New", persisted.real_name, "Persisted real_name");
|
||||
assert_int(0, persisted.highest_importance, "Persisted highest_importance");
|
||||
assert_equal(persisted.email, "New@example.com", "Persisted email");
|
||||
assert_equal(persisted.normalized_email, "new@example.com", "Persisted normalized_email");
|
||||
assert_equal(persisted.real_name, "New", "Persisted real_name");
|
||||
assert_equal<int?>(persisted.highest_importance, 0, "Persisted highest_importance");
|
||||
assert_true(persisted.flags.always_load_remote_images(), "Persisted real_name");
|
||||
}
|
||||
|
||||
|
|
@ -265,10 +265,10 @@ class Geary.ContactStoreImplTest : TestCase {
|
|||
);
|
||||
Contact? updated = test_article.get_by_rfc822.end(async_result());
|
||||
assert_non_null(updated, "updated");
|
||||
assert_string("Test@example.com", updated.email, "Updated email");
|
||||
assert_string("test@example.com", updated.normalized_email, "Updated normalized_email");
|
||||
assert_string("Updated", updated.real_name, "Updated real_name");
|
||||
assert_int(100, updated.highest_importance, "Updated highest_importance");
|
||||
assert_equal(updated.email, "Test@example.com", "Updated email");
|
||||
assert_equal(updated.normalized_email, "test@example.com", "Updated normalized_email");
|
||||
assert_equal(updated.real_name, "Updated", "Updated real_name");
|
||||
assert_equal<int?>(updated.highest_importance, 100, "Updated highest_importance");
|
||||
assert_true(updated.flags.always_load_remote_images(), "Added flags");
|
||||
|
||||
// Now try removing the flag and ensure it sticks
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class Geary.Db.VersionedDatabaseTest : TestCase {
|
|||
|
||||
Geary.Db.Result result = db.query("SELECT * FROM TestTable;");
|
||||
assert_false(result.finished, "Row not inserted");
|
||||
assert_string("value", result.string_for("col"));
|
||||
assert_equal(result.string_for("col"), "value");
|
||||
assert_false(result.next(), "Multiple rows inserted");
|
||||
|
||||
db.file.delete();
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ class Geary.ImapDB.AccountTest : TestCase {
|
|||
"SELECT * FROM FolderTable;"
|
||||
);
|
||||
assert_false(result.finished, "Folder not created");
|
||||
assert_string("test", result.string_for("name"), "Folder name");
|
||||
assert_equal(result.string_for("name"), "test", "Folder name");
|
||||
assert_true(result.is_null_for("parent_id"), "Folder parent");
|
||||
assert_false(result.next(), "Multiple rows inserted");
|
||||
}
|
||||
|
|
@ -138,8 +138,8 @@ class Geary.ImapDB.AccountTest : TestCase {
|
|||
"SELECT * FROM FolderTable WHERE id != 1;"
|
||||
);
|
||||
assert_false(result.finished, "Folder not created");
|
||||
assert_string("child", result.string_for("name"), "Folder name");
|
||||
assert_int(1, result.int_for("parent_id"), "Folder parent");
|
||||
assert_equal(result.string_for("name"), "child", "Folder name");
|
||||
assert_equal<int?>(result.int_for("parent_id"), 1, "Folder parent");
|
||||
assert_false(result.next(), "Multiple rows inserted");
|
||||
}
|
||||
|
||||
|
|
@ -161,8 +161,8 @@ class Geary.ImapDB.AccountTest : TestCase {
|
|||
this.account.list_folders_async.end(async_result());
|
||||
|
||||
Folder test1 = traverse(result).first();
|
||||
assert_int(1, result.size, "Base folder not listed");
|
||||
assert_string("test1", test1.get_path().name, "Base folder name");
|
||||
assert_equal<int?>(result.size, 1, "Base folder not listed");
|
||||
assert_equal(test1.get_path().name, "test1", "Base folder name");
|
||||
|
||||
this.account.list_folders_async.begin(
|
||||
test1.get_path(),
|
||||
|
|
@ -172,8 +172,8 @@ class Geary.ImapDB.AccountTest : TestCase {
|
|||
result = this.account.list_folders_async.end(async_result());
|
||||
|
||||
Folder test2 = traverse(result).first();
|
||||
assert_int(1, result.size, "Child folder not listed");
|
||||
assert_string("test2", test2.get_path().name, "Child folder name");
|
||||
assert_equal<int?>(result.size, 1, "Child folder not listed");
|
||||
assert_equal(test2.get_path().name, "test2", "Child folder name");
|
||||
|
||||
this.account.list_folders_async.begin(
|
||||
test2.get_path(),
|
||||
|
|
@ -183,8 +183,8 @@ class Geary.ImapDB.AccountTest : TestCase {
|
|||
result = this.account.list_folders_async.end(async_result());
|
||||
|
||||
Folder test3 = traverse(result).first();
|
||||
assert_int(1, result.size, "Grandchild folder not listed");
|
||||
assert_string("test3", test3.get_path().name, "Grandchild folder name");
|
||||
assert_equal<int?>(result.size, 1, "Grandchild folder not listed");
|
||||
assert_equal(test3.get_path().name, "test3", "Grandchild folder name");
|
||||
}
|
||||
|
||||
public void delete_folder() throws GLib.Error {
|
||||
|
|
@ -268,7 +268,7 @@ class Geary.ImapDB.AccountTest : TestCase {
|
|||
|
||||
Folder? result = this.account.fetch_folder_async.end(async_result());
|
||||
assert_non_null(result);
|
||||
assert_string("test1", result.get_path().name);
|
||||
assert_equal(result.get_path().name, "test1");
|
||||
}
|
||||
|
||||
public void fetch_child_folder() throws GLib.Error {
|
||||
|
|
@ -287,7 +287,7 @@ class Geary.ImapDB.AccountTest : TestCase {
|
|||
|
||||
Folder? result = this.account.fetch_folder_async.end(async_result());
|
||||
assert_non_null(result);
|
||||
assert_string("test2", result.get_path().name);
|
||||
assert_equal(result.get_path().name, "test2");
|
||||
}
|
||||
|
||||
public void fetch_nonexistent_folder() throws GLib.Error {
|
||||
|
|
@ -336,7 +336,7 @@ class Geary.ImapDB.AccountTest : TestCase {
|
|||
async_result()
|
||||
);
|
||||
|
||||
assert_int(2, result.size, "Not enough email listed");
|
||||
assert_equal<int?>(result.size, 2, "Not enough email listed");
|
||||
assert_true(new EmailIdentifier(1, null).equal_to(result[0].id));
|
||||
assert_true(new EmailIdentifier(2, null).equal_to(result[1].id));
|
||||
|
||||
|
|
|
|||
|
|
@ -26,19 +26,17 @@ class Geary.ImapDB.AttachmentTest : TestCase {
|
|||
Attachment test = new Attachment.from_part(
|
||||
1, new Geary.RFC822.Part(part)
|
||||
);
|
||||
assert_string(
|
||||
Geary.Mime.ContentType.ATTACHMENT_DEFAULT.to_string(),
|
||||
test.content_type.to_string()
|
||||
assert_equal(
|
||||
test.content_type.to_string(),
|
||||
Geary.Mime.ContentType.ATTACHMENT_DEFAULT.to_string()
|
||||
);
|
||||
assert_null_string(test.content_id, "content_id");
|
||||
assert_null_string(test.content_description, "content_description");
|
||||
assert_int(
|
||||
Geary.Mime.DispositionType.UNSPECIFIED,
|
||||
test.content_disposition.disposition_type,
|
||||
"content disposition type"
|
||||
assert_null(test.content_id, "content_id");
|
||||
assert_null(test.content_description, "content_description");
|
||||
assert_equal<Geary.Mime.DispositionType?>(
|
||||
test.content_disposition.disposition_type, UNSPECIFIED
|
||||
);
|
||||
assert_false(test.has_content_filename, "has_content_filename");
|
||||
assert_null_string(test.content_filename, "content_filename");
|
||||
assert_null(test.content_filename, "content_filename");
|
||||
}
|
||||
|
||||
public void new_from_complete_mime_part() throws Error {
|
||||
|
|
@ -61,15 +59,14 @@ class Geary.ImapDB.AttachmentTest : TestCase {
|
|||
1, new Geary.RFC822.Part(part)
|
||||
);
|
||||
|
||||
assert_string(TYPE, test.content_type.to_string());
|
||||
assert_string(ID, test.content_id);
|
||||
assert_string(DESC, test.content_description);
|
||||
assert_int(
|
||||
Geary.Mime.DispositionType.ATTACHMENT,
|
||||
test.content_disposition.disposition_type
|
||||
assert_equal(test.content_type.to_string(), TYPE);
|
||||
assert_equal(test.content_id, ID);
|
||||
assert_equal(test.content_description, DESC);
|
||||
assert_equal<Geary.Mime.DispositionType?>(
|
||||
test.content_disposition.disposition_type, ATTACHMENT
|
||||
);
|
||||
assert_true(test.has_content_filename, "has_content_filename");
|
||||
assert_string(test.content_filename, NAME, "content_filename");
|
||||
assert_equal(NAME, test.content_filename, "content_filename");
|
||||
}
|
||||
|
||||
public void new_from_inline_mime_part() throws Error {
|
||||
|
|
@ -85,9 +82,8 @@ class Geary.ImapDB.AttachmentTest : TestCase {
|
|||
1, new Geary.RFC822.Part(part)
|
||||
);
|
||||
|
||||
assert_int(
|
||||
Geary.Mime.DispositionType.INLINE,
|
||||
test.content_disposition.disposition_type
|
||||
assert_equal<Geary.Mime.DispositionType?>(
|
||||
test.content_disposition.disposition_type, INLINE
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -169,29 +165,29 @@ CREATE TABLE MessageAttachmentTable (
|
|||
null
|
||||
);
|
||||
|
||||
assert_int(1, attachments.size, "No attachment provided");
|
||||
assert_equal<int?>(attachments.size, 1, "No attachment provided");
|
||||
|
||||
Geary.Attachment attachment = attachments[0];
|
||||
assert_non_null(attachment.file, "Attachment file");
|
||||
assert_int(
|
||||
assert_equal<int64?>(
|
||||
attachment.filesize,
|
||||
DECODED_BODY.data.length,
|
||||
(int) attachment.filesize,
|
||||
"Attachment file size"
|
||||
);
|
||||
|
||||
uint8[] buf = new uint8[4096];
|
||||
size_t len = 0;
|
||||
attachments[0].file.read().read_all(buf, out len);
|
||||
assert_string(DECODED_BODY, (string) buf[0:len]);
|
||||
assert_equal((string) buf[0:len], DECODED_BODY);
|
||||
|
||||
Geary.Db.Result result = this.db.query(
|
||||
"SELECT * FROM MessageAttachmentTable;"
|
||||
);
|
||||
assert_false(result.finished, "Row not inserted");
|
||||
assert_int(1, result.int_for("message_id"), "Row message id");
|
||||
assert_int(
|
||||
DECODED_BODY.data.length,
|
||||
assert_equal<int64?>(result.int_for("message_id"), 1, "Row message id");
|
||||
assert_equal<int64?>(
|
||||
result.int_for("filesize"),
|
||||
DECODED_BODY.data.length,
|
||||
"Row file size"
|
||||
);
|
||||
assert_false(result.next(), "Multiple rows inserted");
|
||||
|
|
@ -201,8 +197,7 @@ CREATE TABLE MessageAttachmentTable (
|
|||
const string TYPE = "text/plain";
|
||||
const string ID = "test-id";
|
||||
const string DESCRIPTION = "test description";
|
||||
const Geary.Mime.DispositionType DISPOSITION_TYPE =
|
||||
Geary.Mime.DispositionType.INLINE;
|
||||
const Geary.Mime.DispositionType DISPOSITION_TYPE = INLINE;
|
||||
const string FILENAME = "test.txt";
|
||||
|
||||
GMime.Part part = new_part(TYPE, ENCODED_BODY.data);
|
||||
|
|
@ -224,38 +219,38 @@ CREATE TABLE MessageAttachmentTable (
|
|||
null
|
||||
);
|
||||
|
||||
assert_int(1, attachments.size, "No attachment provided");
|
||||
assert_equal<int?>(attachments.size, 1, "No attachment provided");
|
||||
|
||||
Geary.Attachment attachment = attachments[0];
|
||||
assert_string(TYPE, attachment.content_type.to_string());
|
||||
assert_string(ID, attachment.content_id);
|
||||
assert_string(DESCRIPTION, attachment.content_description);
|
||||
assert_string(FILENAME, attachment.content_filename);
|
||||
assert_int(
|
||||
DISPOSITION_TYPE,
|
||||
assert_equal(attachment.content_type.to_string(), TYPE);
|
||||
assert_equal(attachment.content_id, ID);
|
||||
assert_equal(attachment.content_description, DESCRIPTION);
|
||||
assert_equal(attachment.content_filename, FILENAME);
|
||||
assert_equal<Geary.Mime.DispositionType?>(
|
||||
attachment.content_disposition.disposition_type,
|
||||
DISPOSITION_TYPE,
|
||||
"Attachment disposition type"
|
||||
);
|
||||
|
||||
uint8[] buf = new uint8[4096];
|
||||
size_t len = 0;
|
||||
attachment.file.read().read_all(buf, out len);
|
||||
assert_string(DECODED_BODY, (string) buf[0:len]);
|
||||
assert_equal((string) buf[0:len], DECODED_BODY);
|
||||
|
||||
Geary.Db.Result result = this.db.query(
|
||||
"SELECT * FROM MessageAttachmentTable;"
|
||||
);
|
||||
assert_false(result.finished, "Row not inserted");
|
||||
assert_int(1, result.int_for("message_id"), "Row message id");
|
||||
assert_string(TYPE, result.string_for("mime_type"));
|
||||
assert_string(ID, result.string_for("content_id"));
|
||||
assert_string(DESCRIPTION, result.string_for("description"));
|
||||
assert_int(
|
||||
assert_equal<int64?>(result.int_for("message_id"), 1, "Row message id");
|
||||
assert_equal(result.string_for("mime_type"), TYPE);
|
||||
assert_equal(result.string_for("content_id"), ID);
|
||||
assert_equal(result.string_for("description"), DESCRIPTION);
|
||||
assert_equal<Geary.Mime.DispositionType?>(
|
||||
(Geary.Mime.DispositionType) result.int_for("disposition"),
|
||||
DISPOSITION_TYPE,
|
||||
result.int_for("disposition"),
|
||||
"Row disposition type"
|
||||
);
|
||||
assert_string(FILENAME, result.string_for("filename"));
|
||||
assert_equal(result.string_for("filename"), FILENAME);
|
||||
assert_false(result.next(), "Multiple rows inserted");
|
||||
}
|
||||
|
||||
|
|
@ -285,12 +280,12 @@ abriquent pour te la vendre une =C3=A2me vulgaire.""";
|
|||
null
|
||||
);
|
||||
|
||||
assert_int(1, attachments.size, "No attachment provided");
|
||||
assert_equal<int?>(attachments.size, 1, "No attachment provided");
|
||||
|
||||
uint8[] buf = new uint8[4096];
|
||||
size_t len = 0;
|
||||
attachments[0].file.read().read_all(buf, out len);
|
||||
assert_string(QP_DECODED, (string) buf[0:len]);
|
||||
assert_equal((string) buf[0:len], QP_DECODED);
|
||||
}
|
||||
|
||||
public void list_attachments() throws Error {
|
||||
|
|
@ -310,8 +305,8 @@ VALUES (2, 'text/plain');
|
|||
null
|
||||
);
|
||||
|
||||
assert_int(1, loaded.size, "Expected one row loaded");
|
||||
assert_int(1, (int) loaded[0].message_id, "Unexpected message id");
|
||||
assert_equal<int?>(loaded.size, 1, "Expected one row loaded");
|
||||
assert_equal<int64?>(loaded[0].message_id, 1, "Unexpected message id");
|
||||
}
|
||||
|
||||
public void delete_attachments() throws Error {
|
||||
|
|
@ -343,7 +338,9 @@ VALUES (2, 'text/plain');
|
|||
"SELECT * FROM MessageAttachmentTable;"
|
||||
);
|
||||
assert_false(result.finished);
|
||||
assert_int(2, result.int_for("message_id"), "Unexpected message_id");
|
||||
assert_equal<int64?>(
|
||||
result.int_for("message_id"), 2, "Unexpected message_id"
|
||||
);
|
||||
assert_false(result.next(), "Attachment not deleted from db");
|
||||
|
||||
assert_false(attachments[0].file.query_exists(null),
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
/*
|
||||
* Copyright 2018 Michael Gratton <mike@vee.net>
|
||||
*
|
||||
|
|
@ -106,7 +107,7 @@ class Geary.ImapDB.DatabaseTest : TestCase {
|
|||
);
|
||||
db.open.end(async_result());
|
||||
|
||||
assert_int(26, db.get_schema_version(), "Post-upgrade version");
|
||||
assert_equal<int?>(db.get_schema_version(), 26, "Post-upgrade version");
|
||||
|
||||
// Since schema v22 deletes the re-creates all attachments,
|
||||
// attachment 12 should no longer exist on the file system and
|
||||
|
|
@ -157,7 +158,7 @@ class Geary.ImapDB.DatabaseTest : TestCase {
|
|||
int i = 0;
|
||||
while (!result.finished) {
|
||||
assert_true(i < expected.length, "Too many rows");
|
||||
assert_string(expected[i], result.string_at(0));
|
||||
assert_equal(result.string_at(0), expected[i]);
|
||||
i++;
|
||||
result.next();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,9 +93,9 @@ class Geary.ImapDB.FolderTest : TestCase {
|
|||
Gee.Map<Email,bool> results =
|
||||
this.folder.create_or_merge_email_async.end(async_result());
|
||||
|
||||
assert_int(1, results.size);
|
||||
assert(results.get(mock));
|
||||
assert_int(0, this.folder.get_properties().email_unread);
|
||||
assert_equal<int?>(results.size, 1);
|
||||
assert_true(results.get(mock));
|
||||
assert_equal(this.folder.get_properties().email_unread, 0);
|
||||
}
|
||||
|
||||
public void create_unread_email() throws GLib.Error {
|
||||
|
|
@ -113,9 +113,9 @@ class Geary.ImapDB.FolderTest : TestCase {
|
|||
Gee.Map<Email,bool> results =
|
||||
this.folder.create_or_merge_email_async.end(async_result());
|
||||
|
||||
assert_int(1, results.size);
|
||||
assert(results.get(mock));
|
||||
assert_int(1, this.folder.get_properties().email_unread);
|
||||
assert_equal<int?>(results.size, 1);
|
||||
assert_true(results.get(mock));
|
||||
assert_equal<int?>(this.folder.get_properties().email_unread, 1);
|
||||
}
|
||||
|
||||
public void create_no_unread_update() throws GLib.Error {
|
||||
|
|
@ -133,9 +133,9 @@ class Geary.ImapDB.FolderTest : TestCase {
|
|||
Gee.Map<Email,bool> results =
|
||||
this.folder.create_or_merge_email_async.end(async_result());
|
||||
|
||||
assert_int(1, results.size);
|
||||
assert(results.get(mock));
|
||||
assert_int(0, this.folder.get_properties().email_unread);
|
||||
assert_equal<int?>(results.size, 1);
|
||||
assert_true(results.get(mock));
|
||||
assert_equal<int?>(this.folder.get_properties().email_unread, 0);
|
||||
}
|
||||
|
||||
public void merge_email() throws GLib.Error {
|
||||
|
|
@ -163,8 +163,8 @@ class Geary.ImapDB.FolderTest : TestCase {
|
|||
Gee.Map<Email,bool> results =
|
||||
this.folder.create_or_merge_email_async.end(async_result());
|
||||
|
||||
assert_int(1, results.size);
|
||||
assert(!results.get(mock));
|
||||
assert_equal<int?>(results.size, 1);
|
||||
assert_true(!results.get(mock));
|
||||
|
||||
// Fetch it again to make sure it's been merged using required
|
||||
// fields to check
|
||||
|
|
@ -182,8 +182,8 @@ class Geary.ImapDB.FolderTest : TestCase {
|
|||
assert_no_error(err);
|
||||
}
|
||||
|
||||
assert_string(fixture_to, merged.to.to_string());
|
||||
assert_string(mock_subject, merged.subject.to_string());
|
||||
assert_equal(merged.to.to_string(), fixture_to);
|
||||
assert_equal(merged.subject.to_string(), mock_subject);
|
||||
}
|
||||
|
||||
public void merge_add_flags() throws GLib.Error {
|
||||
|
|
@ -214,8 +214,8 @@ class Geary.ImapDB.FolderTest : TestCase {
|
|||
Gee.Map<Email,bool> results =
|
||||
this.folder.create_or_merge_email_async.end(async_result());
|
||||
|
||||
assert_int(1, results.size);
|
||||
assert(!results.get(test));
|
||||
assert_equal<int?>(results.size, 1);
|
||||
assert_false(results.get(test));
|
||||
|
||||
assert_flags((EmailIdentifier) test.id, test_flags);
|
||||
}
|
||||
|
|
@ -248,8 +248,8 @@ class Geary.ImapDB.FolderTest : TestCase {
|
|||
Gee.Map<Email,bool> results =
|
||||
this.folder.create_or_merge_email_async.end(async_result());
|
||||
|
||||
assert_int(1, results.size);
|
||||
assert(!results.get(test));
|
||||
assert_equal<int?>(results.size, 1);
|
||||
assert_false(results.get(test));
|
||||
|
||||
assert_flags((EmailIdentifier) test.id, test_flags);
|
||||
}
|
||||
|
|
@ -381,7 +381,7 @@ class Geary.ImapDB.FolderTest : TestCase {
|
|||
int i = 0;
|
||||
while (!result.finished) {
|
||||
assert_true(i < expected.length, "Too many rows");
|
||||
assert_int64(expected[i], result.int64_at(0));
|
||||
assert_equal<int64?>(result.int64_at(0), expected[i]);
|
||||
i++;
|
||||
result.next();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,19 +15,19 @@ class Geary.Imap.CreateCommandTest : TestCase {
|
|||
}
|
||||
|
||||
public void basic_create() throws Error {
|
||||
assert_string(
|
||||
"---- create owatagusiam/",
|
||||
new CreateCommand(new MailboxSpecifier("owatagusiam/")).to_string()
|
||||
assert_equal(
|
||||
new CreateCommand(new MailboxSpecifier("owatagusiam/")).to_string(),
|
||||
"---- create owatagusiam/"
|
||||
);
|
||||
}
|
||||
|
||||
public void special_use() throws Error {
|
||||
assert_string(
|
||||
"---- create Everything (use (\\All))",
|
||||
assert_equal(
|
||||
new CreateCommand.special_use(
|
||||
new MailboxSpecifier("Everything"),
|
||||
ALL_MAIL
|
||||
).to_string()
|
||||
).to_string(),
|
||||
"---- create Everything (use (\\All))"
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,9 +29,9 @@ class Geary.Imap.FetchCommandTest : TestCase {
|
|||
new Gee.LinkedList<FetchDataSpecifier>();
|
||||
data_items.add(FetchDataSpecifier.UID);
|
||||
|
||||
assert_string(
|
||||
"---- fetch 1 uid",
|
||||
new FetchCommand(this.msg_set, data_items, null).to_string()
|
||||
assert_equal(
|
||||
new FetchCommand(this.msg_set, data_items, null).to_string(),
|
||||
"---- fetch 1 uid"
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -44,9 +44,9 @@ class Geary.Imap.FetchCommandTest : TestCase {
|
|||
)
|
||||
);
|
||||
|
||||
assert_string(
|
||||
"---- fetch 1 body[text]",
|
||||
new FetchCommand(this.msg_set, null, body_items).to_string()
|
||||
assert_equal(
|
||||
new FetchCommand(this.msg_set, null, body_items).to_string(),
|
||||
"---- fetch 1 body[text]"
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -56,9 +56,9 @@ class Geary.Imap.FetchCommandTest : TestCase {
|
|||
data_items.add(FetchDataSpecifier.UID);
|
||||
data_items.add(FetchDataSpecifier.BODY);
|
||||
|
||||
assert_string(
|
||||
"---- fetch 1 (uid body)",
|
||||
new FetchCommand(this.msg_set, data_items, null).to_string()
|
||||
assert_equal(
|
||||
new FetchCommand(this.msg_set, data_items, null).to_string(),
|
||||
"---- fetch 1 (uid body)"
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -76,9 +76,9 @@ class Geary.Imap.FetchCommandTest : TestCase {
|
|||
)
|
||||
);
|
||||
|
||||
assert_string(
|
||||
"---- fetch 1 (body[header] body[text])",
|
||||
new FetchCommand(this.msg_set, null, body_items).to_string()
|
||||
assert_equal(
|
||||
new FetchCommand(this.msg_set, null, body_items).to_string(),
|
||||
"---- fetch 1 (body[header] body[text])"
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -101,9 +101,9 @@ class Geary.Imap.FetchCommandTest : TestCase {
|
|||
)
|
||||
);
|
||||
|
||||
assert_string(
|
||||
"---- fetch 1 (uid flags body[header] body[text])",
|
||||
new FetchCommand(this.msg_set, data_items, body_items).to_string()
|
||||
assert_equal(
|
||||
new FetchCommand(this.msg_set, data_items, body_items).to_string(),
|
||||
"---- fetch 1 (uid flags body[header] body[text])"
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,13 +17,13 @@ class Geary.Imap.MailboxSpecifierTest : TestCase {
|
|||
}
|
||||
|
||||
public void to_parameter() throws Error {
|
||||
assert_string(
|
||||
"test",
|
||||
new MailboxSpecifier("test").to_parameter().to_string()
|
||||
assert_equal(
|
||||
new MailboxSpecifier("test").to_parameter().to_string(),
|
||||
"test"
|
||||
);
|
||||
assert_string(
|
||||
"foo/bar",
|
||||
new MailboxSpecifier("foo/bar").to_parameter().to_string()
|
||||
assert_equal(
|
||||
new MailboxSpecifier("foo/bar").to_parameter().to_string(),
|
||||
"foo/bar"
|
||||
);
|
||||
|
||||
// The param won't be quoted or escaped since
|
||||
|
|
@ -32,55 +32,58 @@ class Geary.Imap.MailboxSpecifierTest : TestCase {
|
|||
Parameter quoted = new MailboxSpecifier("""foo\bar""").to_parameter();
|
||||
assert_true(quoted is QuotedStringParameter, "Backslash was not quoted");
|
||||
|
||||
assert_string(
|
||||
"ol&AOk-",
|
||||
new MailboxSpecifier("olé").to_parameter().to_string()
|
||||
assert_equal(
|
||||
new MailboxSpecifier("olé").to_parameter().to_string(),
|
||||
"ol&AOk-"
|
||||
);
|
||||
}
|
||||
|
||||
public void from_parameter() throws Error {
|
||||
assert_string(
|
||||
"test",
|
||||
assert_equal(
|
||||
new MailboxSpecifier.from_parameter(
|
||||
new UnquotedStringParameter("test")).name
|
||||
new UnquotedStringParameter("test")
|
||||
).name,
|
||||
"test"
|
||||
);
|
||||
|
||||
// This won't be quoted or escaped since QuotedStringParameter
|
||||
// doesn't actually handle that.
|
||||
assert_string(
|
||||
"foo\\bar",
|
||||
assert_equal(
|
||||
new MailboxSpecifier.from_parameter(
|
||||
new QuotedStringParameter("""foo\bar""")).name
|
||||
new QuotedStringParameter("""foo\bar""")
|
||||
).name,
|
||||
"foo\\bar"
|
||||
);
|
||||
assert_string(
|
||||
"olé",
|
||||
assert_equal(
|
||||
new MailboxSpecifier.from_parameter(
|
||||
new UnquotedStringParameter("ol&AOk-")).name
|
||||
new UnquotedStringParameter("ol&AOk-")
|
||||
).name,
|
||||
"olé"
|
||||
);
|
||||
}
|
||||
|
||||
public void from_folder_path() throws Error {
|
||||
FolderRoot root = new FolderRoot("#test");
|
||||
MailboxSpecifier inbox = new MailboxSpecifier("Inbox");
|
||||
assert_string(
|
||||
"Foo",
|
||||
assert_equal(
|
||||
new MailboxSpecifier.from_folder_path(
|
||||
root.get_child("Foo"), inbox, "$"
|
||||
).name
|
||||
).name,
|
||||
"Foo"
|
||||
);
|
||||
assert_string(
|
||||
"Foo$Bar",
|
||||
assert_equal(
|
||||
new MailboxSpecifier.from_folder_path(
|
||||
root.get_child("Foo").get_child("Bar"), inbox, "$"
|
||||
).name
|
||||
).name,
|
||||
"Foo$Bar"
|
||||
);
|
||||
assert_string(
|
||||
"Inbox",
|
||||
assert_equal(
|
||||
new MailboxSpecifier.from_folder_path(
|
||||
root.get_child(MailboxSpecifier.CANONICAL_INBOX_NAME),
|
||||
inbox,
|
||||
"$"
|
||||
).name
|
||||
).name,
|
||||
"Inbox"
|
||||
);
|
||||
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ class Geary.Imap.ListParameterTest : TestCase {
|
|||
parent_1.add(child);
|
||||
parent_2.add(child);
|
||||
|
||||
assert_int(1, parent_1.size, "Parent 1 does not contain child");
|
||||
assert_int(1, parent_2.size, "Parent 2 does not contain child");
|
||||
assert_equal<int?>(parent_1.size, 1, "Parent 1 does not contain child");
|
||||
assert_equal<int?>(parent_2.size, 1, "Parent 2 does not contain child");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ class Geary.Imap.ClientSessionTest : TestCase {
|
|||
test_article.connect_async.end(async_result());
|
||||
assert_not_reached();
|
||||
} catch (GLib.IOError.TIMED_OUT err) {
|
||||
assert_double(timer.elapsed(), CONNECT_TIMEOUT, CONNECT_TIMEOUT * 0.5);
|
||||
assert_within(timer.elapsed(), CONNECT_TIMEOUT, CONNECT_TIMEOUT * 0.5);
|
||||
}
|
||||
|
||||
TestServer.Result result = this.server.wait_for_script(this.main_loop);
|
||||
|
|
@ -278,9 +278,9 @@ class Geary.Imap.ClientSessionTest : TestCase {
|
|||
|
||||
assert_true(test_article.capabilities.supports_imap4rev1());
|
||||
assert_false(test_article.capabilities.has_capability("AUTH"));
|
||||
assert_int(2, test_article.capabilities.revision);
|
||||
assert_equal<int?>(test_article.capabilities.revision, 2);
|
||||
|
||||
assert_string("Inbox", test_article.inbox.mailbox.name);
|
||||
assert_equal(test_article.inbox.mailbox.name, "Inbox");
|
||||
assert_true(test_article.inbox.mailbox.is_inbox);
|
||||
|
||||
test_article.disconnect_async.begin(null, this.async_completion);
|
||||
|
|
@ -322,9 +322,9 @@ class Geary.Imap.ClientSessionTest : TestCase {
|
|||
|
||||
assert_true(test_article.capabilities.supports_imap4rev1());
|
||||
assert_false(test_article.capabilities.has_capability("AUTH"));
|
||||
assert_int(2, test_article.capabilities.revision);
|
||||
assert_equal<int?>(test_article.capabilities.revision, 2);
|
||||
|
||||
assert_string("Inbox", test_article.inbox.mailbox.name);
|
||||
assert_equal(test_article.inbox.mailbox.name, "Inbox");
|
||||
assert_true(test_article.inbox.mailbox.is_inbox);
|
||||
|
||||
test_article.disconnect_async.begin(null, this.async_completion);
|
||||
|
|
@ -383,19 +383,22 @@ class Geary.Imap.ClientSessionTest : TestCase {
|
|||
);
|
||||
test_article.initiate_session_async.end(async_result());
|
||||
|
||||
assert_int(1, test_article.get_personal_namespaces().size);
|
||||
assert_string(
|
||||
"INBOX.", test_article.get_personal_namespaces()[0].prefix
|
||||
assert_equal<int?>(test_article.get_personal_namespaces().size, 1);
|
||||
assert_equal(
|
||||
test_article.get_personal_namespaces()[0].prefix,
|
||||
"INBOX."
|
||||
);
|
||||
|
||||
assert_int(1, test_article.get_shared_namespaces().size);
|
||||
assert_string(
|
||||
"shared.", test_article.get_shared_namespaces()[0].prefix
|
||||
assert_equal<int?>(test_article.get_shared_namespaces().size, 1);
|
||||
assert_equal(
|
||||
test_article.get_shared_namespaces()[0].prefix,
|
||||
"shared."
|
||||
);
|
||||
|
||||
assert_int(1, test_article.get_other_users_namespaces().size);
|
||||
assert_string(
|
||||
"user.", test_article.get_other_users_namespaces()[0].prefix
|
||||
assert_equal<int?>(test_article.get_other_users_namespaces().size, 1);
|
||||
assert_equal(
|
||||
test_article.get_other_users_namespaces()[0].prefix,
|
||||
"user."
|
||||
);
|
||||
|
||||
test_article.disconnect_async.begin(null, this.async_completion);
|
||||
|
|
|
|||
|
|
@ -65,9 +65,9 @@ class Geary.Imap.DeserializerTest : TestCase {
|
|||
this.process.begin(Expect.MESSAGE, this.async_completion);
|
||||
RootParameters? message = this.process.end(async_result());
|
||||
|
||||
assert_int(2, message.size);
|
||||
assert_equal<int?>(message.size, 2);
|
||||
assert_true(message.get(1) is UnquotedStringParameter, "Not parsed as atom");
|
||||
assert_string(bytes, message.get(1).to_string());
|
||||
assert_equal(message.get(1).to_string(), bytes);
|
||||
}
|
||||
|
||||
public void parse_quoted() throws Error {
|
||||
|
|
@ -79,9 +79,9 @@ class Geary.Imap.DeserializerTest : TestCase {
|
|||
this.process.begin(Expect.MESSAGE, this.async_completion);
|
||||
RootParameters? message = this.process.end(async_result());
|
||||
|
||||
assert_int(2, message.size);
|
||||
assert_equal<int?>(message.size, 2);
|
||||
assert_true(message.get(1) is QuotedStringParameter, "Not parsed as quoted");
|
||||
assert_string(bytes, message.get(1).to_string());
|
||||
assert_equal(message.get(1).to_string(), bytes);
|
||||
}
|
||||
|
||||
public void parse_number() throws Error {
|
||||
|
|
@ -93,9 +93,9 @@ class Geary.Imap.DeserializerTest : TestCase {
|
|||
this.process.begin(Expect.MESSAGE, this.async_completion);
|
||||
RootParameters? message = this.process.end(async_result());
|
||||
|
||||
assert_int(2, message.size);
|
||||
assert_equal<int?>(message.size, 2);
|
||||
assert_true(message.get(1) is NumberParameter, "Not parsed as number");
|
||||
assert_string(bytes, message.get(1).to_string());
|
||||
assert_equal(message.get(1).to_string(), bytes);
|
||||
}
|
||||
|
||||
public void parse_list() throws Error {
|
||||
|
|
@ -107,9 +107,9 @@ class Geary.Imap.DeserializerTest : TestCase {
|
|||
this.process.begin(Expect.MESSAGE, this.async_completion);
|
||||
RootParameters? message = this.process.end(async_result());
|
||||
|
||||
assert_int(2, message.size);
|
||||
assert_equal<int?>(message.size, 2);
|
||||
assert_true(message.get(1) is ListParameter, "Not parsed as list");
|
||||
assert_string(bytes, message.get(1).to_string());
|
||||
assert_equal(message.get(1).to_string(), bytes);
|
||||
}
|
||||
|
||||
public void parse_response_code() throws Error {
|
||||
|
|
@ -121,9 +121,9 @@ class Geary.Imap.DeserializerTest : TestCase {
|
|||
this.process.begin(Expect.MESSAGE, this.async_completion);
|
||||
RootParameters? message = this.process.end(async_result());
|
||||
|
||||
assert_int(2, message.size);
|
||||
assert_equal<int?>(message.size, 2);
|
||||
assert_true(message.get(1) is ResponseCode, "Not parsed as response code");
|
||||
assert_string(bytes, message.get(1).to_string());
|
||||
assert_equal(message.get(1).to_string(), bytes);
|
||||
}
|
||||
|
||||
public void parse_bad_list() throws Error {
|
||||
|
|
@ -278,7 +278,7 @@ class Geary.Imap.DeserializerTest : TestCase {
|
|||
assert(this.deser.is_halted());
|
||||
}
|
||||
|
||||
protected async RootParameters? process(Expect expected) {
|
||||
protected async RootParameters? process(Expect expected) throws GLib.Error {
|
||||
RootParameters? message = null;
|
||||
bool eos = false;
|
||||
bool deserialize_failure = false;
|
||||
|
|
@ -321,6 +321,7 @@ class Geary.Imap.DeserializerTest : TestCase {
|
|||
|
||||
default:
|
||||
assert_not_reached();
|
||||
break;
|
||||
}
|
||||
|
||||
return message;
|
||||
|
|
|
|||
|
|
@ -17,20 +17,20 @@ class Geary.Mime.ContentTypeTest : TestCase {
|
|||
}
|
||||
|
||||
public void static_defaults() throws Error {
|
||||
assert_string(
|
||||
"text/plain; charset=us-ascii",
|
||||
ContentType.DISPLAY_DEFAULT.to_string()
|
||||
assert_equal(
|
||||
ContentType.DISPLAY_DEFAULT.to_string(),
|
||||
"text/plain; charset=us-ascii"
|
||||
);
|
||||
assert_string(
|
||||
"application/octet-stream",
|
||||
ContentType.ATTACHMENT_DEFAULT.to_string()
|
||||
assert_equal(
|
||||
ContentType.ATTACHMENT_DEFAULT.to_string(),
|
||||
"application/octet-stream"
|
||||
);
|
||||
}
|
||||
|
||||
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);
|
||||
assert_equal(test_article.media_type, "text");
|
||||
assert_equal(test_article.media_subtype, "plain");
|
||||
|
||||
try {
|
||||
ContentType.parse("");
|
||||
|
|
|
|||
|
|
@ -223,9 +223,9 @@ class Geary.RFC822.MailboxAddressTest : TestCase {
|
|||
assert(new MailboxAddress("Test", "example@example@example.com").to_full_display() ==
|
||||
"example@example@example.com");
|
||||
|
||||
assert_string(
|
||||
"\"Testerson, Test\" <test@example.com>",
|
||||
new MailboxAddress("Testerson, Test", "test@example.com").to_full_display()
|
||||
assert_equal(
|
||||
new MailboxAddress("Testerson, Test", "test@example.com").to_full_display(),
|
||||
"\"Testerson, Test\" <test@example.com>"
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -241,13 +241,13 @@ class Geary.RFC822.MailboxAddressTest : TestCase {
|
|||
}
|
||||
|
||||
public void to_rfc822_address() throws GLib.Error {
|
||||
assert_string(
|
||||
"example@example.com",
|
||||
new MailboxAddress(null, "example@example.com").to_rfc822_address()
|
||||
assert_equal(
|
||||
new MailboxAddress(null, "example@example.com").to_rfc822_address(),
|
||||
"example@example.com"
|
||||
);
|
||||
assert_string(
|
||||
"test.account@example.com",
|
||||
new MailboxAddress(null, "test.account@example.com").to_rfc822_address()
|
||||
assert_equal(
|
||||
new MailboxAddress(null, "test.account@example.com").to_rfc822_address(),
|
||||
"test.account@example.com"
|
||||
);
|
||||
//assert(new MailboxAddress(null, "test test@example.com").to_rfc822_address() ==
|
||||
// "\"test test\"@example.com");
|
||||
|
|
@ -256,34 +256,34 @@ class Geary.RFC822.MailboxAddressTest : TestCase {
|
|||
//assert(new MailboxAddress(null, "test\"test@example.com").to_rfc822_address() ==
|
||||
// "\"test\"test\"@example.com");
|
||||
|
||||
assert_string(
|
||||
"$test@example.com",
|
||||
new MailboxAddress(null, "$test@example.com").to_rfc822_address()
|
||||
assert_equal(
|
||||
new MailboxAddress(null, "$test@example.com").to_rfc822_address(),
|
||||
"$test@example.com"
|
||||
);
|
||||
assert_string(
|
||||
"\"test@test\"@example.com",
|
||||
new MailboxAddress(null, "test@test@example.com").to_rfc822_address()
|
||||
assert_equal(
|
||||
new MailboxAddress(null, "test@test@example.com").to_rfc822_address(),
|
||||
"\"test@test\"@example.com"
|
||||
);
|
||||
|
||||
// RFC 2047 reserved words in the local-part must be used
|
||||
// as-is, and in particular not encoded per that RFC. See RFC
|
||||
// 2047 §5 and GNOME/geary#336
|
||||
string RFC_2074 = "libc-alpha-sc.1553427554.ndgdflaalknmibgfkpak-hi-angel=yandex.ru@sourceware.org";
|
||||
assert_string(
|
||||
RFC_2074,
|
||||
new MailboxAddress(null, RFC_2074).to_rfc822_address()
|
||||
assert_equal(
|
||||
new MailboxAddress(null, RFC_2074).to_rfc822_address(),
|
||||
RFC_2074
|
||||
);
|
||||
|
||||
// Likewise, Unicode chars should be passed through. Note that
|
||||
// these can only be sent if a UTF8 connection is negotiated
|
||||
// with the SMTP server
|
||||
assert_string(
|
||||
"©@example.com",
|
||||
new MailboxAddress(null, "©@example.com").to_rfc822_address()
|
||||
assert_equal(
|
||||
new MailboxAddress(null, "©@example.com").to_rfc822_address(),
|
||||
"©@example.com"
|
||||
);
|
||||
assert_string(
|
||||
"😸@example.com",
|
||||
new MailboxAddress(null, "😸@example.com").to_rfc822_address()
|
||||
assert_equal(
|
||||
new MailboxAddress(null, "😸@example.com").to_rfc822_address(),
|
||||
"😸@example.com"
|
||||
);
|
||||
|
||||
}
|
||||
|
|
@ -310,15 +310,15 @@ class Geary.RFC822.MailboxAddressTest : TestCase {
|
|||
assert(new MailboxAddress("😸", "example@example.com").to_rfc822_string() ==
|
||||
"=?UTF-8?b?8J+YuA==?= <example@example.com>");
|
||||
|
||||
assert_string(
|
||||
"\"Surname, Name\" <example@example.com>",
|
||||
new MailboxAddress("Surname, Name", "example@example.com").to_rfc822_string()
|
||||
assert_equal(
|
||||
new MailboxAddress("Surname, Name", "example@example.com").to_rfc822_string(),
|
||||
"\"Surname, Name\" <example@example.com>"
|
||||
);
|
||||
assert_string(
|
||||
"\"Surname, Name\" <example@example.com>",
|
||||
assert_equal(
|
||||
new MailboxAddress
|
||||
.from_rfc822_string("\"Surname, Name\" <example@example.com>")
|
||||
.to_rfc822_string()
|
||||
.to_rfc822_string(),
|
||||
"\"Surname, Name\" <example@example.com>"
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,29 +18,30 @@ class Geary.RFC822.MailboxAddressesTest : TestCase {
|
|||
|
||||
public void from_rfc822_string_encoded() throws GLib.Error {
|
||||
MailboxAddresses addrs = new MailboxAddresses.from_rfc822_string("test@example.com");
|
||||
assert(addrs.size == 1);
|
||||
assert_equal<int?>(addrs.size, 1);
|
||||
|
||||
addrs = new MailboxAddresses.from_rfc822_string("test1@example.com, test2@example.com");
|
||||
assert(addrs.size == 2);
|
||||
assert_equal<int?>(addrs.size, 2);
|
||||
|
||||
// Courtesy Mailsploit https://www.mailsploit.com
|
||||
addrs = new MailboxAddresses.from_rfc822_string("\"=?utf-8?b?dGVzdCIgPHBvdHVzQHdoaXRlaG91c2UuZ292Pg==?==?utf-8?Q?=00=0A?=\" <demo@mailsploit.com>");
|
||||
assert(addrs.size == 1);
|
||||
assert_equal<int?>(addrs.size, 1);
|
||||
|
||||
// Courtesy Mailsploit https://www.mailsploit.com
|
||||
addrs = new MailboxAddresses.from_rfc822_string("\"=?utf-8?Q?=42=45=47=49=4E=20=2F=20=28=7C=29=7C=3C=7C=3E=7C=40=7C=2C=7C=3B=7C=3A=7C=5C=7C=22=7C=2F=7C=5B=7C=5D=7C=3F=7C=2E=7C=3D=20=2F=20=00=20=50=41=53=53=45=44=20=4E=55=4C=4C=20=42=59=54=45=20=2F=20=0D=0A=20=50=41=53=53=45=44=20=43=52=4C=46=20=2F=20?==?utf-8?b?RU5E=?=\", <demo@mailsploit.com>");
|
||||
assert(addrs.size == 2);
|
||||
assert_equal<int?>(addrs.size, 2);
|
||||
}
|
||||
|
||||
public void from_rfc822_string_quoted() throws GLib.Error {
|
||||
MailboxAddresses addrs = new MailboxAddresses.from_rfc822_string(
|
||||
"\"Surname, Name\" <mail@example.com>"
|
||||
) ;
|
||||
assert_int(1, addrs.size);
|
||||
assert_string("Surname, Name", addrs[0].name);
|
||||
assert_string("mail@example.com", addrs[0].address);
|
||||
|
||||
assert_string("\"Surname, Name\" <mail@example.com>", addrs.to_rfc822_string());
|
||||
assert_equal<int?>(addrs.size, 1);
|
||||
assert_equal(addrs[0].name, "Surname, Name");
|
||||
assert_equal(addrs[0].address, "mail@example.com");
|
||||
assert_equal(
|
||||
addrs.to_rfc822_string(), "\"Surname, Name\" <mail@example.com>"
|
||||
);
|
||||
}
|
||||
|
||||
public void to_rfc822_string() throws GLib.Error {
|
||||
|
|
|
|||
|
|
@ -22,13 +22,13 @@ class Geary.RFC822.MessageDataTest : TestCase {
|
|||
new Geary.Memory.StringBuffer(PLAIN_BODY1_HEADERS),
|
||||
new Geary.Memory.StringBuffer(PLAIN_BODY1_ENCODED)
|
||||
);
|
||||
assert_string(PLAIN_BODY1_EXPECTED, plain_preview1.buffer.to_string());
|
||||
assert_equal(plain_preview1.buffer.to_string(), PLAIN_BODY1_EXPECTED);
|
||||
|
||||
PreviewText base64_preview = new PreviewText.with_header(
|
||||
new Geary.Memory.StringBuffer(BASE64_BODY_HEADERS),
|
||||
new Geary.Memory.StringBuffer(BASE64_BODY_ENCODED)
|
||||
);
|
||||
assert_string(BASE64_BODY_EXPECTED, base64_preview.buffer.to_string());
|
||||
assert_equal(base64_preview.buffer.to_string(), BASE64_BODY_EXPECTED);
|
||||
|
||||
string html_part_headers = "Content-Type: text/html; charset=utf-8\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\n";
|
||||
|
||||
|
|
@ -36,76 +36,76 @@ class Geary.RFC822.MessageDataTest : TestCase {
|
|||
new Geary.Memory.StringBuffer(html_part_headers),
|
||||
new Geary.Memory.StringBuffer(HTML_BODY1_ENCODED)
|
||||
);
|
||||
assert_string(HTML_BODY1_EXPECTED, html_preview1.buffer.to_string());
|
||||
assert_equal(html_preview1.buffer.to_string(), HTML_BODY1_EXPECTED);
|
||||
|
||||
PreviewText html_preview2 = new PreviewText.with_header(
|
||||
new Geary.Memory.StringBuffer(html_part_headers),
|
||||
new Geary.Memory.StringBuffer(HTML_BODY2_ENCODED)
|
||||
);
|
||||
assert_string(HTML_BODY2_EXPECTED, html_preview2.buffer.to_string());
|
||||
assert_equal(html_preview2.buffer.to_string(), HTML_BODY2_EXPECTED);
|
||||
}
|
||||
|
||||
public void header_from_rfc822() throws GLib.Error {
|
||||
Header test_article = new Header(new Memory.StringBuffer(HEADER_FIXTURE));
|
||||
assert_string("Test <test@example.com>", test_article.get_header("From"));
|
||||
assert_string("test", test_article.get_header("Subject"));
|
||||
assert_null_string(test_article.get_header("Blah"));
|
||||
assert_equal(test_article.get_header("From"), "Test <test@example.com>");
|
||||
assert_equal(test_article.get_header("Subject"), "test");
|
||||
assert_null(test_article.get_header("Blah"));
|
||||
}
|
||||
|
||||
public void header_names_from_rfc822() throws GLib.Error {
|
||||
Header test_article = new Header(new Memory.StringBuffer(HEADER_FIXTURE));
|
||||
assert_int(2, test_article.get_header_names().length);
|
||||
assert_string("From", test_article.get_header_names()[0]);
|
||||
assert_string("Subject", test_article.get_header_names()[1]);
|
||||
assert_equal<int?>(test_article.get_header_names().length, 2);
|
||||
assert_equal(test_article.get_header_names()[0], "From");
|
||||
assert_equal(test_article.get_header_names()[1], "Subject");
|
||||
}
|
||||
|
||||
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.from_rfc822_string(FULL_HOUR_TZ);
|
||||
assert_int64(
|
||||
((int64) (-1 * 3600)) * 1000 * 1000,
|
||||
assert_equal<int64?>(
|
||||
full_hour_tz.value.get_utc_offset(),
|
||||
((int64) (-1 * 3600)) * 1000 * 1000,
|
||||
"full_hour_tz.value.get_utc_offset"
|
||||
);
|
||||
assert_int(0, full_hour_tz.value.get_hour(), "full_hour_tz hour");
|
||||
assert_int(0, full_hour_tz.value.get_minute(), "full_hour_tz minute");
|
||||
assert_int(0, full_hour_tz.value.get_second(), "full_hour_tz second");
|
||||
assert_int(28, full_hour_tz.value.get_day_of_month(), "full_hour_tz day");
|
||||
assert_int(2, full_hour_tz.value.get_month(), "full_hour_tz month");
|
||||
assert_int(2019, full_hour_tz.value.get_year(), "full_hour_tz year");
|
||||
assert_equal<int?>(full_hour_tz.value.get_hour(), 0, "full_hour_tz hour");
|
||||
assert_equal<int?>(full_hour_tz.value.get_minute(), 0, "full_hour_tz minute");
|
||||
assert_equal<int?>(full_hour_tz.value.get_second(), 0, "full_hour_tz second");
|
||||
assert_equal<int?>(full_hour_tz.value.get_day_of_month(), 28, "full_hour_tz day");
|
||||
assert_equal<int?>(full_hour_tz.value.get_month(), 2, "full_hour_tz month");
|
||||
assert_equal<int?>(full_hour_tz.value.get_year(), 2019, "full_hour_tz year");
|
||||
|
||||
assert_int64(
|
||||
full_hour_tz.value.to_utc().to_unix(),
|
||||
assert_equal<int64?>(
|
||||
full_hour_tz.value.to_unix(),
|
||||
full_hour_tz.value.to_utc().to_unix(),
|
||||
"to_unix not UTC"
|
||||
);
|
||||
|
||||
const string HALF_HOUR_TZ = "Thu, 28 Feb 2019 00:00:00 +1030";
|
||||
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()
|
||||
assert_equal<int64?>(
|
||||
half_hour_tz.value.get_utc_offset(),
|
||||
((int64) (10.5 * 3600)) * 1000 * 1000
|
||||
);
|
||||
assert_int(0, half_hour_tz.value.get_hour());
|
||||
assert_int(0, half_hour_tz.value.get_minute());
|
||||
assert_int(0, half_hour_tz.value.get_second());
|
||||
assert_int(28, half_hour_tz.value.get_day_of_month());
|
||||
assert_int(2, half_hour_tz.value.get_month());
|
||||
assert_int(2019, half_hour_tz.value.get_year());
|
||||
assert_equal<int?>(half_hour_tz.value.get_hour(), 0);
|
||||
assert_equal<int?>(half_hour_tz.value.get_minute(), 0);
|
||||
assert_equal<int?>(half_hour_tz.value.get_second(), 0);
|
||||
assert_equal<int?>(half_hour_tz.value.get_day_of_month(), 28);
|
||||
assert_equal<int?>(half_hour_tz.value.get_month(), 2);
|
||||
assert_equal<int?>(half_hour_tz.value.get_year(), 2019);
|
||||
}
|
||||
|
||||
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.from_rfc822_string(FULL_HOUR_TZ);
|
||||
assert_string(FULL_HOUR_TZ, full_hour_tz.to_rfc822_string());
|
||||
assert_equal(full_hour_tz.to_rfc822_string(), FULL_HOUR_TZ);
|
||||
|
||||
const string HALF_HOUR_TZ = "Thu, 28 Feb 2019 00:00:00 +1030";
|
||||
Date half_hour_tz = new Date.from_rfc822_string(HALF_HOUR_TZ);
|
||||
assert_string(HALF_HOUR_TZ, half_hour_tz.to_rfc822_string());
|
||||
assert_equal(half_hour_tz.to_rfc822_string(), HALF_HOUR_TZ);
|
||||
|
||||
const string NEG_HALF_HOUR_TZ = "Thu, 28 Feb 2019 00:00:00 -1030";
|
||||
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());
|
||||
assert_equal(neg_half_hour_tz.to_rfc822_string(), NEG_HALF_HOUR_TZ);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ This is the second line.
|
|||
Message enc = string_to_message(ENCODED_TO);
|
||||
|
||||
// Courtesy Mailsploit https://www.mailsploit.com
|
||||
assert_string("potus@whitehouse.gov <test>", enc.to[0].name);
|
||||
assert_equal(enc.to[0].name, "potus@whitehouse.gov <test>");
|
||||
}
|
||||
|
||||
public void duplicate_mailbox() throws GLib.Error {
|
||||
|
|
@ -112,7 +112,7 @@ This is the second line.
|
|||
|
||||
assert_true(test.has_plain_body(), "Expected plain body");
|
||||
assert_false(test.has_html_body(), "Expected non-html body");
|
||||
assert_string(BASIC_PLAIN_BODY, test.get_plain_body(false, null));
|
||||
assert_equal(test.get_plain_body(false, null), BASIC_PLAIN_BODY);
|
||||
}
|
||||
|
||||
public void text_plain_as_html() throws GLib.Error {
|
||||
|
|
@ -120,9 +120,9 @@ This is the second line.
|
|||
|
||||
assert_true(test.has_plain_body(), "Expected plain body");
|
||||
assert_false(test.has_html_body(), "Expected non-html body");
|
||||
assert_string(
|
||||
HTML_CONVERSION_TEMPLATE.printf(BASIC_PLAIN_BODY),
|
||||
test.get_plain_body(true, null)
|
||||
assert_equal(
|
||||
test.get_plain_body(true, null),
|
||||
HTML_CONVERSION_TEMPLATE.printf(BASIC_PLAIN_BODY)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -131,7 +131,7 @@ This is the second line.
|
|||
|
||||
assert_true(test.has_html_body(), "Expected html body");
|
||||
assert_false(test.has_plain_body(), "Expected non-plain body");
|
||||
assert_string(BASIC_HTML_BODY, test.get_html_body(null));
|
||||
assert_equal(test.get_html_body(null), BASIC_HTML_BODY);
|
||||
}
|
||||
|
||||
public void text_html_as_plain() throws GLib.Error {
|
||||
|
|
@ -139,7 +139,7 @@ This is the second line.
|
|||
|
||||
assert_true(test.has_html_body(), "Expected html body");
|
||||
assert_false(test.has_plain_body(), "Expected non-plain body");
|
||||
assert_string(BASIC_HTML_BODY, test.get_html_body(null));
|
||||
assert_equal(test.get_html_body(null), BASIC_HTML_BODY);
|
||||
}
|
||||
|
||||
public void tnef_extract_attachments() throws GLib.Error {
|
||||
|
|
@ -155,7 +155,7 @@ This is the second line.
|
|||
|
||||
assert_true(test.has_plain_body(), "Expected plain body");
|
||||
assert_true(test.has_html_body(), "Expected html body");
|
||||
assert_string(BASIC_PLAIN_BODY, test.get_plain_body(false, null));
|
||||
assert_equal(test.get_plain_body(false, null), BASIC_PLAIN_BODY);
|
||||
}
|
||||
|
||||
public void multipart_alternative_as_converted_html() throws GLib.Error {
|
||||
|
|
@ -163,9 +163,9 @@ This is the second line.
|
|||
|
||||
assert_true(test.has_plain_body(), "Expected plain body");
|
||||
assert_true(test.has_html_body(), "Expected html body");
|
||||
assert_string(
|
||||
HTML_CONVERSION_TEMPLATE.printf(BASIC_PLAIN_BODY),
|
||||
test.get_plain_body(true, null)
|
||||
assert_equal(
|
||||
test.get_plain_body(true, null),
|
||||
HTML_CONVERSION_TEMPLATE.printf(BASIC_PLAIN_BODY)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -174,7 +174,7 @@ This is the second line.
|
|||
|
||||
assert_true(test.has_plain_body(), "Expected plain body");
|
||||
assert_true(test.has_html_body(), "Expected html body");
|
||||
assert_string(BASIC_HTML_BODY, test.get_html_body(null));
|
||||
assert_equal(test.get_html_body(null), BASIC_HTML_BODY);
|
||||
}
|
||||
|
||||
public void get_preview() throws GLib.Error {
|
||||
|
|
@ -434,21 +434,21 @@ This is the second line.
|
|||
string expected)
|
||||
throws GLib.Error {
|
||||
assert_non_null(actual, expected);
|
||||
assert_string(expected, actual.to_string());
|
||||
assert_equal(actual.to_string(), expected);
|
||||
}
|
||||
|
||||
private void assert_address(Geary.RFC822.MailboxAddress? address,
|
||||
string expected)
|
||||
throws GLib.Error {
|
||||
assert_non_null(address, expected);
|
||||
assert_string(expected, address.to_rfc822_string());
|
||||
assert_equal(address.to_rfc822_string(), expected);
|
||||
}
|
||||
|
||||
private void assert_addresses(Geary.RFC822.MailboxAddresses? addresses,
|
||||
string expected)
|
||||
throws GLib.Error {
|
||||
assert_non_null(addresses, expected);
|
||||
assert_string(expected, addresses.to_rfc822_string());
|
||||
assert_equal(addresses.to_rfc822_string(), expected);
|
||||
}
|
||||
|
||||
private void assert_addresses_list(Gee.List<RFC822.MailboxAddress>? addresses,
|
||||
|
|
@ -466,7 +466,7 @@ This is the second line.
|
|||
string expected)
|
||||
throws GLib.Error {
|
||||
assert_non_null(ids, "ids are null");
|
||||
assert_string(expected, ids.to_rfc822_string());
|
||||
assert_equal(ids.to_rfc822_string(), expected);
|
||||
}
|
||||
|
||||
// Courtesy Mailsploit https://www.mailsploit.com
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@ class Geary.RFC822.PartTest : TestCase {
|
|||
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");
|
||||
assert_null_string(test.content_description, "content_description");
|
||||
assert_null(test.content_id, "content_id");
|
||||
assert_null(test.content_description, "content_description");
|
||||
assert_null(test.content_disposition, "content_disposition");
|
||||
}
|
||||
|
||||
|
|
@ -48,13 +48,12 @@ class Geary.RFC822.PartTest : TestCase {
|
|||
|
||||
Part test = new Part(part);
|
||||
|
||||
assert_string(TYPE, test.content_type.to_string());
|
||||
assert_string(ID, test.content_id);
|
||||
assert_string(DESC, test.content_description);
|
||||
assert_equal(test.content_type.to_string(), TYPE);
|
||||
assert_equal(test.content_id, ID);
|
||||
assert_equal(test.content_description, DESC);
|
||||
assert_non_null(test.content_disposition, "content_disposition");
|
||||
assert_int(
|
||||
Geary.Mime.DispositionType.INLINE,
|
||||
test.content_disposition.disposition_type
|
||||
assert_equal<Geary.Mime.DispositionType?>(
|
||||
test.content_disposition.disposition_type, INLINE
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -63,7 +62,7 @@ class Geary.RFC822.PartTest : TestCase {
|
|||
|
||||
Memory.Buffer buf = test.write_to_buffer(Part.EncodingConversion.NONE);
|
||||
|
||||
assert_string(CR_BODY, buf.to_string());
|
||||
assert_equal(buf.to_string(), CR_BODY);
|
||||
}
|
||||
|
||||
public void write_to_buffer_plain_crlf() throws GLib.Error {
|
||||
|
|
@ -72,7 +71,7 @@ class Geary.RFC822.PartTest : TestCase {
|
|||
Memory.Buffer buf = test.write_to_buffer(Part.EncodingConversion.NONE);
|
||||
|
||||
// CRLF should be stripped
|
||||
assert_string(CR_BODY, buf.to_string());
|
||||
assert_equal(buf.to_string(), CR_BODY);
|
||||
}
|
||||
|
||||
public void write_to_buffer_plain_ical() throws GLib.Error {
|
||||
|
|
@ -81,7 +80,7 @@ class Geary.RFC822.PartTest : TestCase {
|
|||
Memory.Buffer buf = test.write_to_buffer(Part.EncodingConversion.NONE);
|
||||
|
||||
// CRLF should not be stripped
|
||||
assert_string(ICAL_BODY, buf.to_string());
|
||||
assert_equal(buf.to_string(), ICAL_BODY);
|
||||
}
|
||||
|
||||
public void write_to_buffer_plain_utf8() throws GLib.Error {
|
||||
|
|
@ -89,7 +88,7 @@ class Geary.RFC822.PartTest : TestCase {
|
|||
|
||||
Memory.Buffer buf = test.write_to_buffer(Part.EncodingConversion.NONE);
|
||||
|
||||
assert_string(UTF8_BODY, buf.to_string());
|
||||
assert_equal(buf.to_string(), UTF8_BODY);
|
||||
}
|
||||
|
||||
private GMime.Part new_part(string? mime_type,
|
||||
|
|
|
|||
|
|
@ -14,31 +14,31 @@ class Geary.Ascii.Test : TestCase {
|
|||
}
|
||||
|
||||
public void index_of() throws Error {
|
||||
assert_int(-1, Ascii.index_of("", 'a'));
|
||||
assert_int(0, Ascii.index_of("a", 'a'));
|
||||
assert_int(0, Ascii.index_of("aa", 'a'));
|
||||
assert_equal<int?>(Ascii.index_of("", 'a'), -1);
|
||||
assert_equal<int?>(Ascii.index_of("a", 'a'), 0);
|
||||
assert_equal<int?>(Ascii.index_of("aa", 'a'), 0);
|
||||
|
||||
assert_int(0, Ascii.index_of("abcabc", 'a'));
|
||||
assert_int(1, Ascii.index_of("abcabc", 'b'));
|
||||
assert_int(2, Ascii.index_of("abcabc", 'c'));
|
||||
assert_equal<int?>(Ascii.index_of("abcabc", 'a'), 0);
|
||||
assert_equal<int?>(Ascii.index_of("abcabc", 'b'), 1);
|
||||
assert_equal<int?>(Ascii.index_of("abcabc", 'c'), 2);
|
||||
|
||||
assert_int(0, Ascii.index_of("@", '@'));
|
||||
assert_equal<int?>(Ascii.index_of("@", '@'), 0);
|
||||
|
||||
assert_int(-1, Ascii.index_of("abc", 'd'));
|
||||
assert_equal<int?>(Ascii.index_of("abc", 'd'), -1);
|
||||
}
|
||||
|
||||
public void last_index_of() throws Error {
|
||||
assert_int(-1, Ascii.last_index_of("", 'a'));
|
||||
assert_int(0, Ascii.last_index_of("a", 'a'));
|
||||
assert_int(1, Ascii.last_index_of("aa", 'a'));
|
||||
assert_equal<int?>(Ascii.last_index_of("", 'a'), -1);
|
||||
assert_equal<int?>(Ascii.last_index_of("a", 'a'), 0);
|
||||
assert_equal<int?>(Ascii.last_index_of("aa", 'a'), 1);
|
||||
|
||||
assert_int(3, Ascii.last_index_of("abcabc", 'a'));
|
||||
assert_int(4, Ascii.last_index_of("abcabc", 'b'));
|
||||
assert_int(5, Ascii.last_index_of("abcabc", 'c'));
|
||||
assert_equal<int?>(Ascii.last_index_of("abcabc", 'a'), 3);
|
||||
assert_equal<int?>(Ascii.last_index_of("abcabc", 'b'), 4);
|
||||
assert_equal<int?>(Ascii.last_index_of("abcabc", 'c'), 5);
|
||||
|
||||
assert_int(0, Ascii.last_index_of("@", '@'));
|
||||
assert_equal<int?>(Ascii.last_index_of("@", '@'), 0);
|
||||
|
||||
assert_int(-1, Ascii.last_index_of("abc", 'd'));
|
||||
assert_equal<int?>(Ascii.last_index_of("abc", 'd'), -1);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,8 +42,12 @@ class Geary.ConfigFileTest : TestCase {
|
|||
|
||||
public void test_string() throws Error {
|
||||
this.test_group.set_string(TEST_KEY, "a string");
|
||||
assert_string("a string", this.test_group.get_string(TEST_KEY));
|
||||
assert_string("default", this.test_group.get_string(TEST_KEY_MISSING, "default"));
|
||||
assert_equal(
|
||||
this.test_group.get_string(TEST_KEY), "a string"
|
||||
);
|
||||
assert_equal(
|
||||
this.test_group.get_string(TEST_KEY_MISSING, "default"), "default"
|
||||
);
|
||||
}
|
||||
|
||||
public void test_string_fallback() throws Error {
|
||||
|
|
@ -51,7 +55,7 @@ class Geary.ConfigFileTest : TestCase {
|
|||
fallback.set_string("fallback-test-key", "a string");
|
||||
|
||||
this.test_group.set_fallback("fallback", "fallback-");
|
||||
assert_string("a string", this.test_group.get_string(TEST_KEY));
|
||||
assert_equal(this.test_group.get_string(TEST_KEY), "a string");
|
||||
}
|
||||
|
||||
public void test_string_list() throws Error {
|
||||
|
|
@ -60,12 +64,12 @@ class Geary.ConfigFileTest : TestCase {
|
|||
);
|
||||
|
||||
Gee.List<string> saved = this.test_group.get_string_list(TEST_KEY);
|
||||
assert_int(2, saved.size, "Saved string list");
|
||||
assert_string("a", saved[0]);
|
||||
assert_string("b", saved[1]);
|
||||
assert_collection(
|
||||
saved, "Saved string list"
|
||||
).first_is("a").at_index_is(1, "b");
|
||||
|
||||
Gee.List<string> def = this.test_group.get_string_list(TEST_KEY_MISSING);
|
||||
assert_int(0, def.size, "Default string list");
|
||||
assert_collection(def, "Default string list").is_empty();
|
||||
}
|
||||
|
||||
public void test_bool() throws Error {
|
||||
|
|
@ -77,14 +81,14 @@ class Geary.ConfigFileTest : TestCase {
|
|||
|
||||
public void test_int() throws Error {
|
||||
this.test_group.set_int(TEST_KEY, 42);
|
||||
assert_int(42, this.test_group.get_int(TEST_KEY));
|
||||
assert_int(42, this.test_group.get_int(TEST_KEY_MISSING, 42));
|
||||
assert_equal<int?>(this.test_group.get_int(TEST_KEY), 42);
|
||||
assert_equal<int?>(this.test_group.get_int(TEST_KEY_MISSING, 42), 42);
|
||||
}
|
||||
|
||||
public void test_uint16() throws Error {
|
||||
this.test_group.set_uint16(TEST_KEY, 42);
|
||||
assert_int(42, this.test_group.get_uint16(TEST_KEY));
|
||||
assert_int(42, this.test_group.get_uint16(TEST_KEY_MISSING, 42));
|
||||
assert_equal<int?>(this.test_group.get_uint16(TEST_KEY), 42);
|
||||
assert_equal<int?>(this.test_group.get_uint16(TEST_KEY_MISSING, 42), 42);
|
||||
}
|
||||
|
||||
public void test_has_key() throws Error {
|
||||
|
|
|
|||
|
|
@ -21,60 +21,60 @@ class Geary.HTML.UtilTest : TestCase {
|
|||
}
|
||||
|
||||
public void preserve_whitespace() throws GLib.Error {
|
||||
assert_string("some text", Geary.HTML.smart_escape("some text"));
|
||||
assert_string("some text", Geary.HTML.smart_escape("some text"));
|
||||
assert_string("some text", Geary.HTML.smart_escape("some text"));
|
||||
assert_string("some text", Geary.HTML.smart_escape("some\ttext"));
|
||||
assert_equal(smart_escape("some text"), "some text");
|
||||
assert_equal(smart_escape("some text"), "some text");
|
||||
assert_equal(smart_escape("some text"), "some text");
|
||||
assert_equal(smart_escape("some\ttext"), "some text");
|
||||
|
||||
assert_string("some<br>text", Geary.HTML.smart_escape("some\ntext"));
|
||||
assert_string("some<br>text", Geary.HTML.smart_escape("some\rtext"));
|
||||
assert_string("some<br>text", Geary.HTML.smart_escape("some\r\ntext"));
|
||||
assert_equal(smart_escape("some\ntext"), "some<br>text");
|
||||
assert_equal(smart_escape("some\rtext"), "some<br>text");
|
||||
assert_equal(smart_escape("some\r\ntext"), "some<br>text");
|
||||
|
||||
assert_string("some<br><br>text", Geary.HTML.smart_escape("some\n\ntext"));
|
||||
assert_string("some<br><br>text", Geary.HTML.smart_escape("some\r\rtext"));
|
||||
assert_string("some<br><br>text", Geary.HTML.smart_escape("some\n\rtext"));
|
||||
assert_string("some<br><br>text", Geary.HTML.smart_escape("some\r\n\r\ntext"));
|
||||
assert_equal(smart_escape("some\n\ntext"), "some<br><br>text");
|
||||
assert_equal(smart_escape("some\r\rtext"), "some<br><br>text");
|
||||
assert_equal(smart_escape("some\n\rtext"), "some<br><br>text");
|
||||
assert_equal(smart_escape("some\r\n\r\ntext"), "some<br><br>text");
|
||||
}
|
||||
|
||||
public void smart_escape_div() throws Error {
|
||||
string html = "<div>ohhai</div>";
|
||||
assert(Geary.HTML.smart_escape(html) == html);
|
||||
assert_equal(smart_escape(html), html);
|
||||
}
|
||||
|
||||
public void smart_escape_no_closing_tag() throws Error {
|
||||
string html = "<div>ohhai";
|
||||
assert(Geary.HTML.smart_escape(html) == html);
|
||||
assert_equal(smart_escape(html), html);
|
||||
}
|
||||
|
||||
public void smart_escape_img() throws Error {
|
||||
string html = "<img src=\"http://example.com/lol.gif\">";
|
||||
assert(Geary.HTML.smart_escape(html) == html);
|
||||
assert_equal(smart_escape(html), html);
|
||||
}
|
||||
|
||||
public void smart_escape_xhtml_img() throws Error {
|
||||
string html = "<img src=\"http://example.com/lol.gif\"/>";
|
||||
assert(Geary.HTML.smart_escape(html) == html);
|
||||
assert_equal(smart_escape(html), html);
|
||||
}
|
||||
|
||||
public void smart_escape_mixed() throws Error {
|
||||
string html = "mixed <div>ohhai</div> text";
|
||||
assert(Geary.HTML.smart_escape(html) == html);
|
||||
assert_equal(smart_escape(html), html);
|
||||
}
|
||||
|
||||
public void smart_escape_text() throws GLib.Error {
|
||||
assert_string("some text", Geary.HTML.smart_escape("some text"));
|
||||
assert_string("<some text", Geary.HTML.smart_escape("<some text"));
|
||||
assert_string("some text>", Geary.HTML.smart_escape("some text>"));
|
||||
assert_equal(smart_escape("some text"), "some text");
|
||||
assert_equal(smart_escape("<some text"), "<some text");
|
||||
assert_equal(smart_escape("some text>"), "some text>");
|
||||
}
|
||||
|
||||
public void smart_escape_text_url() throws GLib.Error {
|
||||
assert_string(
|
||||
"<http://example.com>",
|
||||
Geary.HTML.smart_escape("<http://example.com>")
|
||||
assert_equal(
|
||||
smart_escape("<http://example.com>"),
|
||||
"<http://example.com>"
|
||||
);
|
||||
assert_string(
|
||||
"<http://example.com>",
|
||||
Geary.HTML.smart_escape("<http://example.com>")
|
||||
assert_equal(
|
||||
smart_escape("<http://example.com>"),
|
||||
"<http://example.com>"
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -94,13 +94,13 @@ px; }
|
|||
<style>
|
||||
.bodyblack { font-family: Verdana, """;
|
||||
|
||||
assert(Geary.HTML.html_to_text(HTML_BODY_COMPLETE) == HTML_BODY_COMPLETE_EXPECTED);
|
||||
assert(Geary.HTML.html_to_text(blockquote_body) == "hello\n there\n");
|
||||
assert(Geary.HTML.html_to_text(blockquote_body, false) == " there\n");
|
||||
assert(Geary.HTML.html_to_text(HTML_ENTITIES_BODY) == HTML_ENTITIES_EXPECTED);
|
||||
assert(Geary.HTML.html_to_text(style_complete) == "");
|
||||
assert(Geary.HTML.html_to_text(style_complete) == "");
|
||||
assert(Geary.HTML.html_to_text(style_truncated) == "");
|
||||
assert_equal(html_to_text(HTML_BODY_COMPLETE), HTML_BODY_COMPLETE_EXPECTED);
|
||||
assert_equal(html_to_text(blockquote_body), "hello\n there\n");
|
||||
assert_equal(html_to_text(blockquote_body, false), " there\n");
|
||||
assert_equal(html_to_text(HTML_ENTITIES_BODY), HTML_ENTITIES_EXPECTED);
|
||||
assert_string(html_to_text(style_complete)).is_empty();
|
||||
assert_string(html_to_text(style_complete)).is_empty();
|
||||
assert_string(html_to_text(style_truncated)).is_empty();
|
||||
}
|
||||
|
||||
private static string HTML_BODY_COMPLETE = """<html><head>
|
||||
|
|
|
|||
|
|
@ -26,7 +26,8 @@ class Geary.IdleManagerTest : TestCase {
|
|||
}
|
||||
|
||||
private void do_stuff(string arg) {
|
||||
assert(false);
|
||||
// This should never get called
|
||||
GLib.assert(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ class Geary.TimeoutManagerTest : TestCase {
|
|||
|
||||
private void do_stuff(string arg) {
|
||||
// This should never get called
|
||||
assert(false);
|
||||
GLib.assert(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -87,7 +87,7 @@ class Geary.TimeoutManagerTest : TestCase {
|
|||
this.main_loop.iteration(true);
|
||||
}
|
||||
|
||||
assert_double(timer.elapsed(), 1.0, SECONDS_EPSILON);
|
||||
assert_within(timer.elapsed(), 1.0, SECONDS_EPSILON);
|
||||
}
|
||||
|
||||
public void milliseconds() throws Error {
|
||||
|
|
@ -101,7 +101,7 @@ class Geary.TimeoutManagerTest : TestCase {
|
|||
this.main_loop.iteration(true);
|
||||
}
|
||||
|
||||
assert_double(timer.elapsed(), 0.1, MILLISECONDS_EPSILON);
|
||||
assert_within(timer.elapsed(), 0.1, MILLISECONDS_EPSILON);
|
||||
}
|
||||
|
||||
public void repeat_forever() throws Error {
|
||||
|
|
@ -118,7 +118,7 @@ class Geary.TimeoutManagerTest : TestCase {
|
|||
}
|
||||
timer.stop();
|
||||
|
||||
assert_double(timer.elapsed(), 2.0, SECONDS_EPSILON * 2);
|
||||
assert_within(timer.elapsed(), 2.0, SECONDS_EPSILON * 2);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class ClientPageStateTest : ClientWebViewTestCase<ClientWebView> {
|
|||
try {
|
||||
ClientWebView.load_resources(GLib.File.new_for_path("/tmp"));
|
||||
} catch (GLib.Error err) {
|
||||
assert_not_reached();
|
||||
GLib.assert_not_reached();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class Composer.PageStateTest : ClientWebViewTestCase<Composer.WebView> {
|
|||
try {
|
||||
WebView.load_resources();
|
||||
} catch (Error err) {
|
||||
assert_not_reached();
|
||||
GLib.assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,72 +28,72 @@ class ConversationPageStateTest : ClientWebViewTestCase<ConversationWebView> {
|
|||
try {
|
||||
ConversationWebView.load_resources();
|
||||
} catch (GLib.Error err) {
|
||||
assert_not_reached();
|
||||
GLib.assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
||||
public void is_deceptive_text_not_url() throws Error {
|
||||
public void is_deceptive_text_not_url() throws GLib.Error {
|
||||
load_body_fixture("<p>my hovercraft is full of eels</p>");
|
||||
assert(exec_is_deceptive_text("ohhai!", "http://example.com") ==
|
||||
ConversationWebView.DeceptiveText.NOT_DECEPTIVE);
|
||||
}
|
||||
|
||||
public void is_deceptive_text_identical_text() throws Error {
|
||||
public void is_deceptive_text_identical_text() throws GLib.Error {
|
||||
load_body_fixture("<p>my hovercraft is full of eels</p>");
|
||||
assert(exec_is_deceptive_text("http://example.com", "http://example.com") ==
|
||||
ConversationWebView.DeceptiveText.NOT_DECEPTIVE);
|
||||
}
|
||||
|
||||
public void is_deceptive_text_matching_url() throws Error {
|
||||
public void is_deceptive_text_matching_url() throws GLib.Error {
|
||||
load_body_fixture("<p>my hovercraft is full of eels</p>");
|
||||
assert(exec_is_deceptive_text("example.com", "http://example.com") ==
|
||||
ConversationWebView.DeceptiveText.NOT_DECEPTIVE);
|
||||
}
|
||||
|
||||
public void is_deceptive_text_common_href_subdomain() throws Error {
|
||||
public void is_deceptive_text_common_href_subdomain() throws GLib.Error {
|
||||
load_body_fixture("<p>my hovercraft is full of eels</p>");
|
||||
assert(exec_is_deceptive_text("example.com", "http://foo.example.com") ==
|
||||
ConversationWebView.DeceptiveText.NOT_DECEPTIVE);
|
||||
}
|
||||
|
||||
public void is_deceptive_text_common_text_subdomain() throws Error {
|
||||
public void is_deceptive_text_common_text_subdomain() throws GLib.Error {
|
||||
load_body_fixture("<p>my hovercraft is full of eels</p>");
|
||||
assert(exec_is_deceptive_text("www.example.com", "http://example.com") ==
|
||||
ConversationWebView.DeceptiveText.NOT_DECEPTIVE);
|
||||
}
|
||||
|
||||
public void is_deceptive_text_deceptive_href() throws Error {
|
||||
public void is_deceptive_text_deceptive_href() throws GLib.Error {
|
||||
load_body_fixture("<p>my hovercraft is full of eels</p>");
|
||||
assert(exec_is_deceptive_text("www.example.com", "ohhai!") ==
|
||||
ConversationWebView.DeceptiveText.DECEPTIVE_HREF);
|
||||
}
|
||||
|
||||
public void is_deceptive_text_non_matching_subdomain() throws Error {
|
||||
public void is_deceptive_text_non_matching_subdomain() throws GLib.Error {
|
||||
load_body_fixture("<p>my hovercraft is full of eels</p>");
|
||||
assert(exec_is_deceptive_text("www.example.com", "phishing.com") ==
|
||||
ConversationWebView.DeceptiveText.DECEPTIVE_DOMAIN);
|
||||
}
|
||||
|
||||
public void is_deceptive_text_different_domain() throws Error {
|
||||
public void is_deceptive_text_different_domain() throws GLib.Error {
|
||||
load_body_fixture("<p>my hovercraft is full of eels</p>");
|
||||
assert(exec_is_deceptive_text("www.example.com", "phishing.net") ==
|
||||
ConversationWebView.DeceptiveText.DECEPTIVE_DOMAIN);
|
||||
}
|
||||
|
||||
public void is_deceptive_text_embedded_domain() throws Error {
|
||||
public void is_deceptive_text_embedded_domain() throws GLib.Error {
|
||||
load_body_fixture("<p>my hovercraft is full of eels</p>");
|
||||
assert(exec_is_deceptive_text("Check out why phishing.net is bad!", "example.com") ==
|
||||
ConversationWebView.DeceptiveText.NOT_DECEPTIVE);
|
||||
}
|
||||
|
||||
public void is_deceptive_text_innocuous() throws Error {
|
||||
public void is_deceptive_text_innocuous() throws GLib.Error {
|
||||
// https://gitlab.gnome.org/GNOME/geary/issues/400
|
||||
load_body_fixture("<p>my hovercraft is full of eels</p>");
|
||||
assert(exec_is_deceptive_text("This will be fixed in the next freedesktop-sdk release (18.08.30)", "example.com") ==
|
||||
ConversationWebView.DeceptiveText.NOT_DECEPTIVE);
|
||||
}
|
||||
|
||||
public void is_deceptive_text_gitlab() throws Error {
|
||||
public void is_deceptive_text_gitlab() throws GLib.Error {
|
||||
// Link text in gitlab is "@user.name", which was previously false positive (@ can't be part of a domain)
|
||||
load_body_fixture("<p>my hovercraft is full of eels</p>");
|
||||
assert(exec_is_deceptive_text("@user.name", "http://gitlab.org/user.name") ==
|
||||
|
|
@ -161,9 +161,11 @@ class ConversationPageStateTest : ClientWebViewTestCase<ConversationWebView> {
|
|||
return new ConversationWebView(this.config);
|
||||
}
|
||||
|
||||
private uint exec_is_deceptive_text(string text, string href) {
|
||||
private uint exec_is_deceptive_text(string text, string href)
|
||||
throws GLib.Error {
|
||||
uint ret = 0;
|
||||
try {
|
||||
return (uint) Util.JS.to_int32(
|
||||
ret = (uint) Util.JS.to_int32(
|
||||
run_javascript(@"ConversationPageState.isDeceptiveText(\"$text\", \"$href\")")
|
||||
.get_js_value()
|
||||
);
|
||||
|
|
@ -174,6 +176,7 @@ class ConversationPageStateTest : ClientWebViewTestCase<ConversationWebView> {
|
|||
print("WKError: %s\n", err.message);
|
||||
assert_not_reached();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
subdir('data')
|
||||
|
||||
geary_test_engine_sources = [
|
||||
'test-engine.vala',
|
||||
'test-case.vala',
|
||||
'test-server.vala',
|
||||
'test-engine.vala',
|
||||
|
||||
# These should be included in the test lib sources, but we can't
|
||||
# since that would make the test lib depend on geary-engine.vapi,
|
||||
|
|
@ -67,6 +68,7 @@ geary_test_engine_sources = [
|
|||
]
|
||||
|
||||
geary_test_client_sources = [
|
||||
'test-case.vala',
|
||||
'test-client.vala',
|
||||
|
||||
# These should be included in the test lib sources, but we can't
|
||||
|
|
@ -98,6 +100,7 @@ geary_test_client_sources = [
|
|||
]
|
||||
|
||||
geary_test_integration_sources = [
|
||||
'test-case.vala',
|
||||
'test-integration.vala',
|
||||
|
||||
'integration/imap/client-session.vala',
|
||||
|
|
|
|||
40
test/test-case.vala
Normal file
40
test/test-case.vala
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Copyright 2020 Michael Gratton <mike@vee.net>
|
||||
*
|
||||
* This software is licensed under the GNU Lesser General Public License
|
||||
* (version 2.1 or later). See the COPYING file in this distribution.
|
||||
*/
|
||||
|
||||
/** Base class for Geary unit tests. */
|
||||
public class TestCase : ValaUnit.TestCase {
|
||||
|
||||
/** GLib.File URI for resources in test/data. */
|
||||
public const string RESOURCE_URI = "resource:///org/gnome/GearyTest";
|
||||
|
||||
|
||||
public TestCase(string name) {
|
||||
base(name);
|
||||
}
|
||||
|
||||
public void delete_file(File parent) throws GLib.Error {
|
||||
FileInfo info = parent.query_info(
|
||||
"standard::*",
|
||||
FileQueryInfoFlags.NOFOLLOW_SYMLINKS
|
||||
);
|
||||
|
||||
if (info.get_file_type () == FileType.DIRECTORY) {
|
||||
FileEnumerator enumerator = parent.enumerate_children(
|
||||
"standard::*",
|
||||
FileQueryInfoFlags.NOFOLLOW_SYMLINKS
|
||||
);
|
||||
|
||||
info = null;
|
||||
while (((info = enumerator.next_file()) != null)) {
|
||||
delete_file(parent.get_child(info.get_name()));
|
||||
}
|
||||
}
|
||||
|
||||
parent.delete();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -52,22 +52,22 @@ int main(string[] args) {
|
|||
|
||||
// Keep this before other ClientWebView based tests since it tests
|
||||
// WebContext init
|
||||
client.add_suite(new Accounts.ManagerTest().get_suite());
|
||||
client.add_suite(new Application.ClientTest().get_suite());
|
||||
client.add_suite(new Application.ConfigurationTest().get_suite());
|
||||
client.add_suite(new ClientWebViewTest().get_suite());
|
||||
client.add_suite(new Composer.WebViewTest().get_suite());
|
||||
client.add_suite(new Components.ValidatorTest().get_suite());
|
||||
client.add_suite(new Util.Avatar.Test().get_suite());
|
||||
client.add_suite(new Util.Cache.Test().get_suite());
|
||||
client.add_suite(new Util.Email.Test().get_suite());
|
||||
client.add_suite(new Util.JS.Test().get_suite());
|
||||
client.add_suite(new Accounts.ManagerTest().suite);
|
||||
client.add_suite(new Application.ClientTest().suite);
|
||||
client.add_suite(new Application.ConfigurationTest().suite);
|
||||
client.add_suite(new ClientWebViewTest().suite);
|
||||
client.add_suite(new Composer.WebViewTest().suite);
|
||||
client.add_suite(new Components.ValidatorTest().suite);
|
||||
client.add_suite(new Util.Avatar.Test().suite);
|
||||
client.add_suite(new Util.Cache.Test().suite);
|
||||
client.add_suite(new Util.Email.Test().suite);
|
||||
client.add_suite(new Util.JS.Test().suite);
|
||||
|
||||
TestSuite js = new TestSuite("js");
|
||||
|
||||
js.add_suite(new ClientPageStateTest().get_suite());
|
||||
js.add_suite(new Composer.PageStateTest().get_suite());
|
||||
js.add_suite(new ConversationPageStateTest().get_suite());
|
||||
js.add_suite(new ClientPageStateTest().suite);
|
||||
js.add_suite(new Composer.PageStateTest().suite);
|
||||
js.add_suite(new ConversationPageStateTest().suite);
|
||||
|
||||
/*
|
||||
* Run the tests
|
||||
|
|
|
|||
|
|
@ -33,64 +33,64 @@ int main(string[] args) {
|
|||
|
||||
TestSuite engine = new TestSuite("engine");
|
||||
|
||||
engine.add_suite(new Geary.AccountInformationTest().get_suite());
|
||||
engine.add_suite(new Geary.AttachmentTest().get_suite());
|
||||
engine.add_suite(new Geary.ContactHarvesterImplTest().get_suite());
|
||||
engine.add_suite(new Geary.EngineTest().get_suite());
|
||||
engine.add_suite(new Geary.FolderPathTest().get_suite());
|
||||
engine.add_suite(new Geary.IdleManagerTest().get_suite());
|
||||
engine.add_suite(new Geary.TimeoutManagerTest().get_suite());
|
||||
engine.add_suite(new Geary.TlsNegotiationMethodTest().get_suite());
|
||||
engine.add_suite(new Geary.App.ConversationTest().get_suite());
|
||||
engine.add_suite(new Geary.App.ConversationSetTest().get_suite());
|
||||
engine.add_suite(new Geary.AccountInformationTest().suite);
|
||||
engine.add_suite(new Geary.AttachmentTest().suite);
|
||||
engine.add_suite(new Geary.ContactHarvesterImplTest().suite);
|
||||
engine.add_suite(new Geary.EngineTest().suite);
|
||||
engine.add_suite(new Geary.FolderPathTest().suite);
|
||||
engine.add_suite(new Geary.IdleManagerTest().suite);
|
||||
engine.add_suite(new Geary.TimeoutManagerTest().suite);
|
||||
engine.add_suite(new Geary.TlsNegotiationMethodTest().suite);
|
||||
engine.add_suite(new Geary.App.ConversationTest().suite);
|
||||
engine.add_suite(new Geary.App.ConversationSetTest().suite);
|
||||
// Depends on ConversationTest and ConversationSetTest passing
|
||||
engine.add_suite(new Geary.App.ConversationMonitorTest().get_suite());
|
||||
engine.add_suite(new Geary.Ascii.Test().get_suite());
|
||||
engine.add_suite(new Geary.ConfigFileTest().get_suite());
|
||||
engine.add_suite(new Geary.Db.DatabaseTest().get_suite());
|
||||
engine.add_suite(new Geary.Db.VersionedDatabaseTest().get_suite());
|
||||
engine.add_suite(new Geary.HTML.UtilTest().get_suite());
|
||||
engine.add_suite(new Geary.App.ConversationMonitorTest().suite);
|
||||
engine.add_suite(new Geary.Ascii.Test().suite);
|
||||
engine.add_suite(new Geary.ConfigFileTest().suite);
|
||||
engine.add_suite(new Geary.Db.DatabaseTest().suite);
|
||||
engine.add_suite(new Geary.Db.VersionedDatabaseTest().suite);
|
||||
engine.add_suite(new Geary.HTML.UtilTest().suite);
|
||||
|
||||
// Other IMAP tests rely on these working, so test them first
|
||||
engine.add_suite(new Geary.Imap.DataFormatTest().get_suite());
|
||||
engine.add_suite(new Geary.Imap.DataFormatTest().suite);
|
||||
|
||||
engine.add_suite(new Geary.Imap.CreateCommandTest().get_suite());
|
||||
engine.add_suite(new Geary.Imap.FetchCommandTest().get_suite());
|
||||
engine.add_suite(new Geary.Imap.ListParameterTest().get_suite());
|
||||
engine.add_suite(new Geary.Imap.MailboxSpecifierTest().get_suite());
|
||||
engine.add_suite(new Geary.Imap.NamespaceResponseTest().get_suite());
|
||||
engine.add_suite(new Geary.Imap.CreateCommandTest().suite);
|
||||
engine.add_suite(new Geary.Imap.FetchCommandTest().suite);
|
||||
engine.add_suite(new Geary.Imap.ListParameterTest().suite);
|
||||
engine.add_suite(new Geary.Imap.MailboxSpecifierTest().suite);
|
||||
engine.add_suite(new Geary.Imap.NamespaceResponseTest().suite);
|
||||
|
||||
// Depends on IMAP commands working
|
||||
engine.add_suite(new Geary.Imap.DeserializerTest().get_suite());
|
||||
engine.add_suite(new Geary.Imap.ClientConnectionTest().get_suite());
|
||||
engine.add_suite(new Geary.Imap.ClientSessionTest().get_suite());
|
||||
engine.add_suite(new Geary.Imap.DeserializerTest().suite);
|
||||
engine.add_suite(new Geary.Imap.ClientConnectionTest().suite);
|
||||
engine.add_suite(new Geary.Imap.ClientSessionTest().suite);
|
||||
|
||||
engine.add_suite(new Geary.ImapDB.AccountTest().get_suite());
|
||||
engine.add_suite(new Geary.ImapDB.AttachmentTest().get_suite());
|
||||
engine.add_suite(new Geary.ImapDB.AttachmentIoTest().get_suite());
|
||||
engine.add_suite(new Geary.ImapDB.DatabaseTest().get_suite());
|
||||
engine.add_suite(new Geary.ImapDB.EmailIdentifierTest().get_suite());
|
||||
engine.add_suite(new Geary.ImapDB.FolderTest().get_suite());
|
||||
engine.add_suite(new Geary.ImapDB.AccountTest().suite);
|
||||
engine.add_suite(new Geary.ImapDB.AttachmentTest().suite);
|
||||
engine.add_suite(new Geary.ImapDB.AttachmentIoTest().suite);
|
||||
engine.add_suite(new Geary.ImapDB.DatabaseTest().suite);
|
||||
engine.add_suite(new Geary.ImapDB.EmailIdentifierTest().suite);
|
||||
engine.add_suite(new Geary.ImapDB.FolderTest().suite);
|
||||
|
||||
engine.add_suite(new Geary.ImapEngine.AccountProcessorTest().get_suite());
|
||||
engine.add_suite(new Geary.ImapEngine.GenericAccountTest().get_suite());
|
||||
engine.add_suite(new Geary.ImapEngine.AccountProcessorTest().suite);
|
||||
engine.add_suite(new Geary.ImapEngine.GenericAccountTest().suite);
|
||||
|
||||
// Depends on ImapDb.Database working correctly
|
||||
engine.add_suite(new Geary.ContactStoreImplTest().get_suite());
|
||||
engine.add_suite(new Geary.ContactStoreImplTest().suite);
|
||||
|
||||
engine.add_suite(new Geary.Inet.Test().get_suite());
|
||||
engine.add_suite(new Geary.Mime.ContentTypeTest().get_suite());
|
||||
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.MessageDataTest().get_suite());
|
||||
engine.add_suite(new Geary.RFC822.PartTest().get_suite());
|
||||
engine.add_suite(new Geary.RFC822.Utils.Test().get_suite());
|
||||
engine.add_suite(new Geary.Inet.Test().suite);
|
||||
engine.add_suite(new Geary.Mime.ContentTypeTest().suite);
|
||||
engine.add_suite(new Geary.Outbox.EmailIdentifierTest().suite);
|
||||
engine.add_suite(new Geary.RFC822.MailboxAddressTest().suite);
|
||||
engine.add_suite(new Geary.RFC822.MailboxAddressesTest().suite);
|
||||
engine.add_suite(new Geary.RFC822.MessageDataTest().suite);
|
||||
engine.add_suite(new Geary.RFC822.PartTest().suite);
|
||||
engine.add_suite(new Geary.RFC822.Utils.Test().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());
|
||||
engine.add_suite(new Geary.RFC822.MessageTest().suite);
|
||||
engine.add_suite(new Geary.String.Test().suite);
|
||||
engine.add_suite(new Geary.ComposedEmailTest().suite);
|
||||
|
||||
/*
|
||||
* Run the tests
|
||||
|
|
|
|||
|
|
@ -48,15 +48,11 @@ int main(string[] args) {
|
|||
|
||||
switch (config.type) {
|
||||
case IMAP:
|
||||
integration.add_suite(
|
||||
new Integration.Imap.ClientSession(config).get_suite()
|
||||
);
|
||||
integration.add_suite(new Integration.Imap.ClientSession(config).suite);
|
||||
break;
|
||||
|
||||
case SMTP:
|
||||
integration.add_suite(
|
||||
new Integration.Smtp.ClientSession(config).get_suite()
|
||||
);
|
||||
integration.add_suite(new Integration.Smtp.ClientSession(config).suite);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue