QA

From MiniScript Wiki
Jump to navigation Jump to search

This system module provides functions for helping assure the quality of your code: assert conditions that you think should always be true, or otherwise check your assumptions and report when they fail.

Functions

Name Description
abort(errMsg) Prints a stack trace (optionally, after an error message), then exits the program.
assert(condition, desc) Abort if the given condition is not true. Error message can include the given (optional) description.
assertEqual(actual, expected, note) Abort if the first two parameters are not equal. Additional descriptive note is optional.
typeOf(value) Returns a the name of the data type as a String.
assertType(value, type, note) Abort if the first parameter is not of the specified type. Additional descriptive note is optional.

Example

  import "qa"

  test = function (data)
    qa.assertType(data, map)
  end function