TestCase

A test case that will be executed

Constructors

this
this(TestCase testCase)
this
this(string suiteName, string name, T func, Label[] labels, SourceLocation location)
this
this(string suiteName, string name, TestCaseFunction func, Label[] labels)
this
this(string suiteName, string name, TestCaseDelegate func, Label[] labels)

Members

Functions

toString
string toString()
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

func
TestCaseDelegate func;

The function that must be executed to check if the test passes or not. In case of failure, an exception is thrown.

labels
Label[] labels;

A list of labels that will be added to the final report

location
SourceLocation location;

The test location

name
string name;

The test name

suiteName
string suiteName;

The test case suite name. It can contain . which is treated as a separator for nested suites

Examples

TestCase string representation should be a JSON string

void MockTest() {}

auto testCase = TestCase("some suite", "some name", &MockTest, [ Label("label1", "value1"), Label("label2", "value2") ]);
testCase.location = SourceLocation("file.d", 42);

testCase.toString.should.equal(`{ "suiteName": "some suite", "name": "some name", ` ~
  `"labels": [ { "name": "label1", "value": "value1" }, { "name": "label2", "value": "value2" } ], ` ~
  `"location": { "fileName": "file.d", "line": 42 } }`);

Meta