New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ensure.lua additions #54
base: master
Are you sure you want to change the base?
Conversation
lua-nucleo/ensure.lua
Outdated
local ensure_fails = function(msg, fn) | ||
local res, err = pcall(fn) | ||
|
||
if res ~= false then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
слишком строгая типизация
if not res
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Заметь, там "не равно". Т.е. правильно if res
Во втором месте (ensure_fails_with_substring) тоже поправить?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
это хороший вопрос. не знаю. как понять, надо ли?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ну, логично, что надо, для единообразия)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ОК, допустим
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
3971714
to
2b3cd6b
Compare
@@ -14,3 +14,4 @@ Rafis Ganeyev <rafisganeyev@gmail.com> | |||
Mark Gurevich <markgurevichster@gmail.com> | |||
Vladimir Stebunov <vstebunov@gmail.com> | |||
Sergey Ledyankin <sirgeika@gmail.com> | |||
Ivan Epifanov <isage.dna@gmail.com> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
принято, вынести отдельно если этот PR не вольём
if is_error_object(err) then | ||
err = get_error_id(err) | ||
end | ||
|
||
if type(err) ~= "string" then | ||
error("ensure_fails_with_substring failed: " .. msg .. ": call failed with non-string error") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
принято, дать отдельно если этот PR не вольём
@@ -366,7 +366,7 @@ end | |||
local ensure_fails_with_substring = function(msg, fn, substring) | |||
local res, err = pcall(fn) | |||
|
|||
if res ~= false then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
неправильный и пугающий commit message. переименовать во что-то типа
ensure_fails_with_substring: allow nil as error value
думай о том, как собирать из таких commit message release notes. представь, что у тебя есть только git shortlog и больше никуда нельзя смотреть.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
311c8b2
to
4e1fc39
Compare
…ng error object support
Depends on #53