[geary/mjog/mail-merge-plugin: 44/74] vala-unit: Minor test fixups
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/mjog/mail-merge-plugin: 44/74] vala-unit: Minor test fixups
- Date: Fri, 14 Aug 2020 02:09:04 +0000 (UTC)
commit 7c308c002473dbb18b5ce8fde83c15c4640a7740
Author: Michael Gratton <mike vee net>
Date: Fri Jul 3 18:08:39 2020 +1000
vala-unit: Minor test fixups
subprojects/vala-unit/src/test-assertions.vala | 25 +++++++++++++++++++++----
1 file changed, 21 insertions(+), 4 deletions(-)
---
diff --git a/subprojects/vala-unit/src/test-assertions.vala b/subprojects/vala-unit/src/test-assertions.vala
index b14786019..784dd9fdd 100644
--- a/subprojects/vala-unit/src/test-assertions.vala
+++ b/subprojects/vala-unit/src/test-assertions.vala
@@ -194,7 +194,7 @@ namespace ValaUnit {
private void assert_equal_enum<T>(T actual,
T expected,
string? context)
- throws TestError {
+ throws TestError {
int actual_val = (int) ((int?) actual);
int expected_val = (int) ((int?) expected);
if (actual_val != expected_val) {
@@ -203,8 +203,8 @@ namespace ValaUnit {
}
private void assert_equal_string(string? actual,
- string? expected,
- string? context)
+ string? expected,
+ string? context)
throws TestError {
string actual_val = (string) actual;
string expected_val = (string) expected;
@@ -353,7 +353,7 @@ public interface ValaUnit.TestAssertions : GLib.Object {
}
/** Asserts a value is null */
- public void assert_null<T>(T actual, string? context = null)
+ public void assert_is_null<T>(T actual, string? context = null)
throws TestError {
if (actual != null) {
ValaUnit.assert(
@@ -419,6 +419,17 @@ public interface ValaUnit.TestAssertions : GLib.Object {
return new ArrayCollectionAssertion<E>((E[]) actual, context);
}
+ /** Asserts an array is null */
+ public void assert_array_is_null<T>(T[]? actual, string? context = null)
+ throws TestError {
+ if (actual != null) {
+ ValaUnit.assert(
+ "%s is non-null, expected null".printf(typeof(T).name()),
+ context
+ );
+ }
+ }
+
/** Asserts a collection is non-null and empty. */
public CollectionAssertions<E> assert_collection<E>(
Gee.Collection<E>? actual,
@@ -522,6 +533,12 @@ public interface ValaUnit.TestAssertions : GLib.Object {
assert_true(actual, context);
}
+ /** Asserts a value is null. */
+ public void assert_null<T>(T actual, string? context = null)
+ throws TestError {
+ assert_is_null(actual, context);
+ }
+
/**
* Asserts this call is never made.
*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]