Skip to content

Conversation

@vhenriet-sfy
Copy link

This patch modifies the assert module to support indexed assertions on spy calls through a new entry point: assert.spy_call(spy, n).

It allows making assertions about a specific call by index in a clear and explicit way.

Example usage:

local s = spy(function() end)
s("foo")
s("bar")

assert.spy_call(s, 1).was_called_with("foo")
assert.spy_call(s, 2).was_called_with("bar")

This makes it possible to verify the order and arguments of individual calls without relying on global state or chaining. Each assertion remains pure, isolated, and compatible with Luassert’s philosophy.

No breaking changes.

…spy_call

This patch modifies the assert module to support indexed assertions on spy calls
through a new entry point: `assert.spy_call(spy, n)`.

It allows making assertions about a specific call by index in a clear and explicit way.

Example usage:

  local s = spy(function() end)
  s("foo")
  s("bar")

  assert.spy_call(s, 1).was_called_with("foo")
  assert.spy_call(s, 2).was_called_with("bar")

This makes it possible to verify the order and arguments of individual calls
without relying on global state or chaining. Each assertion remains pure,
isolated, and compatible with Luassert’s philosophy.

No breaking changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant