Assert.Is¶
Name | - | Description | Default | Type |
---|---|---|---|---|
<input> |
The input can be of any type. | Any |
||
<output> |
The output will be the input (passthrough). | Any |
||
Value |
The value to test against for equality. | None |
Any |
|
Break |
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 4 5 6 7 8 |
|
1 2 3 4 5 6 7 8 9 10 11 |
|
[error] Failed assertion Is, input: 7 expected: 8
[error] Shard activation error, failed shard: Assert.Is, error: Assert failed - Is, line: 0, column: 0
[warning] Maybe shard Ignored an error: Assert failed - Is
1 2 3 4 5 6 7 8 |
|
1 2 3 4 5 6 7 8 9 |
|
[error] Failed assertion Is, input: 7 expected: 8
[error] Shard activation error, failed shard: Assert.Is, error: Assert failed - Is, line: 0, column: 0
[warning] Maybe shard Ignored an error: Assert failed - Is