Assertion.length

Asserts for the .length property or function value to equal some value.

struct Assertion(T)
@trusted
static if(hasLength!T || hasMember!(T, "string") || isSomeString!T)
U
length
(
U
)
(
U len
,
string file = __FILE__
,
size_t line = __LINE__
)

Examples

[1, 2, 3, 4].should.have.length(4);
"abcdefg".should.have.length(0);
// ^^ - Throws an Exception "expected 'abcdefg' to have length of 0"

Meta