198056533SBram Moolenaar*testing.txt* For Vim version 8.2. Last change: 2019 Sep 08 2ed997adaSBram Moolenaar 3ed997adaSBram Moolenaar 4ed997adaSBram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar 5ed997adaSBram Moolenaar 6ed997adaSBram Moolenaar 7ed997adaSBram MoolenaarTesting Vim and Vim script *testing-support* 8ed997adaSBram Moolenaar 9ed997adaSBram MoolenaarExpression evaluation is explained in |eval.txt|. This file goes into details 10ed997adaSBram Moolenaarabout writing tests in Vim script. This can be used for testing Vim itself 11ed997adaSBram Moolenaarand for testing plugins. 12ed997adaSBram Moolenaar 13ed997adaSBram Moolenaar1. Testing Vim |testing| 145477506aSBram Moolenaar2. Test functions |test-functions-details| 155477506aSBram Moolenaar3. Assert functions |assert-functions-details| 16ed997adaSBram Moolenaar 17ed997adaSBram Moolenaar============================================================================== 18ed997adaSBram Moolenaar1. Testing Vim *testing* 19ed997adaSBram Moolenaar 20ed997adaSBram MoolenaarVim can be tested after building it, usually with "make test". 21ed997adaSBram MoolenaarThe tests are located in the directory "src/testdir". 22ed997adaSBram Moolenaar 23ed997adaSBram MoolenaarThere are several types of tests added over time: 24ed997adaSBram Moolenaar test33.in oldest, don't add any of these 25ed997adaSBram Moolenaar test_something.in old style tests 26ed997adaSBram Moolenaar test_something.vim new style tests 27ed997adaSBram Moolenaar 28ed997adaSBram Moolenaar *new-style-testing* 29ed997adaSBram MoolenaarNew tests should be added as new style tests. These use functions such as 30ed997adaSBram Moolenaar|assert_equal()| to keep the test commands and the expected result in one 31ed997adaSBram Moolenaarplace. 32ed997adaSBram Moolenaar *old-style-testing* 33ed997adaSBram MoolenaarIn some cases an old style test needs to be used. E.g. when testing Vim 34ed997adaSBram Moolenaarwithout the |+eval| feature. 35ed997adaSBram Moolenaar 36ed997adaSBram MoolenaarFind more information in the file src/testdir/README.txt. 37ed997adaSBram Moolenaar 38ed997adaSBram Moolenaar============================================================================== 395477506aSBram Moolenaar2. Test functions *test-functions-details* 40ed997adaSBram Moolenaar 41ed997adaSBram Moolenaartest_alloc_fail({id}, {countdown}, {repeat}) *test_alloc_fail()* 42ed997adaSBram Moolenaar This is for testing: If the memory allocation with {id} is 43ed997adaSBram Moolenaar called, then decrement {countdown}, and when it reaches zero 44ed997adaSBram Moolenaar let memory allocation fail {repeat} times. When {repeat} is 45ed997adaSBram Moolenaar smaller than one it fails one time. 46ed997adaSBram Moolenaar 47ce90e36fSBram Moolenaar Can also be used as a |method|: > 48ce90e36fSBram Moolenaar GetAllocId()->test_alloc_fail() 49ed997adaSBram Moolenaar 50ed997adaSBram Moolenaartest_autochdir() *test_autochdir()* 51ed997adaSBram Moolenaar Set a flag to enable the effect of 'autochdir' before Vim 52ed997adaSBram Moolenaar startup has finished. 53ed997adaSBram Moolenaar 54ed997adaSBram Moolenaar 55*07ada5ffSBram Moolenaartest_clear_search_pat() *test_clear_search_pat()* 56*07ada5ffSBram Moolenaar Clears the last used search pattern (|/|) and the substitute 57*07ada5ffSBram Moolenaar pattern (|:s|). This is useful for testing conditions where 58*07ada5ffSBram Moolenaar these patterns are not set previously. 59*07ada5ffSBram Moolenaar 60ed997adaSBram Moolenaartest_feedinput({string}) *test_feedinput()* 61ed997adaSBram Moolenaar Characters in {string} are queued for processing as if they 62ed997adaSBram Moolenaar were typed by the user. This uses a low level input buffer. 63ed997adaSBram Moolenaar This function works only when with |+unix| or GUI is running. 64ed997adaSBram Moolenaar 65ce90e36fSBram Moolenaar Can also be used as a |method|: > 66ce90e36fSBram Moolenaar GetText()->test_feedinput() 67ed997adaSBram Moolenaar 68ed997adaSBram Moolenaartest_garbagecollect_now() *test_garbagecollect_now()* 69ed997adaSBram Moolenaar Like garbagecollect(), but executed right away. This must 70ed997adaSBram Moolenaar only be called directly to avoid any structure to exist 71ed997adaSBram Moolenaar internally, and |v:testing| must have been set before calling 72ed997adaSBram Moolenaar any function. 73ed997adaSBram Moolenaar 74ed997adaSBram Moolenaar 75ed997adaSBram Moolenaartest_garbagecollect_soon() *test_garbagecollect_soon()* 76ed997adaSBram Moolenaar Set the flag to call the garbagecollector as if in the main 77ed997adaSBram Moolenaar loop. Only to be used in tests. 78ed997adaSBram Moolenaar 79ed997adaSBram Moolenaar 80ed997adaSBram Moolenaartest_getvalue({name}) *test_getvalue()* 81ed997adaSBram Moolenaar Get the value of an internal variable. These values for 82ed997adaSBram Moolenaar {name} are supported: 83ed997adaSBram Moolenaar need_fileinfo 84ed997adaSBram Moolenaar 85ce90e36fSBram Moolenaar Can also be used as a |method|: > 86ce90e36fSBram Moolenaar GetName()->test_getvalue() 87ed997adaSBram Moolenaar 88ed997adaSBram Moolenaartest_ignore_error({expr}) *test_ignore_error()* 89ed997adaSBram Moolenaar Ignore any error containing {expr}. A normal message is given 90ed997adaSBram Moolenaar instead. 91ed997adaSBram Moolenaar This is only meant to be used in tests, where catching the 92ed997adaSBram Moolenaar error with try/catch cannot be used (because it skips over 93ed997adaSBram Moolenaar following code). 94ed997adaSBram Moolenaar {expr} is used literally, not as a pattern. 95ed997adaSBram Moolenaar When the {expr} is the string "RESET" then the list of ignored 96ed997adaSBram Moolenaar errors is made empty. 97ed997adaSBram Moolenaar 98ce90e36fSBram Moolenaar Can also be used as a |method|: > 99ce90e36fSBram Moolenaar GetErrorText()->test_ignore_error() 100ed997adaSBram Moolenaar 101ed997adaSBram Moolenaartest_null_blob() *test_null_blob()* 102ed997adaSBram Moolenaar Return a |Blob| that is null. Only useful for testing. 103ed997adaSBram Moolenaar 104ed997adaSBram Moolenaar 105ed997adaSBram Moolenaartest_null_channel() *test_null_channel()* 106ed997adaSBram Moolenaar Return a |Channel| that is null. Only useful for testing. 107ed997adaSBram Moolenaar {only available when compiled with the +channel feature} 108ed997adaSBram Moolenaar 109ed997adaSBram Moolenaar 110ed997adaSBram Moolenaartest_null_dict() *test_null_dict()* 111ed997adaSBram Moolenaar Return a |Dict| that is null. Only useful for testing. 112ed997adaSBram Moolenaar 113ed997adaSBram Moolenaar 114ed997adaSBram Moolenaartest_null_job() *test_null_job()* 115ed997adaSBram Moolenaar Return a |Job| that is null. Only useful for testing. 116ed997adaSBram Moolenaar {only available when compiled with the +job feature} 117ed997adaSBram Moolenaar 118ed997adaSBram Moolenaar 119ed997adaSBram Moolenaartest_null_list() *test_null_list()* 120ed997adaSBram Moolenaar Return a |List| that is null. Only useful for testing. 121ed997adaSBram Moolenaar 122ed997adaSBram Moolenaar 123ed997adaSBram Moolenaartest_null_partial() *test_null_partial()* 124ed997adaSBram Moolenaar Return a |Partial| that is null. Only useful for testing. 125ed997adaSBram Moolenaar 126ed997adaSBram Moolenaar 127ed997adaSBram Moolenaartest_null_string() *test_null_string()* 128ed997adaSBram Moolenaar Return a |String| that is null. Only useful for testing. 129ed997adaSBram Moolenaar 130ed997adaSBram Moolenaar 131ed997adaSBram Moolenaartest_option_not_set({name}) *test_option_not_set()* 132ed997adaSBram Moolenaar Reset the flag that indicates option {name} was set. Thus it 133ed997adaSBram Moolenaar looks like it still has the default value. Use like this: > 134ed997adaSBram Moolenaar set ambiwidth=double 135ed997adaSBram Moolenaar call test_option_not_set('ambiwidth') 136ed997adaSBram Moolenaar< Now the 'ambiwidth' option behaves like it was never changed, 137ed997adaSBram Moolenaar even though the value is "double". 138ed997adaSBram Moolenaar Only to be used for testing! 139ed997adaSBram Moolenaar 140ce90e36fSBram Moolenaar Can also be used as a |method|: > 141ce90e36fSBram Moolenaar GetOptionName()->test_option_not_set() 142ce90e36fSBram Moolenaar 143ed997adaSBram Moolenaar 144ed997adaSBram Moolenaartest_override({name}, {val}) *test_override()* 145ed997adaSBram Moolenaar Overrides certain parts of Vim's internal processing to be able 146ed997adaSBram Moolenaar to run tests. Only to be used for testing Vim! 147ed997adaSBram Moolenaar The override is enabled when {val} is non-zero and removed 148ed997adaSBram Moolenaar when {val} is zero. 149ed997adaSBram Moolenaar Current supported values for name are: 150ed997adaSBram Moolenaar 151ed997adaSBram Moolenaar name effect when {val} is non-zero ~ 152ed997adaSBram Moolenaar redraw disable the redrawing() function 153ed997adaSBram Moolenaar redraw_flag ignore the RedrawingDisabled flag 154ed997adaSBram Moolenaar char_avail disable the char_avail() function 155ed997adaSBram Moolenaar starting reset the "starting" variable, see below 156ed997adaSBram Moolenaar nfa_fail makes the NFA regexp engine fail to force a 157ed997adaSBram Moolenaar fallback to the old engine 158ed997adaSBram Moolenaar no_query_mouse do not query the mouse position for "dec" 159ed997adaSBram Moolenaar terminals 160ed997adaSBram Moolenaar no_wait_return set the "no_wait_return" flag. Not restored 161ed997adaSBram Moolenaar with "ALL". 162ed997adaSBram Moolenaar ALL clear all overrides ({val} is not used) 163ed997adaSBram Moolenaar 164ed997adaSBram Moolenaar "starting" is to be used when a test should behave like 165ed997adaSBram Moolenaar startup was done. Since the tests are run by sourcing a 166ed997adaSBram Moolenaar script the "starting" variable is non-zero. This is usually a 167ed997adaSBram Moolenaar good thing (tests run faster), but sometimes changes behavior 168ed997adaSBram Moolenaar in a way that the test doesn't work properly. 169ed997adaSBram Moolenaar When using: > 170ed997adaSBram Moolenaar call test_override('starting', 1) 171ed997adaSBram Moolenaar< The value of "starting" is saved. It is restored by: > 172ed997adaSBram Moolenaar call test_override('starting', 0) 173ed997adaSBram Moolenaar 174ce90e36fSBram Moolenaar< Can also be used as a |method|: > 175ce90e36fSBram Moolenaar GetOverrideVal()-> test_override('starting') 176ed997adaSBram Moolenaar 177ed997adaSBram Moolenaartest_refcount({expr}) *test_refcount()* 178ed997adaSBram Moolenaar Return the reference count of {expr}. When {expr} is of a 179ed997adaSBram Moolenaar type that does not have a reference count, returns -1. Only 180ed997adaSBram Moolenaar to be used for testing. 181ed997adaSBram Moolenaar 182ce90e36fSBram Moolenaar Can also be used as a |method|: > 183ce90e36fSBram Moolenaar GetVarname()->test_refcount() 184ce90e36fSBram Moolenaar 185ed997adaSBram Moolenaar 186ed997adaSBram Moolenaartest_scrollbar({which}, {value}, {dragging}) *test_scrollbar()* 187ed997adaSBram Moolenaar Pretend using scrollbar {which} to move it to position 188ed997adaSBram Moolenaar {value}. {which} can be: 189ed997adaSBram Moolenaar left Left scrollbar of the current window 190ed997adaSBram Moolenaar right Right scrollbar of the current window 191ed997adaSBram Moolenaar hor Horizontal scrollbar 192ed997adaSBram Moolenaar 193ed997adaSBram Moolenaar For the vertical scrollbars {value} can be 1 to the 194ed997adaSBram Moolenaar line-count of the buffer. For the horizontal scrollbar the 195ed997adaSBram Moolenaar {value} can be between 1 and the maximum line length, assuming 196ed997adaSBram Moolenaar 'wrap' is not set. 197ed997adaSBram Moolenaar 198ed997adaSBram Moolenaar When {dragging} is non-zero it's like dragging the scrollbar, 199ed997adaSBram Moolenaar otherwise it's like clicking in the scrollbar. 200ed997adaSBram Moolenaar Only works when the {which} scrollbar actually exists, 201ed997adaSBram Moolenaar obviously only when using the GUI. 202ed997adaSBram Moolenaar 203ce90e36fSBram Moolenaar Can also be used as a |method|: > 204ce90e36fSBram Moolenaar GetValue()->test_scrollbar('right', 0) 205ed997adaSBram Moolenaar 206ed997adaSBram Moolenaartest_setmouse({row}, {col}) *test_setmouse()* 207ed997adaSBram Moolenaar Set the mouse position to be used for the next mouse action. 208ed997adaSBram Moolenaar {row} and {col} are one based. 209ed997adaSBram Moolenaar For example: > 210ed997adaSBram Moolenaar call test_setmouse(4, 20) 211ed997adaSBram Moolenaar call feedkeys("\<LeftMouse>", "xt") 212ed997adaSBram Moolenaar 213ed997adaSBram Moolenaar 214ed997adaSBram Moolenaartest_settime({expr}) *test_settime()* 215ed997adaSBram Moolenaar Set the time Vim uses internally. Currently only used for 216ed997adaSBram Moolenaar timestamps in the history, as they are used in viminfo, and 217ed997adaSBram Moolenaar for undo. 218ed997adaSBram Moolenaar Using a value of 1 makes Vim not sleep after a warning or 219ed997adaSBram Moolenaar error message. 220ed997adaSBram Moolenaar {expr} must evaluate to a number. When the value is zero the 221ed997adaSBram Moolenaar normal behavior is restored. 222ed997adaSBram Moolenaar 223ce90e36fSBram Moolenaar Can also be used as a |method|: > 224ce90e36fSBram Moolenaar GetTime()->test_settime() 225ce90e36fSBram Moolenaar 226ed997adaSBram Moolenaar============================================================================== 2275477506aSBram Moolenaar3. Assert functions *assert-functions-details* 228ed997adaSBram Moolenaar 229ed997adaSBram Moolenaar 230ed997adaSBram Moolenaarassert_beeps({cmd}) *assert_beeps()* 231ed997adaSBram Moolenaar Run {cmd} and add an error message to |v:errors| if it does 232ed997adaSBram Moolenaar NOT produce a beep or visual bell. 233ed997adaSBram Moolenaar Also see |assert_fails()| and |assert-return|. 234ed997adaSBram Moolenaar 23524278d24SBram Moolenaar Can also be used as a |method|: > 23624278d24SBram Moolenaar GetCmd()->assert_beeps() 23724278d24SBram Moolenaar< 238ed997adaSBram Moolenaar *assert_equal()* 239ed997adaSBram Moolenaarassert_equal({expected}, {actual} [, {msg}]) 240ed997adaSBram Moolenaar When {expected} and {actual} are not equal an error message is 241ed997adaSBram Moolenaar added to |v:errors| and 1 is returned. Otherwise zero is 242ed997adaSBram Moolenaar returned |assert-return|. 243ed997adaSBram Moolenaar There is no automatic conversion, the String "4" is different 244ed997adaSBram Moolenaar from the Number 4. And the number 4 is different from the 245ed997adaSBram Moolenaar Float 4.0. The value of 'ignorecase' is not used here, case 246ed997adaSBram Moolenaar always matters. 247ed997adaSBram Moolenaar When {msg} is omitted an error in the form "Expected 248ed997adaSBram Moolenaar {expected} but got {actual}" is produced. 249ed997adaSBram Moolenaar Example: > 250ed997adaSBram Moolenaar assert_equal('foo', 'bar') 251ed997adaSBram Moolenaar< Will result in a string to be added to |v:errors|: 252ed997adaSBram Moolenaar test.vim line 12: Expected 'foo' but got 'bar' ~ 253ed997adaSBram Moolenaar 25425e42231SBram Moolenaar Can also be used as a |method|: > 25525e42231SBram Moolenaar mylist->assert_equal([1, 2, 3]) 25625e42231SBram Moolenaar 25725e42231SBram Moolenaar 25825e42231SBram Moolenaar< *assert_equalfile()* 259ed997adaSBram Moolenaarassert_equalfile({fname-one}, {fname-two}) 260ed997adaSBram Moolenaar When the files {fname-one} and {fname-two} do not contain 261ed997adaSBram Moolenaar exactly the same text an error message is added to |v:errors|. 262ed997adaSBram Moolenaar Also see |assert-return|. 263ed997adaSBram Moolenaar When {fname-one} or {fname-two} does not exist the error will 264ed997adaSBram Moolenaar mention that. 265ed997adaSBram Moolenaar Mainly useful with |terminal-diff|. 266ed997adaSBram Moolenaar 267e49fbff3SBram Moolenaar Can also be used as a |method|: > 268e49fbff3SBram Moolenaar GetLog()->assert_equalfile('expected.log') 269e49fbff3SBram Moolenaar 270e49fbff3SBram Moolenaar 271ed997adaSBram Moolenaarassert_exception({error} [, {msg}]) *assert_exception()* 272ed997adaSBram Moolenaar When v:exception does not contain the string {error} an error 273ed997adaSBram Moolenaar message is added to |v:errors|. Also see |assert-return|. 274ed997adaSBram Moolenaar This can be used to assert that a command throws an exception. 275ed997adaSBram Moolenaar Using the error number, followed by a colon, avoids problems 276ed997adaSBram Moolenaar with translations: > 277ed997adaSBram Moolenaar try 278ed997adaSBram Moolenaar commandthatfails 279ed997adaSBram Moolenaar call assert_false(1, 'command should have failed') 280ed997adaSBram Moolenaar catch 281ed997adaSBram Moolenaar call assert_exception('E492:') 282ed997adaSBram Moolenaar endtry 283ed997adaSBram Moolenaar 284ed997adaSBram Moolenaarassert_fails({cmd} [, {error} [, {msg}]]) *assert_fails()* 285ed997adaSBram Moolenaar Run {cmd} and add an error message to |v:errors| if it does 286ed997adaSBram Moolenaar NOT produce an error. Also see |assert-return|. 287ed997adaSBram Moolenaar When {error} is given it must match in |v:errmsg|. 288ed997adaSBram Moolenaar Note that beeping is not considered an error, and some failing 289ed997adaSBram Moolenaar commands only beep. Use |assert_beeps()| for those. 290ed997adaSBram Moolenaar 29124278d24SBram Moolenaar Can also be used as a |method|: > 29224278d24SBram Moolenaar GetCmd()->assert_fails('E99:') 29324278d24SBram Moolenaar 294ed997adaSBram Moolenaarassert_false({actual} [, {msg}]) *assert_false()* 295ed997adaSBram Moolenaar When {actual} is not false an error message is added to 296ed997adaSBram Moolenaar |v:errors|, like with |assert_equal()|. 297ed997adaSBram Moolenaar Also see |assert-return|. 298ed997adaSBram Moolenaar A value is false when it is zero. When {actual} is not a 299ed997adaSBram Moolenaar number the assert fails. 300ed997adaSBram Moolenaar When {msg} is omitted an error in the form 301ed997adaSBram Moolenaar "Expected False but got {actual}" is produced. 302ed997adaSBram Moolenaar 30324278d24SBram Moolenaar Can also be used as a |method|: > 30424278d24SBram Moolenaar GetResult()->assert_false() 30524278d24SBram Moolenaar 306ed997adaSBram Moolenaarassert_inrange({lower}, {upper}, {actual} [, {msg}]) *assert_inrange()* 307ed997adaSBram Moolenaar This asserts number and |Float| values. When {actual} is lower 308ed997adaSBram Moolenaar than {lower} or higher than {upper} an error message is added 309ed997adaSBram Moolenaar to |v:errors|. Also see |assert-return|. 310ed997adaSBram Moolenaar When {msg} is omitted an error in the form 311ed997adaSBram Moolenaar "Expected range {lower} - {upper}, but got {actual}" is 312ed997adaSBram Moolenaar produced. 313ed997adaSBram Moolenaar 314ed997adaSBram Moolenaar *assert_match()* 315ed997adaSBram Moolenaarassert_match({pattern}, {actual} [, {msg}]) 316ed997adaSBram Moolenaar When {pattern} does not match {actual} an error message is 317ed997adaSBram Moolenaar added to |v:errors|. Also see |assert-return|. 318ed997adaSBram Moolenaar 319ed997adaSBram Moolenaar {pattern} is used as with |=~|: The matching is always done 320ed997adaSBram Moolenaar like 'magic' was set and 'cpoptions' is empty, no matter what 321ed997adaSBram Moolenaar the actual value of 'magic' or 'cpoptions' is. 322ed997adaSBram Moolenaar 323ed997adaSBram Moolenaar {actual} is used as a string, automatic conversion applies. 324ed997adaSBram Moolenaar Use "^" and "$" to match with the start and end of the text. 325ed997adaSBram Moolenaar Use both to match the whole text. 326ed997adaSBram Moolenaar 327ed997adaSBram Moolenaar When {msg} is omitted an error in the form 328ed997adaSBram Moolenaar "Pattern {pattern} does not match {actual}" is produced. 329ed997adaSBram Moolenaar Example: > 330ed997adaSBram Moolenaar assert_match('^f.*o$', 'foobar') 331ed997adaSBram Moolenaar< Will result in a string to be added to |v:errors|: 332ed997adaSBram Moolenaar test.vim line 12: Pattern '^f.*o$' does not match 'foobar' ~ 333ed997adaSBram Moolenaar 33424278d24SBram Moolenaar Can also be used as a |method|: > 33524278d24SBram Moolenaar getFile()->assert_match('foo.*') 33624278d24SBram Moolenaar< 337ed997adaSBram Moolenaar *assert_notequal()* 338ed997adaSBram Moolenaarassert_notequal({expected}, {actual} [, {msg}]) 339ed997adaSBram Moolenaar The opposite of `assert_equal()`: add an error message to 340ed997adaSBram Moolenaar |v:errors| when {expected} and {actual} are equal. 341ed997adaSBram Moolenaar Also see |assert-return|. 342ed997adaSBram Moolenaar 34325e42231SBram Moolenaar Can also be used as a |method|: > 34425e42231SBram Moolenaar mylist->assert_notequal([1, 2, 3]) 34525e42231SBram Moolenaar 34625e42231SBram Moolenaar< *assert_notmatch()* 347ed997adaSBram Moolenaarassert_notmatch({pattern}, {actual} [, {msg}]) 348ed997adaSBram Moolenaar The opposite of `assert_match()`: add an error message to 349ed997adaSBram Moolenaar |v:errors| when {pattern} matches {actual}. 350ed997adaSBram Moolenaar Also see |assert-return|. 351ed997adaSBram Moolenaar 35224278d24SBram Moolenaar Can also be used as a |method|: > 35324278d24SBram Moolenaar getFile()->assert_notmatch('bar.*') 35424278d24SBram Moolenaar 355e49fbff3SBram Moolenaar 356ed997adaSBram Moolenaarassert_report({msg}) *assert_report()* 357ed997adaSBram Moolenaar Report a test failure directly, using {msg}. 358ed997adaSBram Moolenaar Always returns one. 359ed997adaSBram Moolenaar 360e49fbff3SBram Moolenaar Can also be used as a |method|: > 361e49fbff3SBram Moolenaar GetMessage()->assert_report() 362e49fbff3SBram Moolenaar 363e49fbff3SBram Moolenaar 364ed997adaSBram Moolenaarassert_true({actual} [, {msg}]) *assert_true()* 365ed997adaSBram Moolenaar When {actual} is not true an error message is added to 366ed997adaSBram Moolenaar |v:errors|, like with |assert_equal()|. 367ed997adaSBram Moolenaar Also see |assert-return|. 368ed997adaSBram Moolenaar A value is TRUE when it is a non-zero number. When {actual} 369ed997adaSBram Moolenaar is not a number the assert fails. 370ed997adaSBram Moolenaar When {msg} is omitted an error in the form "Expected True but 371ed997adaSBram Moolenaar got {actual}" is produced. 372ed997adaSBram Moolenaar 37324278d24SBram Moolenaar Can also be used as a |method|: > 37424278d24SBram Moolenaar GetResult()->assert_true() 37524278d24SBram Moolenaar< 376ed997adaSBram Moolenaar 377ed997adaSBram Moolenaar vim:tw=78:ts=8:noet:ft=help:norl: 378