diff options
author | ZyX <kp-pav@yandex.ru> | 2016-03-20 19:08:42 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2016-04-18 02:48:20 +0300 |
commit | 9709cf2cdbd98403aede9edbc8bbe435aeefb463 (patch) | |
tree | 01f75ddd1798e688deae06960d5a65784448dcac | |
parent | 25bb08dad930a975010798c592b5277d1b5a18b0 (diff) | |
download | rneovim-9709cf2cdbd98403aede9edbc8bbe435aeefb463.tar.gz rneovim-9709cf2cdbd98403aede9edbc8bbe435aeefb463.tar.bz2 rneovim-9709cf2cdbd98403aede9edbc8bbe435aeefb463.zip |
documentation: Update assert_{false,true}() and empty() documentation
Also removes a note regarding the performance of `empty(long_list)` vs
`len(long_list) == 0` because this has nothing to do with the actual state:
first checks that list is not NULL and pointer to its first element is also not
NULL, second gets length by comparing list with NULL and falls back to
`tv->vval.v_list->lv_len` if not. `len(long_list)` *may* still be *slightly*
slower, but the slow down has nothing to do with the length of the list, is
hardly noticeable and depends on how good compiler is at inlining and what
exactly have author of the plugin written (I mean `len(long_list) == 0` vs
`empty(long_list)` vs `!len(long_list)`).
-rw-r--r-- | runtime/doc/eval.txt | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index b1485f1195..da65708ac0 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -2245,17 +2245,17 @@ assert_equal({expected}, {actual}, [, {msg}]) assert_false({actual}, [, {msg}]) *assert_false()* When {actual} is not false an error message is added to - |v:errors|, like with |assert_equal()|.. - A value is false when it is zero. When "{actual}" is not a - number the assert fails. + |v:errors|, like with |assert_equal()|. + A value is false when it is zero or |v:false|. When "{actual}" + is not a number or |v:false| the assert fails. When {msg} is omitted an error in the form "Expected False but got {actual}" is produced. assert_true({actual}, [, {msg}]) *assert_true()* When {actual} is not true an error message is added to - |v:errors|, like with |assert_equal()|.. - A value is true when it is a non-zeron number. When {actual} - is not a number the assert fails. + |v:errors|, like with |assert_equal()|. + A value is true when it is a non-zero number or |v:true|. + When {actual} is not a number or |v:true| the assert fails. When {msg} is omitted an error in the form "Expected True but got {actual}" is produced. @@ -2849,9 +2849,8 @@ diff_hlID({lnum}, {col}) *diff_hlID()* empty({expr}) *empty()* Return the Number 1 if {expr} is empty, zero otherwise. A |List| or |Dictionary| is empty when it does not have any - items. A Number is empty when its value is zero. - For a long |List| this is much faster than comparing the - length with zero. + items. A Number is empty when its value is zero. Special + variable is empty when it is |v:false| or |v:null|. escape({string}, {chars}) *escape()* Escape the characters in {chars} that occur in {string} with a |