diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-08-16 21:49:22 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-08-16 21:49:22 +0200 |
commit | 24278d2407dfbc8d93eb36593cdd006ff5d86f94 (patch) | |
tree | 206d7e615bc0b42b9976e6ace2fb875718e21b14 /runtime/doc/testing.txt | |
parent | ea94c855163cf58a3389b5f3c54a0767c9e1be49 (diff) |
patch 8.1.1861: only some assert functions can be used as a methodv8.1.1861
Problem: Only some assert functions can be used as a method.
Solution: Allow using most assert functions as a method.
Diffstat (limited to 'runtime/doc/testing.txt')
-rw-r--r-- | runtime/doc/testing.txt | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/runtime/doc/testing.txt b/runtime/doc/testing.txt index b51a1e1d8c..0dbe014f21 100644 --- 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}]]) *assert_fails()* 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}]) *assert_false()* 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} [, {msg}]) |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}]) *assert_true()* 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: |