aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala/tests/common.vala
diff options
context:
space:
mode:
Diffstat (limited to 'xmpp-vala/tests/common.vala')
-rw-r--r--xmpp-vala/tests/common.vala8
1 files changed, 8 insertions, 0 deletions
diff --git a/xmpp-vala/tests/common.vala b/xmpp-vala/tests/common.vala
index b91bbf7c..c616d2e7 100644
--- a/xmpp-vala/tests/common.vala
+++ b/xmpp-vala/tests/common.vala
@@ -5,6 +5,7 @@ int main(string[] args) {
GLib.Test.set_nonfatal_assertions();
TestSuite.get_root().add_suite(new Xmpp.Test.StanzaTest().get_suite());
TestSuite.get_root().add_suite(new Xmpp.Test.UtilTest().get_suite());
+ TestSuite.get_root().add_suite(new Xmpp.Test.JidTest().get_suite());
return GLib.Test.run();
}
@@ -74,6 +75,13 @@ bool fail_if_not_eq_str(string? left, string? right, string? reason = null) {
return fail_if_not(!nullcheck && left == right, @"$(reason + ": " ?? "")$left != $right");
}
+bool fail_if_eq_str(string? left, string? right, string? reason = null) {
+ bool nullcheck = (left == null && right != null) || (left != null && right == null);
+ if (left == null) left = "(null)";
+ if (right == null) right = "(null)";
+ return fail_if(!nullcheck && left == right, @"$(reason + ": " ?? "")$left == $right");
+}
+
bool fail_if_not_eq_uint8_arr(uint8[] left, uint8[] right, string? reason = null) {
if (fail_if_not_eq_int(left.length, right.length, @"$(reason + ": " ?? "")array length not equal")) return true;
return fail_if_not_eq_str(Base64.encode(left), Base64.encode(right), reason);