Module luatest | Tarantool
Документация на русском языке
поддерживается сообществом
Module luatest

Module luatest

Methods

Add after suite hook.

Parameters:

  • fn: (func)

Add before suite hook.

Parameters:

  • fn: (func)

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

Create group of tests.

Fields:

See also:

  • luatest.group

Class to manage tarantool instances.

See also:

  • luatest.server

Helpers.

See also:

  • luatest.helpers

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.

See also: https://en.wikipedia.org/wiki/Machine_epsilon

Parameters:

  • actual: (number)
  • expected: (number)
  • margin: (number)
  • message: (string) (optional)

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

Parameters:

  • expected_partial: (string)
  • 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

Parameters:

  • pattern: (string)
  • fn: (func)
  • …: arguments for function

Alias for assert_not.

Parameters:

  • value:
  • message: (string) (optional)

Alias for assert.

Parameters:

  • value:
  • message: (string) (optional)

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)

Check that values are the same.

Parameters:

  • actual:
  • expected:
  • message: (string) (optional)

Check that values are not the same.

Parameters:

  • actual:
  • expected:
  • 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)

Parameters:

  • value:
  • message: (string) (optional)

Check that value is falsy.

Parameters:

  • value:
  • 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)

Parameters:

  • value:
  • message: (string) (optional)

Case-sensitive strings comparison.

Parameters:

  • actual: (string)
  • expected: (string)
  • is_pattern: (bool) (optional)
  • message: (string) (optional)

Case-insensitive strings comparison.

Parameters:

Case-sensitive strings comparison.

Parameters:

  • value: (string)
  • expected: (string)
  • is_pattern: (bool) (optional)
  • message: (string) (optional)

Case-insensitive strings comparison.

Parameters:

Verify a full match for the string.

Parameters:

  • value: (string)
  • pattern: (string)
  • start: (int) (default $(def))
  • final: (int) (default $(def))
  • message: (string) (optional)

Check value’s type.

Parameters:

  • value: (string)
  • expected_type: (string)
  • message: (string) (optional)
  • level: (int) (optional)

Stops a test due to a failure.

Parameters:

Stops a test due to a failure if condition is met.

Parameters:

  • condition:
  • message: (string)

Skip a running test.

Parameters:

Skip a running test if condition is met.

Parameters:

  • condition:
  • message: (string)

Stops a test with a success.

Stops a test with a success if condition is met.

Parameters:

  • condition:

Mark a test as xfail.

Parameters:

Mark a test as xfail if condition is met

Parameters:

  • condition:
  • message: (string)
Нашли ответ на свой вопрос?
Обратная связь