Struct Label
A struct representing a label for test results
struct Label
;
Fields
Name | Type | Description |
---|---|---|
name
|
string | The label name |
value
|
string | The label value |
Methods
Name | Description |
---|---|
fromJson
(value)
|
|
fromJsonArray
(value)
|
|
toString
()
|
Convert the struct to a JSON string |
Example
Label string representation should be in Json format
Label("name", "value") .toString .should .equal(`{ "name": "name", "value": "value" }`);
Example
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");
Example
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") ]);