1- *eval.txt* For Vim version 7.4. Last change: 2016 Mar 20
1+ *eval.txt* For Vim version 7.4. Last change: 2016 Mar 27
22
33
44 VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1805,6 +1805,7 @@ assert_equal( {exp}, {act} [, {msg}]) none assert {exp} equals {act}
18051805assert_exception( {error} [, {msg} ]) none assert {error} is in v:exception
18061806assert_fails( {cmd} [, {error} ]) none assert {cmd} fails
18071807assert_false( {actual} [, {msg} ]) none assert {actual} is false
1808+ assert_match( {pat} , {text} [, {msg} ]) none assert {pat} matches {text}
18081809assert_true( {actual} [, {msg} ]) none assert {actual} is true
18091810asin( {expr} ) Float arc sine of {expr}
18101811atan( {expr} ) Float arc tangent of {expr}
@@ -2315,6 +2316,26 @@ assert_false({actual} [, {msg}]) *assert_false()*
23152316 When {msg} is omitted an error in the form "Expected False but
23162317 got {actual} " is produced.
23172318
2319+ *assert_match()*
2320+ assert_match({pattern} , {actual} [, {msg} ])
2321+ When {pattern} does not match {actual} an error message is
2322+ added to | v:errors | .
2323+
2324+ {pattern} is used as with | =~ | : The matching is always done
2325+ like 'magic' was set and 'cpoptions' is empty, no matter what
2326+ the actual value of 'magic' or 'cpoptions' is.
2327+
2328+ {actual} is used as a string, automatic conversion applies.
2329+ Use "^" and "$" to match with the start and end of the text.
2330+ Use both to match the whole text.
2331+
2332+ When {msg} is omitted an error in the form "Pattern {pattern}
2333+ does not match {actual} " is produced.
2334+ Example: >
2335+ assert_match('^f.*o$', 'foobar')
2336+ < Will result in a string to be added to | v:errors | :
2337+ test.vim line 12: Pattern '^f.*o$' does not match 'foobar' ~
2338+
23182339assert_true({actual} [, {msg} ]) *assert_true()*
23192340 When {actual} is not true an error message is added to
23202341 | v:errors | , like with | assert_equal() | .
@@ -2716,13 +2737,6 @@ ch_close({handle}) *ch_close()*
27162737 Close {handle} . See | channel-close | .
27172738 {handle} can be Channel or a Job that has a Channel.
27182739
2719- Note that a channel is closed in three stages:
2720- - The I/O ends, log message: "Closing channel". There can
2721- still be queued messages to read or callbacks to invoke.
2722- - The readahead is cleared, log message: "Clearing channel".
2723- Some variables may still reference the channel.
2724- - The channel is freed, log message: "Freeing channel".
2725-
27262740 {only available when compiled with the | +channel | feature}
27272741
27282742ch_evalexpr({handle} , {expr} [, {options} ]) *ch_evalexpr()*
@@ -2732,7 +2746,8 @@ ch_evalexpr({handle}, {expr} [, {options}]) *ch_evalexpr()*
27322746 {handle} can be Channel or a Job that has a Channel.
27332747 *E917*
27342748 {options} must be a Dictionary. It must not have a "callback"
2735- entry. It can have a "timeout" entry.
2749+ entry. It can have a "timeout" entry to specify the timeout
2750+ for this specific request.
27362751
27372752 ch_evalexpr() waits for a response and returns the decoded
27382753 expression. When there is an error or timeout it returns an
@@ -2816,65 +2831,34 @@ ch_logfile({fname} [, {mode}]) *ch_logfile()*
28162831
28172832ch_open({address} [, {options} ]) *ch_open()*
28182833 Open a channel to {address} . See | channel | .
2819- Returns a Channel. Use | ch_status() | to check for
2820- failure.
2834+ Returns a Channel. Use | ch_status() | to check for failure.
28212835
28222836 {address} has the form "hostname:port", e.g.,
28232837 "localhost:8765".
28242838
2825- If {options} is given it must be a | Dictionary | . The optional
2826- items are:
2827- mode "raw", "js" or "json".
2828- Default "json".
2829- callback function to call for requests with a zero
2830- sequence number. See | channel-callback | .
2831- Default: none.
2832- waittime Specify connect timeout as milliseconds.
2833- Negative means forever.
2834- Default: 0 (don't wait)
2835- timeout Specify response read timeout value in
2836- milliseconds.
2837- Default: 2000.
2839+ If {options} is given it must be a | Dictionary | .
2840+ See | channel-open-options | .
2841+
28382842 {only available when compiled with the | +channel | feature}
28392843
28402844ch_read({handle} [, {options} ]) *ch_read()*
28412845 Read from {handle} and return the received message.
28422846 {handle} can be Channel or a Job that has a Channel.
2843-
2844- This uses the channel timeout. When there is nothing to read
2845- within that time an empty string is returned. To specify a
2846- different timeout in msec use the "timeout" option:
2847- {"timeout": 123} ~
2848- To read from the error output use the "part" option:
2849- {"part": "err"} ~
2850- To read a message with a specific ID, on a JS or JSON channel:
2851- {"id": 99} ~
2852- When no ID is specified or the ID is -1, the first message is
2853- returned. This overrules any callback waiting for this
2854- message.
2855-
2856- For a RAW channel this returns whatever is available, since
2857- Vim does not know where a message ends.
2858- For a NL channel this returns one message.
2859- For a JS or JSON channel this returns one decoded message.
2860- This includes any sequence number.
2847+ See | channel-more | .
2848+ {only available when compiled with the | +channel | feature}
28612849
28622850ch_readraw({handle} [, {options} ]) *ch_readraw()*
28632851 Like ch_read() but for a JS and JSON channel does not decode
2864- the message.
2852+ the message. See | channel-more | .
2853+ {only available when compiled with the | +channel | feature}
28652854
28662855ch_sendexpr({handle} , {expr} [, {options} ]) *ch_sendexpr()*
28672856 Send {expr} over {handle} . The {expr} is encoded
28682857 according to the type of channel. The function cannot be used
2869- with a raw channel. See | channel-use | . *E912*
2858+ with a raw channel.
2859+ See | channel-use | . *E912*
28702860 {handle} can be Channel or a Job that has a Channel.
28712861
2872- {options} must be a Dictionary. The "callback" item is a
2873- Funcref or the name of a function it is invoked when the
2874- response is received. See | channel-callback | .
2875- Without "callback" the channel handler is invoked, otherwise
2876- any received message is dropped.
2877-
28782862 {only available when compiled with the | +channel | feature}
28792863
28802864ch_sendraw({handle} , {string} [, {options} ]) *ch_sendraw()*
@@ -6675,13 +6659,17 @@ string({expr}) Return {expr} converted to a String. If {expr} is a Number,
66756659 Float, String or a composition of them, then the result can be
66766660 parsed back with | eval() | .
66776661 {expr} type result ~
6678- String 'string'
6662+ String 'string' (single quotes are doubled)
66796663 Number 123
66806664 Float 123.123456 or 1.123456e8
66816665 Funcref function('name' )
66826666 List [item, item]
66836667 Dictionary {key: value, key: value}
6684- Note that in String values the ' character is doubled.
6668+
6669+ When a List or Dictionary has a recursive reference it is
6670+ replaced by "[...]" or "{...} ". Using eval() on the result
6671+ will then fail.
6672+
66856673 Also see | strtrans() | .
66866674
66876675 *strlen()*
@@ -7669,6 +7657,7 @@ unix Unix version of Vim.
76697657user_commands User-defined commands.
76707658vertsplit Compiled with vertically split windows | :vsplit | .
76717659vim_starting True while initial source'ing takes place. | startup |
7660+ *vim_starting*
76727661viminfo Compiled with viminfo support.
76737662virtualedit Compiled with 'virtualedit' option.
76747663visual Compiled with Visual mode.
0 commit comments