AssertException otherwise
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);
Asserts that the associative arrays are equal.