Skip to content

Type Operations

Test type properties with these assertions.

beNull

Asserts that a value is null.

void delegate() action = null;
expect(action).to.beNull();

Negation

expect({ /* something */ }).to.not.beNull();

instanceOf

Asserts that an object is an instance of a specific class or interface.

class Animal {}
class Dog : Animal {}
auto dog = new Dog();
expect(dog).to.be.instanceOf!Dog;
expect(dog).to.be.instanceOf!Animal;

Negation

class Cat : Animal {}
expect(dog).to.not.be.instanceOf!Cat;