🛑 Unsuitable for production until v1.0 is released.
Tests are awesome, but sometimes having a whole testing suite is not suitable.
Currently, only two function are provided
Assert(expression, context := '')
, ifexpression
is falsy, an error is thrown with the messagecontext
.AssertEquals(a, b, context := '')
, ifa
is not strictly equal tob
*, an error is thrown with the messagecontext
.
* If both a
and b
are both of type Array
or Map
, they are recursively checked by value or key/value respectively. Currently only supports the types number
, string
, Object
, Map
, and Array
.
; MyScript.test.ahk
#Include "MyScript.ahk"
; simple assertion
Assert(MyNumber() < 42, 'My number must be less than 42')
; compare array by value
AssertEquals(MyArray(), [1, 'test', [1,2,3]], 'My array must be a specific sequence of values')
; compare maps by key/value pairs
AssertEquals(MyMap(), Map('a', 42, 'b', 13.37, 'c', 'foo'), 'My map must always be in a specific way')
MIT © Vladimirs Nordholm