Mercurial > vim
annotate src/testdir/test_prompt_buffer.vim @ 14021:945d343d3024 v8.1.0028
patch 8.1.0028: prompt buffer test fails on MS-Windows
commit https://github.com/vim/vim/commit/1149382d21402474c771862d082a541e23beb108
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jun 3 15:08:09 2018 +0200
patch 8.1.0028: prompt buffer test fails on MS-Windows
Problem: Prompt buffer test fails on MS-Windows.
Solution: Disable the test for now. Remove stray assert.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 03 Jun 2018 15:15:05 +0200 |
parents | dc67449d648c |
children | eb5ee7479d31 |
rev | line source |
---|---|
14019
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Tests for setting 'buftype' to "prompt" |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 if !has('channel') |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 finish |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 endif |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 source shared.vim |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 source screendump.vim |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 func Test_prompt_basic() |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 " We need to use a terminal window to be able to feed keys without leaving |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 " Insert mode. |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 if !has('terminal') |
14021
945d343d3024
patch 8.1.0028: prompt buffer test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
14019
diff
changeset
|
14 return |
945d343d3024
patch 8.1.0028: prompt buffer test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
14019
diff
changeset
|
15 endif |
945d343d3024
patch 8.1.0028: prompt buffer test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
14019
diff
changeset
|
16 if has('win32') |
945d343d3024
patch 8.1.0028: prompt buffer test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
14019
diff
changeset
|
17 " TODO: make this work on MS-Windows |
14019
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 return |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 endif |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 call writefile([ |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 \ 'func TextEntered(text)', |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 \ ' if a:text == "exit"', |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 \ ' stopinsert', |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 \ ' close', |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 \ ' else', |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 \ ' " Add the output above the current prompt.', |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 \ ' call append(line("$") - 1, "Command: \"" . a:text . "\"")', |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 \ ' " Reset &modified to allow the buffer to be closed.', |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 \ ' set nomodified', |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
30 \ ' call timer_start(20, {id -> TimerFunc(a:text)})', |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 \ ' endif', |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 \ 'endfunc', |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 \ '', |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
34 \ 'func TimerFunc(text)', |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
35 \ ' " Add the output above the current prompt.', |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
36 \ ' call append(line("$") - 1, "Result: \"" . a:text . "\"")', |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
37 \ 'endfunc', |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
38 \ '', |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
39 \ 'call setline(1, "other buffer")', |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
40 \ 'new', |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
41 \ 'set buftype=prompt', |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
42 \ 'call prompt_setcallback(bufnr(""), function("TextEntered"))', |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
43 \ 'startinsert', |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
44 \ ], 'Xpromptscript') |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
45 let buf = RunVimInTerminal('-S Xpromptscript', {}) |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
46 call WaitForAssert({-> assert_equal('%', term_getline(buf, 1))}) |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
47 |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
48 call term_sendkeys(buf, "hello\<CR>") |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
49 call WaitForAssert({-> assert_equal('% hello', term_getline(buf, 1))}) |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
50 call WaitForAssert({-> assert_equal('Command: "hello"', term_getline(buf, 2))}) |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
51 call WaitForAssert({-> assert_equal('Result: "hello"', term_getline(buf, 3))}) |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
52 |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
53 call term_sendkeys(buf, "exit\<CR>") |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
54 call WaitForAssert({-> assert_equal('other buffer', term_getline(buf, 1))}) |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
55 |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
56 call StopVimInTerminal(buf) |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
57 call delete('Xpromptscript') |
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
58 endfunc |