summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_functions.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-05-22 20:35:17 +0200
committerBram Moolenaar <Bram@vim.org>2018-05-22 20:35:17 +0200
commit0b6d911e5de1a1c10a23d4c2ee1b0275c474a2dd (patch)
tree3d33047a64f47e30852f5d6f187f316d12b3f55b /src/testdir/test_functions.vim
parentb4518563c73460150344a57879bf5b22cb8b1c77 (diff)
patch 8.1.0020: cannot tell whether a register is executing or recordingv8.1.0020
Problem: Cannot tell whether a register is being used for executing or recording. Solution: Add reg_executing() and reg_recording(). (Hirohito Higashi, closes #2745) Rename the global variables for consistency. Store the register name in reg_executing.
Diffstat (limited to 'src/testdir/test_functions.vim')
-rw-r--r--src/testdir/test_functions.vim25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim
index 97e7e234ad..b76bc78e79 100644
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -923,3 +923,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 reg_recording() and reg_executing()
+func Test_reg_executing_and_recording()
+ let s:reg_stat = ''
+ func s:save_reg_stat()
+ let s:reg_stat = reg_recording() . ':' . reg_executing()
+ return ''
+ endfunc
+
+ new
+ call s:save_reg_stat()
+ call assert_equal(':', s:reg_stat)
+ call feedkeys("qa\"=s:save_reg_stat()\<CR>pq", 'xt')
+ call assert_equal('a:', s:reg_stat)
+ call feedkeys("@a", 'xt')
+ call assert_equal(':a', s:reg_stat)
+ call feedkeys("qb@aq", 'xt')
+ call assert_equal('b:a', s:reg_stat)
+ call feedkeys("q\"\"=s:save_reg_stat()\<CR>pq", 'xt')
+ call assert_equal('":', s:reg_stat)
+
+ bwipe!
+ delfunc s:save_reg_stat
+ unlet s:reg_stat
+endfunc