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""");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue