assertEmpty

Assert that an array is empty.

  1. void assertEmpty(A array, string message = "Failed asserting empty array", string file = __FILE__, size_t line = __LINE__)
    void
    assertEmpty
    (
    A
    )
    (
    ,
    string message = "Failed asserting empty array"
    ,
    string file = __FILE__
    ,
    size_t line = __LINE__
    )
    if (
    isArray!(A) ||
    isAssociativeArray!(A)
    )
  2. void assertEmpty(R range, string message = "Failed asserting empty range", string file = __FILE__, size_t line = __LINE__)

Parameters

array
Type: A

The array to interogate.

message
Type: string

The error message to display.

file
Type: string

The file name where the error occurred. The value is added automatically at the call site.

line
Type: size_t

The line where the error occurred. The value is added automatically at the call site.

Throws

DUnitAssertError if the assertation fails.

Examples

1 int[string] associativeArray;
2 int[] dynamicArray;
3 string string_;
4 
5 associativeArray.assertEmpty();
6 dynamicArray.assertEmpty();
7 string_.assertEmpty();
8 [].assertEmpty();
9 
10 // Assert a DUnitAssertError is thrown if assertEmpty fails.
11 [1].assertEmpty().assertThrow!(DUnitAssertError)("Failed asserting empty array");

Meta