Skip to content
Snippets Groups Projects
Unverified Commit d33e0635 authored by Gleb Kashkin's avatar Gleb Kashkin Committed by Igor Munkin
Browse files

compat: fix err msg in compat.<option>:is_new()

In the original commit 5f6d367c ("compat: add is_new and
is_old to options") `compat.<option_name>:is_new()` and `:is_old()`
were introduced, but by mistake they contained different usage
messages. This patch updates `:is_new()` usage msg to more
informative one from `:is_old()`.

Follows up #8807

NO_CHANGELOG=changelog from 5f6d367c is valid
NO_DOC=doc from 5f6d367c is valid

(cherry picked from commit f590ec22)
parent 380956f4
No related branches found
No related tags found
No related merge requests found
......@@ -406,7 +406,7 @@ function compat_mt.__index(_, key)
-- Whether the effective value of the option is `new`.
function result.is_new(option)
if type(option) ~= 'table' then
error('usage: compat.<option_name>:is_new()')
error(('usage: compat.%s:is_new()'):format(key))
end
if option.current == 'new' then
return true
......
......@@ -233,6 +233,12 @@ g.test_is_new_is_old = function()
local is_new = option_def.default == 'new'
t.assert_equals(compat[name]:is_new(), is_new)
t.assert_equals(compat[name]:is_old(), not is_new)
local err_pattern = 'usage: compat.%s:%s'
t.assert_error_msg_contains(err_pattern:format(name, 'is_new'),
compat[name].is_new, nil)
t.assert_error_msg_contains(err_pattern:format(name, 'is_old'),
compat[name].is_old, nil)
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment