Skip to content

Commit

Permalink
Add a test and doc
Browse files Browse the repository at this point in the history
  • Loading branch information
h-east committed Mar 24, 2018
1 parent d895946 commit 936449a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
2 changes: 2 additions & 0 deletions runtime/doc/eval.txt
Expand Up @@ -2302,6 +2302,8 @@ range({expr} [, {max} [, {stride}]])
List items from {expr} to {max}
readfile({fname} [, {binary} [, {max}]])
List get list of lines from file {fname}
register_executing() Number |TRUE| if the register executing
register_recording() String get the recording register name
reltime([{start} [, {end}]]) List get time value
reltimefloat({time}) Float turn the time value into a Float
reltimestr({time}) String turn time value into a String
Expand Down
25 changes: 25 additions & 0 deletions src/testdir/test_functions.vim
Expand Up @@ -899,3 +899,28 @@ func Test_trim()
let chars = join(map(range(1, 0x20) + [0xa0], {n -> nr2char(n)}), '')
call assert_equal("x", trim(chars . "x" . chars))
endfunc

" Test for register_recording() and register_executing()
func Test_register_executing_and_recording()
let s:reg_stat = ''
func s:save_reg_stat()
let s:reg_stat = register_recording() . ':' . register_executing()
return ''
endfunc

new
call s:save_reg_stat()
call assert_equal(':0', s:reg_stat)
call feedkeys("qa\"=s:save_reg_stat()\<CR>pq", 'xt')
call assert_equal('a:0', s:reg_stat)
call feedkeys("@a", 'xt')
call assert_equal(':1', s:reg_stat)
call feedkeys("qb@aq", 'xt')
call assert_equal('b:1', s:reg_stat)
call feedkeys("q\"\"=s:save_reg_stat()\<CR>pq", 'xt')
call assert_equal('":0', s:reg_stat)

bwipe!
delfunc s:save_reg_stat
unlet s:reg_stat
endfunc

0 comments on commit 936449a

Please sign in to comment.