Mercurial > vim
comparison src/testdir/shared.vim @ 17164:7927cf327396 v8.1.1581
patch 8.1.1581: shared functions for testing are disorganised
commit https://github.com/vim/vim/commit/7a39dd7f00239059ce34660611589b26126a550c
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jun 23 00:50:15 2019 +0200
patch 8.1.1581: shared functions for testing are disorganised
Problem: Shared functions for testing are disorganised.
Solution: Group finctions in script files. (Ozaki Kiichi, closes https://github.com/vim/vim/issues/4573)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 23 Jun 2019 01:00:05 +0200 |
parents | f38fcbf343ce |
children | 3e2e998ce0db |
comparison
equal
deleted
inserted
replaced
17163:f5a43b78de92 | 17164:7927cf327396 |
---|---|
1 " Functions shared by several tests. | 1 " Functions shared by several tests. |
2 | 2 |
3 " Only load this script once. | 3 " Only load this script once. |
4 if exists('*WaitFor') | 4 if exists('*PythonProg') |
5 finish | 5 finish |
6 endif | 6 endif |
7 | |
8 source view_util.vim | |
7 | 9 |
8 " Get the name of the Python executable. | 10 " Get the name of the Python executable. |
9 " Also keeps it in s:python. | 11 " Also keeps it in s:python. |
10 func PythonProg() | 12 func PythonProg() |
11 " This test requires the Python command to run the test server. | 13 " This test requires the Python command to run the test server. |
325 if has('x11') | 327 if has('x11') |
326 return $DISPLAY != "" | 328 return $DISPLAY != "" |
327 endif | 329 endif |
328 return 1 | 330 return 1 |
329 endfunc | 331 endfunc |
330 | |
331 " Get line "lnum" as displayed on the screen. | |
332 " Trailing white space is trimmed. | |
333 func Screenline(lnum) | |
334 let chars = [] | |
335 for c in range(1, winwidth(0)) | |
336 call add(chars, nr2char(screenchar(a:lnum, c))) | |
337 endfor | |
338 let line = join(chars, '') | |
339 return matchstr(line, '^.\{-}\ze\s*$') | |
340 endfunc | |
341 | |
342 " Stops the shell running in terminal "buf". | |
343 func Stop_shell_in_terminal(buf) | |
344 call term_sendkeys(a:buf, "exit\r") | |
345 let job = term_getjob(a:buf) | |
346 call WaitFor({-> job_status(job) == "dead"}) | |
347 endfunc | |
348 | |
349 " Gets the text of a terminal line, using term_scrape() | |
350 func Get_terminal_text(bufnr, row) | |
351 let list = term_scrape(a:bufnr, a:row) | |
352 let text = '' | |
353 for item in list | |
354 let text .= item.chars | |
355 endfor | |
356 return text | |
357 endfunc |