Mercurial > vim
diff runtime/doc/testing.txt @ 17728:68ea27d26d5b v8.1.1861
patch 8.1.1861: only some assert functions can be used as a method
commit https://github.com/vim/vim/commit/24278d2407dfbc8d93eb36593cdd006ff5d86f94
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Aug 16 21:49:22 2019 +0200
patch 8.1.1861: only some assert functions can be used as a method
Problem: Only some assert functions can be used as a method.
Solution: Allow using most assert functions as a method.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 16 Aug 2019 22:00:04 +0200 |
parents | 072efa9ca875 |
children | f2c2f9126a82 |
line wrap: on
line diff
--- a/runtime/doc/testing.txt +++ b/runtime/doc/testing.txt @@ -206,6 +206,9 @@ assert_beeps({cmd}) *assert_beeps()* NOT produce a beep or visual bell. Also see |assert_fails()| and |assert-return|. + Can also be used as a |method|: > + GetCmd()->assert_beeps() +< *assert_equal()* assert_equal({expected}, {actual} [, {msg}]) When {expected} and {actual} are not equal an error message is @@ -255,6 +258,9 @@ assert_fails({cmd} [, {error} [, {msg}]] Note that beeping is not considered an error, and some failing commands only beep. Use |assert_beeps()| for those. + Can also be used as a |method|: > + GetCmd()->assert_fails('E99:') + assert_false({actual} [, {msg}]) *assert_false()* When {actual} is not false an error message is added to |v:errors|, like with |assert_equal()|. @@ -264,6 +270,9 @@ assert_false({actual} [, {msg}]) *ass When {msg} is omitted an error in the form "Expected False but got {actual}" is produced. + Can also be used as a |method|: > + GetResult()->assert_false() + assert_inrange({lower}, {upper}, {actual} [, {msg}]) *assert_inrange()* This asserts number and |Float| values. When {actual} is lower than {lower} or higher than {upper} an error message is added @@ -292,6 +301,9 @@ assert_match({pattern}, {actual} [, {msg < Will result in a string to be added to |v:errors|: test.vim line 12: Pattern '^f.*o$' does not match 'foobar' ~ + Can also be used as a |method|: > + getFile()->assert_match('foo.*') +< *assert_notequal()* assert_notequal({expected}, {actual} [, {msg}]) The opposite of `assert_equal()`: add an error message to @@ -307,6 +319,9 @@ assert_notmatch({pattern}, {actual} [, { |v:errors| when {pattern} matches {actual}. Also see |assert-return|. + Can also be used as a |method|: > + getFile()->assert_notmatch('bar.*') + assert_report({msg}) *assert_report()* Report a test failure directly, using {msg}. Always returns one. @@ -320,5 +335,8 @@ assert_true({actual} [, {msg}]) *asse When {msg} is omitted an error in the form "Expected True but got {actual}" is produced. + Can also be used as a |method|: > + GetResult()->assert_true() +< vim:tw=78:ts=8:noet:ft=help:norl: