From f73904f9d6b6129c6358e2a54521abda271127db Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 19 Jul 2024 12:12:13 +0800 Subject: vim-patch:eb6d733: runtime(doc): fix more inconsistencies in assert function docs (#29796) related: https://github.com/vim/vim/pull/15280#issuecomment-2233771449 closes: vim/vim#15285 https://github.com/vim/vim/commit/eb6d733bef312a0634770e023e8a41f0347f1503 --- src/nvim/eval.lua | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/nvim') diff --git a/src/nvim/eval.lua b/src/nvim/eval.lua index 7ca14693ef..4bc0827bcc 100644 --- a/src/nvim/eval.lua +++ b/src/nvim/eval.lua @@ -301,8 +301,8 @@ M.funcs = { added to |v:errors| and 1 is returned. Otherwise zero is returned. |assert-return| The error is in the form "Expected {expected} but got - {actual}". When {msg} is present it is prefixed to that, along - with the location of the assert when run from a script. + {actual}". When {msg} is present it is prefixed to that, + along with the location of the assert when run from a script. There is no automatic conversion, the String "4" is different from the Number 4. And the number 4 is different from the @@ -367,16 +367,16 @@ M.funcs = { When {error} is a string it must be found literally in the first reported error. Most often this will be the error code, including the colon, e.g. "E123:". >vim - assert_fails('bad cmd', 'E987:') + call assert_fails('bad cmd', 'E987:') < When {error} is a |List| with one or two strings, these are used as patterns. The first pattern is matched against the first reported error: >vim - assert_fails('cmd', ['E987:.*expected bool']) + call assert_fails('cmd', ['E987:.*expected bool']) vim - assert_fails('cmd', ['', 'E987:']) + call assert_fails('cmd', ['', 'E987:']) < If {msg} is empty then it is not used. Do this to get the default message when passing the {lnum} argument. @@ -412,8 +412,8 @@ M.funcs = { When {actual} is not false an error message is added to |v:errors|, like with |assert_equal()|. The error is in the form "Expected False but got {actual}". - When {msg} is present it is prepended to that, along - with the location of the assert when run from a script. + When {msg} is present it is prefixed to that, along with the + location of the assert when run from a script. Also see |assert-return|. A value is false when it is zero. When {actual} is not a @@ -460,7 +460,7 @@ M.funcs = { Use both to match the whole text. Example: >vim - assert_match('^f.*o$', 'foobar') + call assert_match('^f.*o$', 'foobar')