assertArrayEquals

Asserts that the associative arrays are equal.

  1. void assertArrayEquals(T[] expected, U[] actual, string msg, string file, size_t line)
  2. void assertArrayEquals(T[l1] expected, U[l2] actual, string msg, string file, size_t line)
  3. void assertArrayEquals(T[V] expected, U[V] actual, string msg, string file, size_t line)
    pure
    void
    assertArrayEquals
    (
    T
    U
    V
    )
    (
    in T[V] expected
    ,
    in U[V] actual
    ,
    lazy string msg = null
    ,
    string file = __FILE__
    ,
    size_t line = __LINE__
    )
  4. void assertAssocArrayEquals(T[V] expected, U[V] actual, string msg, string file, size_t line)

Throws

AssertException otherwise

Examples

int[string] expected = ["foo" : 1, "bar" : 2];

assertArrayEquals(expected, ["foo" : 1, "bar" : 2]);
assertAssocArrayEquals(expected, ["foo" : 1, "bar" : 2]);

AssertException exception;

exception = expectThrows!AssertException(assertArrayEquals(expected, ["foo" : 2]));
assertEquals(`mismatch at key "foo"; expected: <1> but was: <2>`, exception.msg);
exception = expectThrows!AssertException(assertArrayEquals(expected, ["foo" : 1]));
assertEquals(`key mismatch; difference: "bar"`, exception.msg);
exception = expectThrows!AssertException(assertAssocArrayEquals(expected, ["foo" : 2]));
assertEquals(`mismatch at key "foo"; expected: <1> but was: <2>`, exception.msg);
exception = expectThrows!AssertException(assertAssocArrayEquals(expected, ["foo" : 1]));
assertEquals(`key mismatch; difference: "bar"`, exception.msg);

Meta