From 68e58444b48fc34c9a7c262883750778fbd935d7 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sat, 30 Jan 2016 22:25:21 +0300 Subject: eval: Add jsonencode() function Ref #3471 --- runtime/doc/eval.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'runtime') diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index cf1394d799..2d08afff4f 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1932,6 +1932,7 @@ jobstart( {cmd}[, {opts}]) Number Spawns {cmd} as a job jobstop( {job}) Number Stops a job jobwait( {ids}[, {timeout}]) Number Wait for a set of jobs join( {list} [, {sep}]) String join {list} items into one String +jsonencode( {expr}) String Convert {expr} to JSON keys( {dict}) List keys in {dict} len( {expr}) Number the length of {expr} libcall( {lib}, {func}, {arg}) String call {func} in library {lib} with {arg} @@ -4291,6 +4292,19 @@ join({list} [, {sep}]) *join()* converted into a string like with |string()|. The opposite function is |split()|. +jsonencode({expr}) *jsonencode()* + Convert {expr} into a JSON string. Accepts + |msgpack-special-dict| as the input. Will not convert + |Funcref|s, mappings with non-string keys (can be created as + |msgpack-special-dict|), values with self-referencing + containers, strings which contain non-UTF-8 characters, + pseudo-UTF-8 strings which contain codepoints reserved for + surrogate pairs (such strings are not valid UTF-8 strings). + When converting 'encoding' is taken into account, if it is not + "utf-8", then conversion is performed before encoding strings. + Non-printable characters are converted into "\u1234" escapes + or special escapes like "\t", other are dumped as-is. + keys({dict}) *keys()* Return a |List| with all the keys of {dict}. The |List| is in arbitrary order. -- cgit From d70a322c40e849f98ad573d2a37dc680c5616b26 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 31 Jan 2016 01:25:00 +0300 Subject: eval: Add special variables v:false, v:null, v:none --- runtime/doc/eval.txt | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 2d08afff4f..572cf4c03f 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1418,6 +1418,13 @@ v:exception The value of the exception most recently caught and not :endtry < Output: "caught oops". + *v:false* *false-variable* +v:false Special value used to put "false" in JSON and msgpack. See + |jsonencode()|. This value is converted to "false" when used + as a String (e.g. in |expr5| with string concatenation + operator) and to zero when used as a Number (e.g. in |expr5| + or |expr7| when used with numeric operators). + *v:fcs_reason* *fcs_reason-variable* v:fcs_reason The reason why the |FileChangedShell| event was triggered. Can be used in an autocommand to decide what to do and/or what @@ -1557,6 +1564,20 @@ v:msgpack_types Dictionary containing msgpack types used by |msgpackparse()| (not editable) empty lists. To check whether some list is one of msgpack types, use |is| operator. + *v:null* *null-variable* +v:null Special value used to put "null" in JSON and NIL in msgpack. + See |jsonencode()|. This value is converted to "null" when + used as a String (e.g. in |expr5| with string concatenation + operator) and to zero when used as a Number (e.g. in |expr5| + or |expr7| when used with numeric operators). + + *v:none* *none-variable* +v:none Special value used to put an empty item in JSON. See + |jsonencode()|. This value is converted to "none" when used + as a String (e.g. in |expr5| with string concatenation + operator) and to zero when used as a Number (e.g. in |expr5| + or |expr7| when used with numeric operators). + *v:oldfiles* *oldfiles-variable* v:oldfiles List of file names that is loaded from the |shada| file on startup. These are the files that Vim remembers marks for. @@ -1722,6 +1743,13 @@ v:throwpoint The point where the exception most recently caught and not :endtry < Output: "Exception from test.vim, line 2" + *v:true* *true-variable* +v:true Special value used to put "true" in JSON and msgpack. See + |jsonencode()|. This value is converted to "true" when used + as a String (e.g. in |expr5| with string concatenation + operator) and to one when used as a Number (e.g. in |expr5| or + |expr7| when used with numeric operators). + *v:val* *val-variable* v:val Value of the current item of a |List| or |Dictionary|. Only valid while evaluating the expression used with |map()| and @@ -4832,8 +4860,8 @@ msgpackdump({list}) {Nvim} *msgpackdump()* (dictionary with zero items is represented by 0x80 byte in messagepack). - Limitations: *E951* *E952* - 1. |Funcref|s cannot be dumped. + Limitations: *E951* *E952* *E953* + 1. |Funcref|s and |v:none| cannot be dumped. 2. Containers that reference themselves cannot be dumped. 3. Dictionary keys are always dumped as STR strings. 4. Other strings are always dumped as BIN strings. -- cgit From 6e5498c3e32ecc7adfedc3f47b876f82de90fff8 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 31 Jan 2016 02:28:53 +0300 Subject: runtime/msgpack: Add support for special values --- runtime/autoload/msgpack.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'runtime') diff --git a/runtime/autoload/msgpack.vim b/runtime/autoload/msgpack.vim index 2bb7ec5b02..2e2697c57f 100644 --- a/runtime/autoload/msgpack.vim +++ b/runtime/autoload/msgpack.vim @@ -356,6 +356,8 @@ let s:MSGPACK_STANDARD_TYPES = { \type(''): 'binary', \type([]): 'array', \type({}): 'map', + \type(v:true): 'boolean', + \type(v:null): 'nil', \} "" @@ -379,7 +381,7 @@ endfunction "" " Dump boolean value. function s:msgpack_dump_boolean(v) abort - return a:v._VAL ? 'TRUE' : 'FALSE' + return (a:v is v:true || (a:v isnot v:false && a:v._VAL)) ? 'TRUE' : 'FALSE' endfunction "" -- cgit From e213ba150665328bae2b532491de5e12f72bc9ca Mon Sep 17 00:00:00 2001 From: ZyX Date: Mon, 1 Feb 2016 21:22:07 +0300 Subject: eval: Add jsondecode() function --- runtime/doc/eval.txt | 12 ++++++++++++ runtime/doc/vim_diff.txt | 6 ++++++ 2 files changed, 18 insertions(+) (limited to 'runtime') diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 572cf4c03f..25005885c3 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1960,6 +1960,7 @@ jobstart( {cmd}[, {opts}]) Number Spawns {cmd} as a job jobstop( {job}) Number Stops a job jobwait( {ids}[, {timeout}]) Number Wait for a set of jobs join( {list} [, {sep}]) String join {list} items into one String +jsondecode( {expr}) any Convert {expr} from JSON jsonencode( {expr}) String Convert {expr} to JSON keys( {dict}) List keys in {dict} len( {expr}) Number the length of {expr} @@ -4320,6 +4321,17 @@ join({list} [, {sep}]) *join()* converted into a string like with |string()|. The opposite function is |split()|. +jsondecode({expr}) *jsondecode()* + Convert {expr} from JSON object. Accepts |readfile()|-style + list as the input, as well as regular string. May output any + Vim value. In the following cases it will output + |msgpack-special-dict|: + 1. Dictionary contains duplicate key. + 2. Dictionary contains empty key. + 3. String contains NUL byte. Two special dictionaries: for + dictionary and for string will be emitted in case string + with NUL byte was a dictionary key. + jsonencode({expr}) *jsonencode()* Convert {expr} into a JSON string. Accepts |msgpack-special-dict| as the input. Will not convert diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index 17ee5975dd..ddb1fd3b8f 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -100,6 +100,12 @@ are always available and may be used simultaneously in separate plugins. The 4. Stringifyed infinite and NaN values now use |str2float()| and can be evaled back. +|jsondecode()| behaviour changed: +1. It may output |msgpack-special-dict|. +2. It accepts only valid JSON. |v:none| is never emitted. +|jsonencode()| behaviour slightly changed: now |msgpack-special-dict| values +are accepted. + Viminfo text files were replaced with binary (messagepack) ShaDa files. Additional differences: -- cgit From cddd7d47c325ab0c06c21fd101efe4a9a1708fca Mon Sep 17 00:00:00 2001 From: ZyX Date: Wed, 3 Feb 2016 20:04:16 +0300 Subject: eval/decode: Make msgpackparse() function use new v: vars --- runtime/doc/eval.txt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 25005885c3..4676080536 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -4907,9 +4907,13 @@ msgpackparse({list}) {Nvim} *msgpackparse()* contains name of the key from |v:msgpack_types|): Key Value ~ - nil Zero, ignored when dumping. - boolean One or zero. When dumping it is only checked that - value is a |Number|. + nil Zero, ignored when dumping. This value cannot + possibly appear in |msgpackparse()| output in Neovim + versions which have |v:null|. + boolean One or zero. When dumping it is only checked that + value is a |Number|. This value cannot possibly + appear in |msgpackparse()| output in Neovim versions + which have |v:true| and |v:false|. integer |List| with four numbers: sign (-1 or 1), highest two bits, number with bits from 62nd to 31st, lowest 31 bits. I.e. to get actual number one will need to use -- cgit From 57700def795156ce93526bf12e95a56d90c39206 Mon Sep 17 00:00:00 2001 From: ZyX Date: Wed, 3 Feb 2016 21:55:42 +0300 Subject: doc: Update documentation regarding converting from/to &encoding --- runtime/doc/eval.txt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 4676080536..ee8ede2b91 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -4324,7 +4324,9 @@ join({list} [, {sep}]) *join()* jsondecode({expr}) *jsondecode()* Convert {expr} from JSON object. Accepts |readfile()|-style list as the input, as well as regular string. May output any - Vim value. In the following cases it will output + Vim value. When 'encoding' is not UTF-8 string is converted + from UTF-8 to 'encoding', failing conversion fails + jsondecode(). In the following cases it will output |msgpack-special-dict|: 1. Dictionary contains duplicate key. 2. Dictionary contains empty key. @@ -4334,8 +4336,9 @@ jsondecode({expr}) *jsondecode()* jsonencode({expr}) *jsonencode()* Convert {expr} into a JSON string. Accepts - |msgpack-special-dict| as the input. Will not convert - |Funcref|s, mappings with non-string keys (can be created as + |msgpack-special-dict| as the input. Converts from 'encoding' + to UTF-8 when encoding strings. Will not convert |Funcref|s, + mappings with non-string keys (can be created as |msgpack-special-dict|), values with self-referencing containers, strings which contain non-UTF-8 characters, pseudo-UTF-8 strings which contain codepoints reserved for -- cgit From 6167ce6df2753d5474ad49aea19f5957128ab015 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sat, 6 Feb 2016 02:46:23 +0300 Subject: eval: Remove v:none To get v:none back just rever this commit. This will not make json*() functions compatible with Vim though. --- runtime/doc/eval.txt | 9 +-------- runtime/doc/vim_diff.txt | 4 ++++ 2 files changed, 5 insertions(+), 8 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index ee8ede2b91..f085dd2972 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1569,13 +1569,6 @@ v:null Special value used to put "null" in JSON and NIL in msgpack. See |jsonencode()|. This value is converted to "null" when used as a String (e.g. in |expr5| with string concatenation operator) and to zero when used as a Number (e.g. in |expr5| - or |expr7| when used with numeric operators). - - *v:none* *none-variable* -v:none Special value used to put an empty item in JSON. See - |jsonencode()|. This value is converted to "none" when used - as a String (e.g. in |expr5| with string concatenation - operator) and to zero when used as a Number (e.g. in |expr5| or |expr7| when used with numeric operators). *v:oldfiles* *oldfiles-variable* @@ -4876,7 +4869,7 @@ msgpackdump({list}) {Nvim} *msgpackdump()* messagepack). Limitations: *E951* *E952* *E953* - 1. |Funcref|s and |v:none| cannot be dumped. + 1. |Funcref|s cannot be dumped. 2. Containers that reference themselves cannot be dumped. 3. Dictionary keys are always dumped as STR strings. 4. Other strings are always dumped as BIN strings. diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index ddb1fd3b8f..2d03b4ff45 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -106,6 +106,10 @@ are always available and may be used simultaneously in separate plugins. The |jsonencode()| behaviour slightly changed: now |msgpack-special-dict| values are accepted. +*v:none* variable is absent. In Vim it represents “no value” in non-JSON +strings like "{"a": }" parsed as "{'a': v:none}". See |jsondecode()| and +|jsonencode()| incompatibilities above. + Viminfo text files were replaced with binary (messagepack) ShaDa files. Additional differences: -- cgit From 0aa3e7b7ceb259680f9da31bd247b42cdc934449 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sat, 6 Feb 2016 20:54:42 +0300 Subject: eval: Port parts of 7.4.1267 that are not already present --- runtime/doc/vim_diff.txt | 2 ++ 1 file changed, 2 insertions(+) (limited to 'runtime') diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index 2d03b4ff45..b42b91140c 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -99,6 +99,8 @@ are always available and may be used simultaneously in separate plugins. The error out. 4. Stringifyed infinite and NaN values now use |str2float()| and can be evaled back. +5. (internal) Trying to print or stringify VAR_UNKNOWN in Vim results in + nothing, |E908|, in Neovim it is internal error. |jsondecode()| behaviour changed: 1. It may output |msgpack-special-dict|. -- cgit From 2f67786796d5fb4237f4b0258ec3db0982cc7f53 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sat, 13 Feb 2016 21:39:28 +0300 Subject: eval: Rename json* functions to json_* --- runtime/doc/eval.txt | 16 ++++++++-------- runtime/doc/vim_diff.txt | 18 +++++++++++------- 2 files changed, 19 insertions(+), 15 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index f085dd2972..fea9e669e0 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1420,7 +1420,7 @@ v:exception The value of the exception most recently caught and not *v:false* *false-variable* v:false Special value used to put "false" in JSON and msgpack. See - |jsonencode()|. This value is converted to "false" when used + |json_encode()|. This value is converted to "false" when used as a String (e.g. in |expr5| with string concatenation operator) and to zero when used as a Number (e.g. in |expr5| or |expr7| when used with numeric operators). @@ -1566,7 +1566,7 @@ v:msgpack_types Dictionary containing msgpack types used by |msgpackparse()| *v:null* *null-variable* v:null Special value used to put "null" in JSON and NIL in msgpack. - See |jsonencode()|. This value is converted to "null" when + See |json_encode()|. This value is converted to "null" when used as a String (e.g. in |expr5| with string concatenation operator) and to zero when used as a Number (e.g. in |expr5| or |expr7| when used with numeric operators). @@ -1738,7 +1738,7 @@ v:throwpoint The point where the exception most recently caught and not *v:true* *true-variable* v:true Special value used to put "true" in JSON and msgpack. See - |jsonencode()|. This value is converted to "true" when used + |json_encode()|. This value is converted to "true" when used as a String (e.g. in |expr5| with string concatenation operator) and to one when used as a Number (e.g. in |expr5| or |expr7| when used with numeric operators). @@ -1953,8 +1953,8 @@ jobstart( {cmd}[, {opts}]) Number Spawns {cmd} as a job jobstop( {job}) Number Stops a job jobwait( {ids}[, {timeout}]) Number Wait for a set of jobs join( {list} [, {sep}]) String join {list} items into one String -jsondecode( {expr}) any Convert {expr} from JSON -jsonencode( {expr}) String Convert {expr} to JSON +json_decode( {expr}) any Convert {expr} from JSON +json_encode( {expr}) String Convert {expr} to JSON keys( {dict}) List keys in {dict} len( {expr}) Number the length of {expr} libcall( {lib}, {func}, {arg}) String call {func} in library {lib} with {arg} @@ -4314,12 +4314,12 @@ join({list} [, {sep}]) *join()* converted into a string like with |string()|. The opposite function is |split()|. -jsondecode({expr}) *jsondecode()* +json_decode({expr}) *json_decode()* Convert {expr} from JSON object. Accepts |readfile()|-style list as the input, as well as regular string. May output any Vim value. When 'encoding' is not UTF-8 string is converted from UTF-8 to 'encoding', failing conversion fails - jsondecode(). In the following cases it will output + json_decode(). In the following cases it will output |msgpack-special-dict|: 1. Dictionary contains duplicate key. 2. Dictionary contains empty key. @@ -4327,7 +4327,7 @@ jsondecode({expr}) *jsondecode()* dictionary and for string will be emitted in case string with NUL byte was a dictionary key. -jsonencode({expr}) *jsonencode()* +json_encode({expr}) *json_encode()* Convert {expr} into a JSON string. Accepts |msgpack-special-dict| as the input. Converts from 'encoding' to UTF-8 when encoding strings. Will not convert |Funcref|s, diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index b42b91140c..508712ca75 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -102,15 +102,19 @@ are always available and may be used simultaneously in separate plugins. The 5. (internal) Trying to print or stringify VAR_UNKNOWN in Vim results in nothing, |E908|, in Neovim it is internal error. -|jsondecode()| behaviour changed: +|json_decode()| behaviour changed: 1. It may output |msgpack-special-dict|. -2. It accepts only valid JSON. |v:none| is never emitted. -|jsonencode()| behaviour slightly changed: now |msgpack-special-dict| values -are accepted. +2. |msgpack-special-dict| is emitted also in case of duplicate keys, while in + Vim it errors out. +3. It accepts only valid JSON. Trailing commas are not accepted. -*v:none* variable is absent. In Vim it represents “no value” in non-JSON -strings like "{"a": }" parsed as "{'a': v:none}". See |jsondecode()| and -|jsonencode()| incompatibilities above. +|json_encode()| behaviour slightly changed: now |msgpack-special-dict| values +are accepted, but |v:none| is not. + +*v:none* variable is absent. In Vim it represents “no value” in “js” strings +like "[,]" parsed as "[v:none]" by |js_decode()|. + +*js_encode()* and *js_decode()* functions are also absent. Viminfo text files were replaced with binary (messagepack) ShaDa files. Additional differences: -- cgit From 1bada1fde0a1b7251690ecfe0c7fc0c8052e2a8e Mon Sep 17 00:00:00 2001 From: ZyX Date: Mon, 7 Mar 2016 09:35:44 +0300 Subject: documentation: Update type() documentation --- runtime/doc/eval.txt | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index fea9e669e0..d171dacad1 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -6783,12 +6783,14 @@ trunc({expr}) *trunc()* type({expr}) *type()* The result is a Number, depending on the type of {expr}: - Number: 0 - String: 1 + Number: 0 + String: 1 Funcref: 2 - List: 3 + List: 3 Dictionary: 4 - Float: 5 + Float: 5 + Boolean: 6 (|v:true| and |v:false|) + Null: 7 (|v:null|) To avoid the magic numbers it should be used this way: > :if type(myvar) == type(0) :if type(myvar) == type("") @@ -6796,6 +6798,10 @@ type({expr}) *type()* :if type(myvar) == type([]) :if type(myvar) == type({}) :if type(myvar) == type(0.0) + :if type(myvar) == type(v:true) +< In place of checking for |v:null| type it is better to check + for |v:null| directly as it is the only value of this type: > + :if myvar is v:null undofile({name}) *undofile()* Return the name of the undo file that would be used for a file -- cgit From 4f8b6864350c3aac5427103e27c856d1782b1be1 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sat, 12 Mar 2016 20:54:19 +0300 Subject: documentation,functests: State that UTF-8-only support is intentional --- runtime/doc/eval.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'runtime') diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index d171dacad1..b1485f1195 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -4327,6 +4327,13 @@ json_decode({expr}) *json_decode()* dictionary and for string will be emitted in case string with NUL byte was a dictionary key. + Note: function treats its input as UTF-8 always regardless of + 'encoding' value. This is needed because JSON source is + supposed to be external (e.g. |readfile()|) and JSON standard + allows only a few encodings, of which UTF-8 is recommended and + the only one required to be supported. Non-UTF-8 characters + are an error. + json_encode({expr}) *json_encode()* Convert {expr} into a JSON string. Accepts |msgpack-special-dict| as the input. Converts from 'encoding' @@ -4341,6 +4348,12 @@ json_encode({expr}) *json_encode()* Non-printable characters are converted into "\u1234" escapes or special escapes like "\t", other are dumped as-is. + Note: all characters above U+0079 are considered non-printable + when 'encoding' is not UTF-8. This function always outputs + UTF-8 strings as required by the standard thus when 'encoding' + is not unicode resulting string will look incorrect if + "\u1234" notation is not used. + keys({dict}) *keys()* Return a |List| with all the keys of {dict}. The |List| is in arbitrary order. -- cgit From 9709cf2cdbd98403aede9edbc8bbe435aeefb463 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 20 Mar 2016 19:08:42 +0300 Subject: 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)`). --- runtime/doc/eval.txt | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'runtime') 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 -- cgit