Module luatest
Methods
Update default options. See luatest.runner:run for the list of available options.
Parameters:
- options: (tab) list of options to update (default $(def))
Returns:
options after update
EPS is meant to help with Lua’s floating point math in simple corner cases like almost_equals(1.1-0.1, 1), which may not work as-is (e.g. on numbers with rational binary representation) if the user doesn’t provide some explicit error margin.
The default margin used by almost_equals() in such cases is EPS; and since Lua may be compiled with different numeric precisions (single vs. double), we try to select a useful default for it dynamically. Note: If the initial value is not acceptable, it can be changed by the user to better suit specific needs.
Check that value is truthy.
Parameters:
- value:
- message: (string) (optional)
- …: (optional)
Returns:
input values
Check that two floats are close by margin.
Parameters:
- actual: (number)
- expected: (number)
- margin: (number)
- message: (string) (optional)
Checks that actual map includes expected one.
Parameters:
- actual: (tab)
- expected: (tab)
- message: (string) (optional)
Check that two values are equal. Tables are compared by value.
Parameters:
- actual:
- expected:
- message: (string) (optional)
- deep_analysis: (bool) print diff. (optional)
Check that calling fn raises an error.
Parameters:
- fn: (func)
- …: arguments for function
Strips location info from message text.
Parameters:
- expected: (string)
- fn: (func)
- …: arguments for function
Checks full error: location and text.
Parameters:
- expected: (string)
- fn: (func)
- …: arguments for function
Check that left is greater than or equal to right.
Parameters:
- left: (number)
- right: (number)
- message: (string) (optional)
Check that left is greater than right.
Parameters:
- left: (number)
- right: (number)
- message: (string) (optional)
Checks that two tables contain the same items, irrespective of their keys.
Parameters:
- actual:
- expected:
- message: (string) (optional)
Checks that one table includes all items of another, irrespective of their keys.
Parameters:
- actual:
- expected:
- message: (string) (optional)
Check that left is less than or equal to right.
Parameters:
- left: (number)
- right: (number)
- message: (string) (optional)
Check that left is less than right.
Parameters:
- left: (number)
- right: (number)
- message: (string) (optional)
Check that two floats are not close by margin.
Parameters:
- actual: (number)
- expected: (number)
- margin: (number)
- message: (string) (optional)
Checks that map does not contain the other one.
Parameters:
- actual: (tab)
- expected: (tab)
- message: (string) (optional)
Check that two values are not equal. Tables are compared by value.
Parameters:
- actual:
- expected:
- message: (string) (optional)
Case-sensitive strings comparison.
Parameters:
Case-insensitive strings comparison.
Parameters:
Case-sensitive strings comparison.
Parameters:
Case-insensitive strings comparison.
Parameters:
Verify a full match for the string.
Parameters:
Check value’s type.
Parameters: