vala-unit: Minor test fixups
This commit is contained in:
parent
41de9e537b
commit
6ea5e43168
1 changed files with 21 additions and 4 deletions
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue