lunarmodules / luassert

Assertion library for Lua
MIT License
203 stars 76 forks source link

assertion.returned_arguments.x appear to have the wrong assert failure message #195

Open matthiesenj opened 1 month ago

matthiesenj commented 1 month ago

The english localization (in en.lua) seems to have the wrong assertion messages. They mention arguments the function is called with, but the keys indicate, they refer to the number of values returned by said function.

s:set("assertion.returned_arguments.positive", "Expected to be called with %s argument(s), but was called with %s")
s:set("assertion.returned_arguments.negative", "Expected not to be called with %s argument(s), but was called with %s")

This is further backed up by the example on the front page which uses the assertion.returned_arguments together with a custom message that mentions return arguments:

assert.message("the function 'f' did not return 2 arguments").returned_arguments(2, f())

I haven't checked if other localizations are affected, too.

alerque commented 1 month ago

Contributions are welcome, I'll help facilitate any PRs that address this.