runtime(doc): fix more inconsistencies in assert function docs Commit: https://github.com/vim/vim/commit/eb6d733bef312a0634770e023e8a41f0347f1503 Author: zeertzjq <zeert...@outlook.com> Date: Thu Jul 18 21:16:05 2024 +0200
runtime(doc): fix more inconsistencies in assert function docs related: https://github.com/vim/vim/pull/15280#issuecomment-2233771449 closes: #15285 Signed-off-by: zeertzjq <zeert...@outlook.com> Signed-off-by: Christian Brabandt <c...@256bit.org> diff --git a/runtime/doc/testing.txt b/runtime/doc/testing.txt index 47ae85afb..7d0402c1b 100644 --- a/runtime/doc/testing.txt +++ b/runtime/doc/testing.txt @@ -1,4 +1,4 @@ -*testing.txt* For Vim version 9.1. Last change: 2024 Jul 17 +*testing.txt* For Vim version 9.1. Last change: 2024 Jul 18 VIM REFERENCE MANUAL by Bram Moolenaar @@ -506,8 +506,8 @@ assert_equal({expected}, {actual} [, {msg}]) 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 @@ -562,19 +562,19 @@ assert_fails({cmd} [, {error} [, {msg} [, {lnum} [, {context}]]]]) 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:". > - 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: > - assert_fails('cmd', ['E987:.*expected bool']) + call assert_fails('cmd', ['E987:.*expected bool']) < The second pattern, if present, is matched against the last reported error. If there is only one error then both patterns must match. This can be used to check that there is only one error. To only match the last error use an empty string for the first error: > - 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. @@ -600,8 +600,8 @@ assert_false({actual} [, {msg}]) *assert_false()* 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 @@ -639,9 +639,9 @@ assert_match({pattern}, {actual} [, {msg}]) Use both to match the whole text. Example: > - assert_match('^f.*o$', 'foobar') + call assert_match('^f.*o$', 'foobar') < Will result in a string to be added to |v:errors|: - test.vim line 12: Pattern '^f.*o$' does not match 'foobar' ~ + test.vim line 12: Pattern '^f.*o$' does not match 'foobar' ~ Can also be used as a |method|: > getFile()->assert_match('foo.*') @@ -696,8 +696,8 @@ assert_true({actual} [, {msg}]) *assert_true()* Also see |assert-return|. A value is TRUE when it is a non-zero number. When {actual} is not a number the assert fails. - When {msg} is given it precedes the default message, along - with the location of the assert when run from a script. + When {msg} is given it is prefixed to the default message, + along with the location of the assert when run from a script. Can also be used as a |method|: > GetResult()->assert_true() -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/E1sUWpK-00CUZW-26%40256bit.org.