From 287a77ef51a7a12813d3fa6e1c49c595e5951ba5 Mon Sep 17 00:00:00 2001 From: Sean Dewar Date: Sat, 7 Aug 2021 01:28:52 +0100 Subject: vim-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. https://github.com/vim/vim/commit/24278d2407dfbc8d93eb36593cdd006ff5d86f94 Port tests to assert_spec.lua. --- runtime/doc/testing.txt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'runtime') diff --git a/runtime/doc/testing.txt b/runtime/doc/testing.txt index eca2025ed7..fc841dfc9c 100644 --- a/runtime/doc/testing.txt +++ b/runtime/doc/testing.txt @@ -53,6 +53,9 @@ assert_beeps({cmd}) *assert_beeps()* Also see |assert_fails()|, |assert_nobeep()| 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 @@ -100,6 +103,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()|. @@ -109,6 +115,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 @@ -137,6 +146,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_nobeep({cmd}) *assert_nobeep()* Run {cmd} and add an error message to |v:errors| if it produces a beep or visual bell. @@ -157,6 +169,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. @@ -170,5 +185,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: -- cgit