aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/testdir/Makefile1
-rw-r--r--src/nvim/testdir/runtest.vim1
-rw-r--r--src/nvim/testdir/test_quotestar.vim123
-rw-r--r--src/nvim/version.c8
4 files changed, 129 insertions, 4 deletions
diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile
index 4bfcbf8e79..cd7a6cbc9c 100644
--- a/src/nvim/testdir/Makefile
+++ b/src/nvim/testdir/Makefile
@@ -89,6 +89,7 @@ NEW_TESTS ?= \
test_profile.res \
test_put.res \
test_quickfix.res \
+ Test_quotestar.res \
test_recover.res \
test_retab.res \
test_scrollbind.res \
diff --git a/src/nvim/testdir/runtest.vim b/src/nvim/testdir/runtest.vim
index 5c98455909..f2cd84f556 100644
--- a/src/nvim/testdir/runtest.vim
+++ b/src/nvim/testdir/runtest.vim
@@ -238,6 +238,7 @@ let s:flaky = [
\ 'Test_out_cb()',
\ 'Test_paused()',
\ 'Test_quoteplus()',
+ \ 'Test_quotestar()',
\ 'Test_reltime()',
\ 'Test_terminal_composing_unicode()',
\ 'Test_terminal_redir_file()',
diff --git a/src/nvim/testdir/test_quotestar.vim b/src/nvim/testdir/test_quotestar.vim
new file mode 100644
index 0000000000..d0dd04f91d
--- /dev/null
+++ b/src/nvim/testdir/test_quotestar.vim
@@ -0,0 +1,123 @@
+" *-register (quotestar) tests
+
+if !has('clipboard')
+ finish
+endif
+
+source shared.vim
+
+func Do_test_quotestar_for_macunix()
+ if empty(exepath('pbcopy')) || empty(exepath('pbpaste'))
+ return 'Test requires pbcopy(1) and pbpaste(1)'
+ endif
+
+ let @* = ''
+
+ " Test #1: Pasteboard to Vim
+ let test_msg = "text from pasteboard to vim via quotestar"
+ " Write a piece of text to the pasteboard.
+ call system('/bin/echo -n "' . test_msg . '" | pbcopy')
+ " See if the *-register is changed as expected.
+ call assert_equal(test_msg, @*)
+
+ " Test #2: Vim to Pasteboard
+ let test_msg = "text from vim to pasteboard via quotestar"
+ " Write a piece of text to the *-register.
+ let @* = test_msg
+ " See if the pasteboard is changed as expected.
+ call assert_equal(test_msg, system('pbpaste'))
+
+ return ''
+endfunc
+
+func Do_test_quotestar_for_x11()
+ if !has('clientserver') || !has('job')
+ return 'Test requires the client-server and job features'
+ endif
+
+ let cmd = GetVimCommand()
+ if cmd == ''
+ return 'GetVimCommand() failed'
+ endif
+
+ let name = 'XVIMCLIPBOARD'
+ let cmd .= ' --servername ' . name
+ let g:job = job_start(cmd, {'stoponexit': 'kill', 'out_io': 'null'})
+ call WaitFor('job_status(g:job) == "run"')
+ if job_status(g:job) != 'run'
+ call assert_report('Cannot run the Vim server')
+ return ''
+ endif
+
+ " Takes a short while for the server to be active.
+ call WaitFor('serverlist() =~ "' . name . '"')
+ call assert_match(name, serverlist())
+
+ " Wait for the server to be up and answering requests. One second is not
+ " always sufficient.
+ call WaitFor('remote_expr("' . name . '", "v:version", "", 2) != ""')
+
+ " Clear the *-register of this vim instance.
+ let @* = ''
+
+ " Try to change the *-register of the server.
+ call remote_foreground(name)
+ call remote_send(name, ":let @* = 'yes'\<CR>")
+ call WaitFor('remote_expr("' . name . '", "@*", "", 1) == "yes"')
+ call assert_equal('yes', remote_expr(name, "@*", "", 2))
+
+ " Check that the *-register of this vim instance is changed as expected.
+ call assert_equal('yes', @*)
+
+ if has('unix') && has('gui') && !has('gui_running')
+ let @* = ''
+
+ " Running in a terminal and the GUI is avaiable: Tell the server to open
+ " the GUI and check that the remote command still works.
+ " Need to wait for the GUI to start up, otherwise the send hangs in trying
+ " to send to the terminal window.
+ if has('gui_athena') || has('gui_motif')
+ " For those GUIs, ignore the 'failed to create input context' error.
+ call remote_send(name, ":call test_ignore_error('E285') | gui -f\<CR>")
+ else
+ call remote_send(name, ":gui -f\<CR>")
+ endif
+ " Wait for the server in the GUI to be up and answering requests.
+ call WaitFor('remote_expr("' . name . '", "has(\"gui_running\")", "", 1) =~ "1"')
+
+ call remote_send(name, ":let @* = 'maybe'\<CR>")
+ call WaitFor('remote_expr("' . name . '", "@*", "", 1) == "maybe"')
+ call assert_equal('maybe', remote_expr(name, "@*", "", 2))
+
+ call assert_equal('maybe', @*)
+ endif
+
+ call remote_send(name, ":qa!\<CR>")
+ call WaitFor('job_status(g:job) == "dead"')
+ if job_status(g:job) != 'dead'
+ call assert_report('Server did not exit')
+ call job_stop(g:job, 'kill')
+ endif
+
+ return ''
+endfunc
+
+func Test_quotestar()
+ let skipped = ''
+
+ let quotestar_saved = @*
+
+ if has('macunix')
+ let skipped = Do_test_quotestar_for_macunix()
+ elseif !empty("$DISPLAY")
+ let skipped = Do_test_quotestar_for_x11()
+ else
+ let skipped = "Test is not implemented yet for this platform."
+ endif
+
+ let @* = quotestar_saved
+
+ if !empty(skipped)
+ throw 'Skipped: ' . skipped
+ endif
+endfunc
diff --git a/src/nvim/version.c b/src/nvim/version.c
index 779fd57a54..17f89a25d2 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -1139,18 +1139,18 @@ static const int included_patches[] = {
// 503,
502,
// 501,
- // 500,
+ 500,
499,
498,
// 497,
// 496,
- // 495,
+ 495,
// 494,
// 493,
// 492,
- // 491,
+ 491,
490,
- // 489,
+ 489,
// 488,
487,
486,