annotate runtime/doc/testing.txt @ 27257:68c33419fdc6 v8.2.4157

patch 8.2.4157: terminal test fails because Windows sets the title Commit: https://github.com/vim/vim/commit/ae1bd87fe84bfb31379bc5da351bca56a3d3b571 Author: ichizok <gclient.gaap@gmail.com> Date: Thu Jan 20 14:57:29 2022 +0000 patch 8.2.4157: terminal test fails because Windows sets the title Problem: Terminal test fails because Windows sets the title. Solution: Add the "vterm_title" testing override and use it in the test. (Ozaki Kiichi, closes #9556)
author Bram Moolenaar <Bram@vim.org>
date Thu, 20 Jan 2022 16:00:07 +0100
parents b19230a8d40a
children 3649b5a6b1b6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27162
b19230a8d40a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27116
diff changeset
1 *testing.txt* For Vim version 8.2. Last change: 2022 Jan 13
17456
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4 VIM REFERENCE MANUAL by Bram Moolenaar
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7 Testing Vim and Vim script *testing-support*
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9 Expression evaluation is explained in |eval.txt|. This file goes into details
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10 about writing tests in Vim script. This can be used for testing Vim itself
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11 and for testing plugins.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13 1. Testing Vim |testing|
17571
2704c4e3e20a Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 17456
diff changeset
14 2. Test functions |test-functions-details|
2704c4e3e20a Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 17456
diff changeset
15 3. Assert functions |assert-functions-details|
17456
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17 ==============================================================================
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18 1. Testing Vim *testing*
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 Vim can be tested after building it, usually with "make test".
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21 The tests are located in the directory "src/testdir".
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22
21779
30bdd2e4a6f9 patch 8.2.1439: tiny and small builds have no test coverage
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
23 There are two types of tests added over time:
30bdd2e4a6f9 patch 8.2.1439: tiny and small builds have no test coverage
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
24 test20.in oldest, only for tiny and small builds
30bdd2e4a6f9 patch 8.2.1439: tiny and small builds have no test coverage
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
25 test_something.vim new style tests
30bdd2e4a6f9 patch 8.2.1439: tiny and small builds have no test coverage
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
26
17456
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27 *new-style-testing*
21741
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21499
diff changeset
28 New tests should be added as new style tests. The test scripts are named
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21499
diff changeset
29 test_<feature>.vim (replace <feature> with the feature under test). These use
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21499
diff changeset
30 functions such as |assert_equal()| to keep the test commands and the expected
baccf9e06efe patch 8.2.1420: test 49 is old style
Bram Moolenaar <Bram@vim.org>
parents: 21499
diff changeset
31 result in one place.
21779
30bdd2e4a6f9 patch 8.2.1439: tiny and small builds have no test coverage
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
32 *old-style-testing*
30bdd2e4a6f9 patch 8.2.1439: tiny and small builds have no test coverage
Bram Moolenaar <Bram@vim.org>
parents: 21741
diff changeset
33 These tests are used only for testing Vim without the |+eval| feature.
17456
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35 Find more information in the file src/testdir/README.txt.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37 ==============================================================================
17571
2704c4e3e20a Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 17456
diff changeset
38 2. Test functions *test-functions-details*
17456
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40 test_alloc_fail({id}, {countdown}, {repeat}) *test_alloc_fail()*
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41 This is for testing: If the memory allocation with {id} is
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42 called, then decrement {countdown}, and when it reaches zero
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
43 let memory allocation fail {repeat} times. When {repeat} is
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44 smaller than one it fails one time.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45
18031
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
46 Can also be used as a |method|: >
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
47 GetAllocId()->test_alloc_fail()
17456
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48
25700
d4faa2c5211b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25619
diff changeset
49
17456
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
50 test_autochdir() *test_autochdir()*
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51 Set a flag to enable the effect of 'autochdir' before Vim
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52 startup has finished.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
53
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
55 test_feedinput({string}) *test_feedinput()*
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
56 Characters in {string} are queued for processing as if they
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
57 were typed by the user. This uses a low level input buffer.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
58 This function works only when with |+unix| or GUI is running.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
59
18031
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
60 Can also be used as a |method|: >
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
61 GetText()->test_feedinput()
17456
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62
25700
d4faa2c5211b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25619
diff changeset
63
17456
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
64 test_garbagecollect_now() *test_garbagecollect_now()*
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
65 Like garbagecollect(), but executed right away. This must
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
66 only be called directly to avoid any structure to exist
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
67 internally, and |v:testing| must have been set before calling
26591
3a63b1e4a6f4 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25973
diff changeset
68 any function. This will not work when called from a :def
3a63b1e4a6f4 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25973
diff changeset
69 function, because variables on the stack will be freed.
17456
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
70
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
71
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
72 test_garbagecollect_soon() *test_garbagecollect_soon()*
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
73 Set the flag to call the garbagecollector as if in the main
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
74 loop. Only to be used in tests.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
75
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
76
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
77 test_getvalue({name}) *test_getvalue()*
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
78 Get the value of an internal variable. These values for
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
79 {name} are supported:
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
80 need_fileinfo
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
81
18031
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
82 Can also be used as a |method|: >
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
83 GetName()->test_getvalue()
24982
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24387
diff changeset
84 <
25006
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
85 *test_gui_drop_files()*
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
86 test_gui_drop_files({list}, {row}, {col}, {mods})
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
87 Drop one or more files in {list} in the window at {row}, {col}.
25161
84c7dc0fdcd2 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25056
diff changeset
88 This function only works when the GUI is running and the
25973
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25700
diff changeset
89 |drop_file| feature is present.
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25700
diff changeset
90
25006
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
91 The supported values for {mods} are:
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
92 0x4 Shift
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
93 0x8 Alt
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
94 0x10 Ctrl
25973
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25700
diff changeset
95 The files are added to the |argument-list| and the first file
3b34837f4538 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25700
diff changeset
96 in {list} is edited in the window. See |drag-n-drop| for more
25006
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
97 information.
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
98
24982
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24387
diff changeset
99 *test_gui_mouse_event()*
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24387
diff changeset
100 test_gui_mouse_event({button}, {row}, {col}, {multiclick}, {modifiers})
25006
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
101 Inject a mouse button click event. This function only works
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
102 when the GUI is running.
24982
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24387
diff changeset
103 The supported values for {button} are:
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24387
diff changeset
104 0 right mouse button
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24387
diff changeset
105 1 middle mouse button
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24387
diff changeset
106 2 left mouse button
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24387
diff changeset
107 3 mouse button release
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24387
diff changeset
108 4 scroll wheel down
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24387
diff changeset
109 5 scroll wheel up
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24387
diff changeset
110 6 scroll wheel left
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24387
diff changeset
111 7 scroll wheel right
25006
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
112 {row} and {col} specify the location of the mouse click. The
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
113 first row of the Vim window is 1 and the last row is 'lines'.
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
114 The maximum value of {col} is 'columns'.
24982
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24387
diff changeset
115 To inject a multiclick event, set {multiclick} to 1.
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24387
diff changeset
116 The supported values for {modifiers} are:
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24387
diff changeset
117 4 shift is pressed
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24387
diff changeset
118 8 alt is pressed
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24387
diff changeset
119 16 ctrl is pressed
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24387
diff changeset
120 After injecting the mouse event you probably should call
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24387
diff changeset
121 |feedkeys()| to have them processed, e.g.: >
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24387
diff changeset
122 call feedkeys("y", 'Lx!')
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24387
diff changeset
123
17456
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
124
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
125 test_ignore_error({expr}) *test_ignore_error()*
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
126 Ignore any error containing {expr}. A normal message is given
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
127 instead.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
128 This is only meant to be used in tests, where catching the
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
129 error with try/catch cannot be used (because it skips over
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
130 following code).
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
131 {expr} is used literally, not as a pattern.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
132 When the {expr} is the string "RESET" then the list of ignored
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
133 errors is made empty.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
134
18031
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
135 Can also be used as a |method|: >
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
136 GetErrorText()->test_ignore_error()
17456
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
137
25700
d4faa2c5211b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25619
diff changeset
138
17456
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
139 test_null_blob() *test_null_blob()*
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
140 Return a |Blob| that is null. Only useful for testing.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
141
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
142
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
143 test_null_channel() *test_null_channel()*
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
144 Return a |Channel| that is null. Only useful for testing.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
145 {only available when compiled with the +channel feature}
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
146
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
147
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
148 test_null_dict() *test_null_dict()*
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
149 Return a |Dict| that is null. Only useful for testing.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
150
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
151
19874
f92435f0f449 patch 8.2.0493: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents: 19523
diff changeset
152 test_null_function() *test_null_function()*
19968
1908e92b02fd Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19874
diff changeset
153 Return a |Funcref| that is null. Only useful for testing.
19874
f92435f0f449 patch 8.2.0493: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents: 19523
diff changeset
154
f92435f0f449 patch 8.2.0493: Vim9: some error messages not tested
Bram Moolenaar <Bram@vim.org>
parents: 19523
diff changeset
155
17456
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
156 test_null_job() *test_null_job()*
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
157 Return a |Job| that is null. Only useful for testing.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
158 {only available when compiled with the +job feature}
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
159
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
160
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
161 test_null_list() *test_null_list()*
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
162 Return a |List| that is null. Only useful for testing.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
163
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
164
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
165 test_null_partial() *test_null_partial()*
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
166 Return a |Partial| that is null. Only useful for testing.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
167
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
168
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
169 test_null_string() *test_null_string()*
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
170 Return a |String| that is null. Only useful for testing.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
171
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
172
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
173 test_option_not_set({name}) *test_option_not_set()*
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
174 Reset the flag that indicates option {name} was set. Thus it
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
175 looks like it still has the default value. Use like this: >
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
176 set ambiwidth=double
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
177 call test_option_not_set('ambiwidth')
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
178 < Now the 'ambiwidth' option behaves like it was never changed,
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
179 even though the value is "double".
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
180 Only to be used for testing!
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
181
18031
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
182 Can also be used as a |method|: >
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
183 GetOptionName()->test_option_not_set()
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
184
17456
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
185
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
186 test_override({name}, {val}) *test_override()*
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
187 Overrides certain parts of Vim's internal processing to be able
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
188 to run tests. Only to be used for testing Vim!
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
189 The override is enabled when {val} is non-zero and removed
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
190 when {val} is zero.
27116
5b267700e6ab patch 8.2.4087: cannot test items from an autoload script easily
Bram Moolenaar <Bram@vim.org>
parents: 26591
diff changeset
191 Current supported values for {name} are:
17456
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
192
27116
5b267700e6ab patch 8.2.4087: cannot test items from an autoload script easily
Bram Moolenaar <Bram@vim.org>
parents: 26591
diff changeset
193 {name} effect when {val} is non-zero ~
5b267700e6ab patch 8.2.4087: cannot test items from an autoload script easily
Bram Moolenaar <Bram@vim.org>
parents: 26591
diff changeset
194 autoload `import autoload` will load the script right
5b267700e6ab patch 8.2.4087: cannot test items from an autoload script easily
Bram Moolenaar <Bram@vim.org>
parents: 26591
diff changeset
195 away, not postponed until an item is used
17456
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
196 char_avail disable the char_avail() function
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
197 nfa_fail makes the NFA regexp engine fail to force a
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
198 fallback to the old engine
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
199 no_query_mouse do not query the mouse position for "dec"
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
200 terminals
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
201 no_wait_return set the "no_wait_return" flag. Not restored
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
202 with "ALL".
27116
5b267700e6ab patch 8.2.4087: cannot test items from an autoload script easily
Bram Moolenaar <Bram@vim.org>
parents: 26591
diff changeset
203 redraw disable the redrawing() function
5b267700e6ab patch 8.2.4087: cannot test items from an autoload script easily
Bram Moolenaar <Bram@vim.org>
parents: 26591
diff changeset
204 redraw_flag ignore the RedrawingDisabled flag
5b267700e6ab patch 8.2.4087: cannot test items from an autoload script easily
Bram Moolenaar <Bram@vim.org>
parents: 26591
diff changeset
205 starting reset the "starting" variable, see below
5b267700e6ab patch 8.2.4087: cannot test items from an autoload script easily
Bram Moolenaar <Bram@vim.org>
parents: 26591
diff changeset
206 term_props reset all terminal properties when the version
5b267700e6ab patch 8.2.4087: cannot test items from an autoload script easily
Bram Moolenaar <Bram@vim.org>
parents: 26591
diff changeset
207 string is detected
20861
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20856
diff changeset
208 ui_delay time in msec to use in ui_delay(); overrules a
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 20856
diff changeset
209 wait time of up to 3 seconds for messages
24103
788e10cec9bd Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23305
diff changeset
210 uptime overrules sysinfo.uptime
27257
68c33419fdc6 patch 8.2.4157: terminal test fails because Windows sets the title
Bram Moolenaar <Bram@vim.org>
parents: 27162
diff changeset
211 vterm_title setting the window title by a job running in a
68c33419fdc6 patch 8.2.4157: terminal test fails because Windows sets the title
Bram Moolenaar <Bram@vim.org>
parents: 27162
diff changeset
212 terminal window
17456
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
213 ALL clear all overrides ({val} is not used)
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
214
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
215 "starting" is to be used when a test should behave like
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
216 startup was done. Since the tests are run by sourcing a
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
217 script the "starting" variable is non-zero. This is usually a
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
218 good thing (tests run faster), but sometimes changes behavior
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
219 in a way that the test doesn't work properly.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
220 When using: >
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
221 call test_override('starting', 1)
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
222 < The value of "starting" is saved. It is restored by: >
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
223 call test_override('starting', 0)
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
224
18031
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
225 < Can also be used as a |method|: >
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
226 GetOverrideVal()-> test_override('starting')
17456
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
227
25700
d4faa2c5211b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25619
diff changeset
228
17456
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
229 test_refcount({expr}) *test_refcount()*
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
230 Return the reference count of {expr}. When {expr} is of a
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
231 type that does not have a reference count, returns -1. Only
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
232 to be used for testing.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
233
18031
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
234 Can also be used as a |method|: >
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
235 GetVarname()->test_refcount()
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
236
17456
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
237
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
238 test_scrollbar({which}, {value}, {dragging}) *test_scrollbar()*
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
239 Pretend using scrollbar {which} to move it to position
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
240 {value}. {which} can be:
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
241 left Left scrollbar of the current window
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
242 right Right scrollbar of the current window
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
243 hor Horizontal scrollbar
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
244
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
245 For the vertical scrollbars {value} can be 1 to the
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
246 line-count of the buffer. For the horizontal scrollbar the
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
247 {value} can be between 1 and the maximum line length, assuming
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
248 'wrap' is not set.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
249
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
250 When {dragging} is non-zero it's like dragging the scrollbar,
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
251 otherwise it's like clicking in the scrollbar.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
252 Only works when the {which} scrollbar actually exists,
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
253 obviously only when using the GUI.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
254
18031
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
255 Can also be used as a |method|: >
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
256 GetValue()->test_scrollbar('right', 0)
17456
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
257
25700
d4faa2c5211b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25619
diff changeset
258
17456
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
259 test_setmouse({row}, {col}) *test_setmouse()*
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
260 Set the mouse position to be used for the next mouse action.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
261 {row} and {col} are one based.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
262 For example: >
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
263 call test_setmouse(4, 20)
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
264 call feedkeys("\<LeftMouse>", "xt")
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
265
25700
d4faa2c5211b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25619
diff changeset
266
17456
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
267 test_settime({expr}) *test_settime()*
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
268 Set the time Vim uses internally. Currently only used for
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
269 timestamps in the history, as they are used in viminfo, and
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
270 for undo.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
271 Using a value of 1 makes Vim not sleep after a warning or
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
272 error message.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
273 {expr} must evaluate to a number. When the value is zero the
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
274 normal behavior is restored.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
275
18031
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
276 Can also be used as a |method|: >
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
277 GetTime()->test_settime()
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
278
25700
d4faa2c5211b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25619
diff changeset
279
19350
76cb39bf1871 patch 8.2.0233: crash when using garbagecollect() in between rand()
Bram Moolenaar <Bram@vim.org>
parents: 19308
diff changeset
280 test_srand_seed([seed]) *test_srand_seed()*
76cb39bf1871 patch 8.2.0233: crash when using garbagecollect() in between rand()
Bram Moolenaar <Bram@vim.org>
parents: 19308
diff changeset
281 When [seed] is given this sets the seed value used by
76cb39bf1871 patch 8.2.0233: crash when using garbagecollect() in between rand()
Bram Moolenaar <Bram@vim.org>
parents: 19308
diff changeset
282 `srand()`. When omitted the test seed is removed.
76cb39bf1871 patch 8.2.0233: crash when using garbagecollect() in between rand()
Bram Moolenaar <Bram@vim.org>
parents: 19308
diff changeset
283
25700
d4faa2c5211b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25619
diff changeset
284
d4faa2c5211b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25619
diff changeset
285 test_unknown() *test_unknown()*
d4faa2c5211b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25619
diff changeset
286 Return a value with unknown type. Only useful for testing.
d4faa2c5211b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25619
diff changeset
287
d4faa2c5211b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25619
diff changeset
288
d4faa2c5211b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25619
diff changeset
289 test_void() *test_void()*
d4faa2c5211b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25619
diff changeset
290 Return a value with void type. Only useful for testing.
d4faa2c5211b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25619
diff changeset
291
17456
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
292 ==============================================================================
17571
2704c4e3e20a Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 17456
diff changeset
293 3. Assert functions *assert-functions-details*
17456
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
294
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
295
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
296 assert_beeps({cmd}) *assert_beeps()*
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
297 Run {cmd} and add an error message to |v:errors| if it does
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
298 NOT produce a beep or visual bell.
24307
55f458d35292 patch 8.2.2694: when 'matchpairs' is empty every character beeps
Bram Moolenaar <Bram@vim.org>
parents: 24103
diff changeset
299 Also see |assert_fails()|, |assert_nobeep()| and
55f458d35292 patch 8.2.2694: when 'matchpairs' is empty every character beeps
Bram Moolenaar <Bram@vim.org>
parents: 24103
diff changeset
300 |assert-return|.
17456
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
301
17728
68ea27d26d5b patch 8.1.1861: only some assert functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents: 17620
diff changeset
302 Can also be used as a |method|: >
68ea27d26d5b patch 8.1.1861: only some assert functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents: 17620
diff changeset
303 GetCmd()->assert_beeps()
68ea27d26d5b patch 8.1.1861: only some assert functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents: 17620
diff changeset
304 <
17456
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
305 *assert_equal()*
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
306 assert_equal({expected}, {actual} [, {msg}])
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
307 When {expected} and {actual} are not equal an error message is
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
308 added to |v:errors| and 1 is returned. Otherwise zero is
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
309 returned |assert-return|.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
310 There is no automatic conversion, the String "4" is different
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
311 from the Number 4. And the number 4 is different from the
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
312 Float 4.0. The value of 'ignorecase' is not used here, case
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
313 always matters.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
314 When {msg} is omitted an error in the form "Expected
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
315 {expected} but got {actual}" is produced.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
316 Example: >
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
317 assert_equal('foo', 'bar')
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
318 < Will result in a string to be added to |v:errors|:
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
319 test.vim line 12: Expected 'foo' but got 'bar' ~
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
320
21250
21fb2a3ad3ca Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 20965
diff changeset
321 Can also be used as a |method|, the base is passed as the
21fb2a3ad3ca Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 20965
diff changeset
322 second argument: >
17620
072efa9ca875 patch 8.1.1807: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents: 17571
diff changeset
323 mylist->assert_equal([1, 2, 3])
072efa9ca875 patch 8.1.1807: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents: 17571
diff changeset
324
072efa9ca875 patch 8.1.1807: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents: 17571
diff changeset
325 < *assert_equalfile()*
20679
1af1d8ff2aa8 patch 8.2.0893: assert_equalfile() does not take a third argument
Bram Moolenaar <Bram@vim.org>
parents: 19968
diff changeset
326 assert_equalfile({fname-one}, {fname-two} [, {msg}])
17456
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
327 When the files {fname-one} and {fname-two} do not contain
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
328 exactly the same text an error message is added to |v:errors|.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
329 Also see |assert-return|.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
330 When {fname-one} or {fname-two} does not exist the error will
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
331 mention that.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
332 Mainly useful with |terminal-diff|.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
333
17825
ce993ba17adb patch 8.1.1909: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17758
diff changeset
334 Can also be used as a |method|: >
ce993ba17adb patch 8.1.1909: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17758
diff changeset
335 GetLog()->assert_equalfile('expected.log')
ce993ba17adb patch 8.1.1909: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17758
diff changeset
336
17456
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
337 assert_exception({error} [, {msg}]) *assert_exception()*
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
338 When v:exception does not contain the string {error} an error
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
339 message is added to |v:errors|. Also see |assert-return|.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
340 This can be used to assert that a command throws an exception.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
341 Using the error number, followed by a colon, avoids problems
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
342 with translations: >
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
343 try
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
344 commandthatfails
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
345 call assert_false(1, 'command should have failed')
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
346 catch
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
347 call assert_exception('E492:')
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
348 endtry
21859
3e5d0832a2e7 patch 8.2.1479: Vim9: error for list index uses wrong line number
Bram Moolenaar <Bram@vim.org>
parents: 21779
diff changeset
349 <
3e5d0832a2e7 patch 8.2.1479: Vim9: error for list index uses wrong line number
Bram Moolenaar <Bram@vim.org>
parents: 21779
diff changeset
350 *assert_fails()*
22163
b6d36f0b4f03 patch 8.2.1631: test_fails() does not check the context of the line number
Bram Moolenaar <Bram@vim.org>
parents: 21991
diff changeset
351 assert_fails({cmd} [, {error} [, {msg} [, {lnum} [, {context}]]]])
17456
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
352 Run {cmd} and add an error message to |v:errors| if it does
21265
6a4806e326dd patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents: 21250
diff changeset
353 NOT produce an error or when {error} is not found in the
6a4806e326dd patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents: 21250
diff changeset
354 error message. Also see |assert-return|.
6a4806e326dd patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents: 21250
diff changeset
355
6a4806e326dd patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents: 21250
diff changeset
356 When {error} is a string it must be found literally in the
6a4806e326dd patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents: 21250
diff changeset
357 first reported error. Most often this will be the error code,
6a4806e326dd patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents: 21250
diff changeset
358 including the colon, e.g. "E123:". >
6a4806e326dd patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents: 21250
diff changeset
359 assert_fails('bad cmd', 'E987:')
6a4806e326dd patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents: 21250
diff changeset
360 <
6a4806e326dd patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents: 21250
diff changeset
361 When {error} is a |List| with one or two strings, these are
6a4806e326dd patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents: 21250
diff changeset
362 used as patterns. The first pattern is matched against the
6a4806e326dd patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents: 21250
diff changeset
363 first reported error: >
6a4806e326dd patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents: 21250
diff changeset
364 assert_fails('cmd', ['E987:.*expected bool'])
6a4806e326dd patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents: 21250
diff changeset
365 < The second pattern, if present, is matched against the last
23305
fab58304f77d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22171
diff changeset
366 reported error.
fab58304f77d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22171
diff changeset
367 If there is only one error then both patterns must match. This
fab58304f77d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22171
diff changeset
368 can be used to check that there is only one error.
fab58304f77d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22171
diff changeset
369 To only match the last error use an empty string for the first
fab58304f77d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22171
diff changeset
370 error: >
21265
6a4806e326dd patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents: 21250
diff changeset
371 assert_fails('cmd', ['', 'E987:'])
6a4806e326dd patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents: 21250
diff changeset
372 <
21859
3e5d0832a2e7 patch 8.2.1479: Vim9: error for list index uses wrong line number
Bram Moolenaar <Bram@vim.org>
parents: 21779
diff changeset
373 If {msg} is empty then it is not used. Do this to get the
3e5d0832a2e7 patch 8.2.1479: Vim9: error for list index uses wrong line number
Bram Moolenaar <Bram@vim.org>
parents: 21779
diff changeset
374 default message when passing the {lnum} argument.
3e5d0832a2e7 patch 8.2.1479: Vim9: error for list index uses wrong line number
Bram Moolenaar <Bram@vim.org>
parents: 21779
diff changeset
375
3e5d0832a2e7 patch 8.2.1479: Vim9: error for list index uses wrong line number
Bram Moolenaar <Bram@vim.org>
parents: 21779
diff changeset
376 When {lnum} is present and not negative, and the {error}
3e5d0832a2e7 patch 8.2.1479: Vim9: error for list index uses wrong line number
Bram Moolenaar <Bram@vim.org>
parents: 21779
diff changeset
377 argument is present and matches, then this is compared with
3e5d0832a2e7 patch 8.2.1479: Vim9: error for list index uses wrong line number
Bram Moolenaar <Bram@vim.org>
parents: 21779
diff changeset
378 the line number at which the error was reported. That can be
3e5d0832a2e7 patch 8.2.1479: Vim9: error for list index uses wrong line number
Bram Moolenaar <Bram@vim.org>
parents: 21779
diff changeset
379 the line number in a function or in a script.
3e5d0832a2e7 patch 8.2.1479: Vim9: error for list index uses wrong line number
Bram Moolenaar <Bram@vim.org>
parents: 21779
diff changeset
380
22163
b6d36f0b4f03 patch 8.2.1631: test_fails() does not check the context of the line number
Bram Moolenaar <Bram@vim.org>
parents: 21991
diff changeset
381 When {context} is present it is used as a pattern and matched
b6d36f0b4f03 patch 8.2.1631: test_fails() does not check the context of the line number
Bram Moolenaar <Bram@vim.org>
parents: 21991
diff changeset
382 against the context (script name or function name) where
b6d36f0b4f03 patch 8.2.1631: test_fails() does not check the context of the line number
Bram Moolenaar <Bram@vim.org>
parents: 21991
diff changeset
383 {lnum} is located in.
b6d36f0b4f03 patch 8.2.1631: test_fails() does not check the context of the line number
Bram Moolenaar <Bram@vim.org>
parents: 21991
diff changeset
384
17456
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
385 Note that beeping is not considered an error, and some failing
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
386 commands only beep. Use |assert_beeps()| for those.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
387
17728
68ea27d26d5b patch 8.1.1861: only some assert functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents: 17620
diff changeset
388 Can also be used as a |method|: >
68ea27d26d5b patch 8.1.1861: only some assert functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents: 17620
diff changeset
389 GetCmd()->assert_fails('E99:')
68ea27d26d5b patch 8.1.1861: only some assert functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents: 17620
diff changeset
390
21859
3e5d0832a2e7 patch 8.2.1479: Vim9: error for list index uses wrong line number
Bram Moolenaar <Bram@vim.org>
parents: 21779
diff changeset
391 assert_false({actual} [, {msg}]) *assert_false()*
17456
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
392 When {actual} is not false an error message is added to
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
393 |v:errors|, like with |assert_equal()|.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
394 Also see |assert-return|.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
395 A value is false when it is zero. When {actual} is not a
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
396 number the assert fails.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
397 When {msg} is omitted an error in the form
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
398 "Expected False but got {actual}" is produced.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
399
17728
68ea27d26d5b patch 8.1.1861: only some assert functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents: 17620
diff changeset
400 Can also be used as a |method|: >
68ea27d26d5b patch 8.1.1861: only some assert functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents: 17620
diff changeset
401 GetResult()->assert_false()
68ea27d26d5b patch 8.1.1861: only some assert functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents: 17620
diff changeset
402
17456
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
403 assert_inrange({lower}, {upper}, {actual} [, {msg}]) *assert_inrange()*
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
404 This asserts number and |Float| values. When {actual} is lower
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
405 than {lower} or higher than {upper} an error message is added
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
406 to |v:errors|. Also see |assert-return|.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
407 When {msg} is omitted an error in the form
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
408 "Expected range {lower} - {upper}, but got {actual}" is
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
409 produced.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
410
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
411 *assert_match()*
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
412 assert_match({pattern}, {actual} [, {msg}])
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
413 When {pattern} does not match {actual} an error message is
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
414 added to |v:errors|. Also see |assert-return|.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
415
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
416 {pattern} is used as with |=~|: The matching is always done
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
417 like 'magic' was set and 'cpoptions' is empty, no matter what
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
418 the actual value of 'magic' or 'cpoptions' is.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
419
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
420 {actual} is used as a string, automatic conversion applies.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
421 Use "^" and "$" to match with the start and end of the text.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
422 Use both to match the whole text.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
423
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
424 When {msg} is omitted an error in the form
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
425 "Pattern {pattern} does not match {actual}" is produced.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
426 Example: >
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
427 assert_match('^f.*o$', 'foobar')
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
428 < Will result in a string to be added to |v:errors|:
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
429 test.vim line 12: Pattern '^f.*o$' does not match 'foobar' ~
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
430
17728
68ea27d26d5b patch 8.1.1861: only some assert functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents: 17620
diff changeset
431 Can also be used as a |method|: >
68ea27d26d5b patch 8.1.1861: only some assert functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents: 17620
diff changeset
432 getFile()->assert_match('foo.*')
68ea27d26d5b patch 8.1.1861: only some assert functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents: 17620
diff changeset
433 <
24307
55f458d35292 patch 8.2.2694: when 'matchpairs' is empty every character beeps
Bram Moolenaar <Bram@vim.org>
parents: 24103
diff changeset
434 assert_nobeep({cmd}) *assert_nobeep()*
55f458d35292 patch 8.2.2694: when 'matchpairs' is empty every character beeps
Bram Moolenaar <Bram@vim.org>
parents: 24103
diff changeset
435 Run {cmd} and add an error message to |v:errors| if it
55f458d35292 patch 8.2.2694: when 'matchpairs' is empty every character beeps
Bram Moolenaar <Bram@vim.org>
parents: 24103
diff changeset
436 produces a beep or visual bell.
55f458d35292 patch 8.2.2694: when 'matchpairs' is empty every character beeps
Bram Moolenaar <Bram@vim.org>
parents: 24103
diff changeset
437 Also see |assert_beeps()|.
55f458d35292 patch 8.2.2694: when 'matchpairs' is empty every character beeps
Bram Moolenaar <Bram@vim.org>
parents: 24103
diff changeset
438
55f458d35292 patch 8.2.2694: when 'matchpairs' is empty every character beeps
Bram Moolenaar <Bram@vim.org>
parents: 24103
diff changeset
439 Can also be used as a |method|: >
55f458d35292 patch 8.2.2694: when 'matchpairs' is empty every character beeps
Bram Moolenaar <Bram@vim.org>
parents: 24103
diff changeset
440 GetCmd()->assert_nobeep()
55f458d35292 patch 8.2.2694: when 'matchpairs' is empty every character beeps
Bram Moolenaar <Bram@vim.org>
parents: 24103
diff changeset
441 <
17456
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
442 *assert_notequal()*
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
443 assert_notequal({expected}, {actual} [, {msg}])
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
444 The opposite of `assert_equal()`: add an error message to
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
445 |v:errors| when {expected} and {actual} are equal.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
446 Also see |assert-return|.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
447
17620
072efa9ca875 patch 8.1.1807: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents: 17571
diff changeset
448 Can also be used as a |method|: >
072efa9ca875 patch 8.1.1807: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents: 17571
diff changeset
449 mylist->assert_notequal([1, 2, 3])
072efa9ca875 patch 8.1.1807: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents: 17571
diff changeset
450
072efa9ca875 patch 8.1.1807: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents: 17571
diff changeset
451 < *assert_notmatch()*
17456
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
452 assert_notmatch({pattern}, {actual} [, {msg}])
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
453 The opposite of `assert_match()`: add an error message to
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
454 |v:errors| when {pattern} matches {actual}.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
455 Also see |assert-return|.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
456
17728
68ea27d26d5b patch 8.1.1861: only some assert functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents: 17620
diff changeset
457 Can also be used as a |method|: >
68ea27d26d5b patch 8.1.1861: only some assert functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents: 17620
diff changeset
458 getFile()->assert_notmatch('bar.*')
68ea27d26d5b patch 8.1.1861: only some assert functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents: 17620
diff changeset
459
17825
ce993ba17adb patch 8.1.1909: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17758
diff changeset
460
17456
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
461 assert_report({msg}) *assert_report()*
25619
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25161
diff changeset
462 Report a test failure directly, using String {msg}.
17456
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
463 Always returns one.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
464
17825
ce993ba17adb patch 8.1.1909: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17758
diff changeset
465 Can also be used as a |method|: >
ce993ba17adb patch 8.1.1909: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17758
diff changeset
466 GetMessage()->assert_report()
ce993ba17adb patch 8.1.1909: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17758
diff changeset
467
ce993ba17adb patch 8.1.1909: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17758
diff changeset
468
17456
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
469 assert_true({actual} [, {msg}]) *assert_true()*
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
470 When {actual} is not true an error message is added to
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
471 |v:errors|, like with |assert_equal()|.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
472 Also see |assert-return|.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
473 A value is TRUE when it is a non-zero number. When {actual}
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
474 is not a number the assert fails.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
475 When {msg} is omitted an error in the form "Expected True but
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
476 got {actual}" is produced.
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
477
17728
68ea27d26d5b patch 8.1.1861: only some assert functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents: 17620
diff changeset
478 Can also be used as a |method|: >
68ea27d26d5b patch 8.1.1861: only some assert functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents: 17620
diff changeset
479 GetResult()->assert_true()
68ea27d26d5b patch 8.1.1861: only some assert functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents: 17620
diff changeset
480 <
17456
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
481
e414281d8bb4 patch 8.1.1726: the eval.txt help file is too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
482 vim:tw=78:ts=8:noet:ft=help:norl: