diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-19 04:05:19 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-19 04:05:19 +0000 |
commit | a4e9136f68a40b1cb0eb6df5a5f06603224a87f4 (patch) | |
tree | ba32e0d0069ad6adfd6b32d05161a03eea5e4c7c /runtime/doc/testing.txt | |
parent | Releasing progress-linux version 2:9.1.0496-1~progress7.99u1. (diff) | |
download | vim-a4e9136f68a40b1cb0eb6df5a5f06603224a87f4.tar.xz vim-a4e9136f68a40b1cb0eb6df5a5f06603224a87f4.zip |
Merging upstream version 2:9.1.0698.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'runtime/doc/testing.txt')
-rw-r--r-- | runtime/doc/testing.txt | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/runtime/doc/testing.txt b/runtime/doc/testing.txt index ebf562b..7d0402c 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 Jun 17 +*testing.txt* For Vim version 9.1. Last change: 2024 Jul 18 VIM REFERENCE MANUAL by Bram Moolenaar @@ -506,16 +506,17 @@ 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. + {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 Float 4.0. The value of 'ignorecase' is not used here, case always matters. Example: > - assert_equal('foo', 'bar') -< Will result in a string to be added to |v:errors|: - test.vim line 12: Expected 'foo' but got 'bar' ~ + call assert_equal('foo', 'bar', 'baz') +< Will add the following to |v:errors|: + test.vim line 12: baz: Expected 'foo' but got 'bar' ~ Can also be used as a |method|, the base is passed as the second argument: > @@ -561,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. @@ -599,7 +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. + 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 @@ -625,7 +627,8 @@ assert_match({pattern}, {actual} [, {msg}]) When {pattern} does not match {actual} an error message is added to |v:errors|. Also see |assert-return|. The error is in the form "Pattern {pattern} does not match - {actual}". When {msg} is present it is prefixed to that. + {actual}". When {msg} is present it is prefixed to that, + along with the location of the assert when run from a script. {pattern} is used as with |=~|: The matching is always done like 'magic' was set and 'cpoptions' is empty, no matter what @@ -636,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.*') @@ -693,7 +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. + 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() |