0.1.2 • Published 5 years ago

assert.ahk v0.1.2

Weekly downloads
3
License
BSD-2-Clause
Repository
github
Last release
5 years ago

assert.ahk

A unit test framework for AutoHotkey

Installation

Install by defining the package in package.json:

"dependencies": {
	"assert.ahk": "chunjee/assert.ahk"
}
yarn newinstall

Usage

A class must be made that extends the assert class. Inside, the method name(s) must conclude with the case sensitive word 'Test'

Inside you have access to .AssertEqual, .AssertFalse, .AssertObject, .AssertEmpty, .AssertNotEmpty, and .AssertObjectEqual

class ExampleTestClass extends assert {
	; All of these tests pass
	PASS_Test() {
		; .AssertEqual
		this.AssertEqual("string", "string")
		this.AssertEqual(1, 1)

		; .AssertFalse
		this.AssertFalse(false)

		; .AssertObject
		this.AssertObject({a:1})

		; .AssertEmpty
		this.AssertEmpty("")

		; .AssertNotEmpty
		this.AssertNotEmpty(A_AppData)

		; .AssertObjectEqual
		this.AssertObjectEqual({a:1},{a:1})
	}
}

Pass the class as an argument to AhkUnit.AddTestClass and execute AhkUnit.Run()

AhkUnit.AddTestClass(ExampleTestClass)
AhkUnit.Run()
0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago