Skip to content

Assert.IsNot

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
Abort If we should abort the process on failure. false Bool

This assertion is used to check whether the input is different from a given value.

Details

In this shard it's the inequality that's asserted. This means the assertion is considered successful if input to this shard does not match the :Value parameter of this shard.

The rest of behaviour of this shard (including the impact of the value of the :Abort parameter) is identical to Assert.Is.

Just like Assert.Is, this shard too can be used for writing (inline) unit test cases.

Examples

1
2
3
4
5
6
7
8
;; :Abort = `true`, assertion true
;; => log no errors and don't abort program
8
(Assert.IsNot
 ;:Value
 16
 ;:Abort
 true)

 

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
;; :Abort = `true`, assertion false
;; => abort the program
8
(Maybe
 (Assert.IsNot
  ;:Value
  8
  ;:Abort
  ;; uncomment next line to abort program on run
  ;true
  ))
[error] Failed assertion IsNot, input: 8 not expected: 8
[error] Shard activation error, failed shard: Assert.IsNot, error: Assert failed - IsNot
[warning] Maybe shard Ignored an error: Assert failed - IsNot

 

1
2
3
4
5
6
7
8
;; :Abort = `false`, assertion true
;; => log no errors and don't abort program
8
(Assert.IsNot
 ;:Value
 16
 ;:Abort
 false)

 

1
2
3
4
5
6
7
8
9
;; :Abort = `false`, assertion false
;; => log assertion error but don't abort program
8
(Maybe
 (Assert.IsNot
  ;:Value
  8
  ;:Abort
  false))
[error] Failed assertion IsNot, input: 8 not expected: 8
[error] Shard activation error, failed shard: Assert.IsNot, error: Assert failed - IsNot
[warning] Maybe shard Ignored an error: Assert failed - IsNot