annotate src/testdir/screendump.vim @ 13322:0dc2e4998a15 v8.0.1535

patch 8.0.1535: C syntax test still fails when using gvim commit https://github.com/vim/vim/commit/6acadda8d60892ddf06449f1cc4286912b0c0c2b Author: Bram Moolenaar <Bram@vim.org> Date: Sat Feb 24 16:51:32 2018 +0100 patch 8.0.1535: C syntax test still fails when using gvim Problem: C syntax test still fails when using gvim. Solution: Clear Normal cterm highlighting instead of setting it.
author Christian Brabandt <cb@256bit.org>
date Sat, 24 Feb 2018 17:00:07 +0100
parents a90063ec1cd6
children 424321d6eea7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13304
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Functions shared by tests making screen dumps.
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 " Only load this script once.
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 if exists('*RunVimInTerminal')
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 finish
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 endif
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 source shared.vim
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 " Run Vim with "arguments" in a new terminal window.
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 " By default uses a size of 20 lines and 75 columns.
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 " Returns the buffer number of the terminal.
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 "
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 " Options is a dictionary (not used yet).
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 func RunVimInTerminal(arguments, options)
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 " Make a horizontal and vertical split, so that we can get exactly the right
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 " size terminal window. Works only when we currently have one window.
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 call assert_equal(1, winnr('$'))
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 split
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 vsplit
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21
13322
0dc2e4998a15 patch 8.0.1535: C syntax test still fails when using gvim
Christian Brabandt <cb@256bit.org>
parents: 13320
diff changeset
22 " Always do this with 256 colors and a light background.
0dc2e4998a15 patch 8.0.1535: C syntax test still fails when using gvim
Christian Brabandt <cb@256bit.org>
parents: 13320
diff changeset
23 set t_Co=256 background=light
0dc2e4998a15 patch 8.0.1535: C syntax test still fails when using gvim
Christian Brabandt <cb@256bit.org>
parents: 13320
diff changeset
24 hi Normal ctermfg=NONE ctermbg=NONE
13304
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 let cmd = GetVimCommandClean()
13320
a90063ec1cd6 patch 8.0.1534: C syntax test fails when using gvim
Christian Brabandt <cb@256bit.org>
parents: 13304
diff changeset
27 " Add -v to have gvim run in the terminal (if possible)
a90063ec1cd6 patch 8.0.1534: C syntax test fails when using gvim
Christian Brabandt <cb@256bit.org>
parents: 13304
diff changeset
28 let cmd .= ' -v ' . a:arguments
13304
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 let buf = term_start(cmd, {'curwin': 1, 'term_rows': 20, 'term_cols': 75})
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 call assert_equal([20, 75], term_getsize(buf))
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 return buf
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 endfunc
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 " Stop a Vim running in terminal buffer "buf".
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 func StopVimInTerminal(buf)
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 call assert_equal("running", term_getstatus(a:buf))
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 call term_sendkeys(a:buf, ":qa!\<cr>")
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 call WaitFor('term_getstatus(' . a:buf . ') == "finished"')
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 only!
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 endfunc
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 " Verify that Vim running in terminal buffer "buf" matches the screen dump.
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 " The file name used is "dumps/{filename}.dump".
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 " Will wait for up to a second for the screen dump to match.
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 func VerifyScreenDump(buf, filename)
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 let reference = 'dumps/' . a:filename . '.dump'
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 let testfile = a:filename . '.dump.failed'
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
49
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50 let i = 0
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51 while 1
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 call delete(testfile)
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 call term_dumpwrite(a:buf, testfile)
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
54 if readfile(reference) == readfile(testfile)
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
55 call delete(testfile)
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
56 break
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57 endif
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
58 if i == 100
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59 " Leave the test file around for inspection.
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
60 call assert_report('See dump file difference: call term_dumpdiff("' . testfile . '", "' . reference . '")')
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61 break
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
62 endif
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
63 sleep 10m
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
64 let i += 1
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
65 endwhile
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
66 endfunc