Merge branch 'mjog/unit-test-subproject' into 'mainline'
Unit test subproject and cleanup See merge request GNOME/geary!517
This commit is contained in:
commit
cfbac77fa4
69 changed files with 3835 additions and 1667 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -75,9 +75,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 {
|
||||
|
|
@ -89,9 +89,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 {
|
||||
|
|
@ -103,9 +103,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 {
|
||||
|
|
@ -117,9 +117,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_flag() throws GLib.Error {
|
||||
|
|
@ -165,9 +165,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 {
|
||||
|
|
@ -358,7 +358,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;
|
||||
|
|
@ -401,6 +401,7 @@ class Geary.Imap.DeserializerTest : TestCase {
|
|||
|
||||
default:
|
||||
assert_not_reached();
|
||||
break;
|
||||
}
|
||||
|
||||
return message;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue