Assert.Is¶
Name | Mandatory | Description | Default | Type |
---|---|---|---|---|
⬅️ Input |
The input can be of any type. | Any |
||
Output ➡️ |
The output will be the input (passthrough). | Any |
||
Value |
No | The value to test against for equality. | none |
Any |
Break |
No | If we should trigger a debug breakpoint on failure. | false |
Bool |
This assertion is used to check whether the input is equal to a given value.
Details¶
If the assertion is satisfied (i.e., the input is equal to or same as the :Value
parameter) the program will is allowed to continue (control passes to the next shard), irrespective of the :Break
parameter .
However, if the assertion fails, the program
- aborts with an error dump if the :Break
parameter is set to true
- logs an assertion validation error but continues running (control passes to the next wire scheduled on the mesh).
Since this shard can precisely control the conditions under which a program is allowed to run or is to be aborted, it's effective for writing (inline) unit test cases with it.
See also
Examples¶
1 2 3 |
|
1 2 3 4 5 |
|
[error] Failed assertion Is, input: 7 expected: 8
[error] Assert.Is -> Error: Assert failed - Is, Line: 4, Column: 3
[warning] Maybe shard Ignored an error: Assert failed - Is, line: 3, column: 5, wire: sample-wire
1 2 3 |
|
1 2 3 4 5 |
|
[error] Failed assertion Is, input: 7 expected: 8
[error] Assert.Is -> Error: Assert failed - Is, Line: 4, Column: 3
[warning] Maybe shard Ignored an error: Assert failed - Is, line: 3, column: 5, wire: sample-wire