Label

A struct representing a label for test results

Members

Functions

toString
string toString()

Convert the struct to a JSON string

Static functions

fromJson
Label fromJson(string value)
fromJsonArray
Label[] fromJsonArray(string value)

Variables

name
string name;

The label name

value
string value;

The label value

Examples

Label string representation should be in Json format

Label("name", "value").toString.should.equal(`{ "name": "name", "value": "value" }`);

create a label from a json object

auto label = Label.fromJson(`{ "name": "name", "value": "value" }`);

label.name.should.equal("name");
label.value.should.equal("value");

create a label list from a json array

auto labels = Label.fromJsonArray(`[{ "name": "name1", "value": "value1" }, { "name": "name2", "value": "value2" }]`);

labels.should.equal([ Label("name1", "value1"), Label("name2", "value2") ]);

Meta