Mercurial > vim
annotate src/testdir/test_hardcopy.vim @ 22975:a943b175586a v8.2.2034
patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Commit: https://github.com/vim/vim/commit/792f786aad8409ca9ab895392742643a5b6aed8f
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Nov 23 08:31:18 2020 +0100
patch 8.2.2034: Vim9: list unpack in for statement not compiled yet
Problem: Vim9: list unpack in for statement not compiled yet.
Solution: Compile list unpack. (closes https://github.com/vim/vim/issues/7345)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 23 Nov 2020 08:45:04 +0100 |
parents | f43c0e669bd6 |
children | 8fa9d31cd248 |
rev | line source |
---|---|
7580
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Test :hardcopy |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
19663
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
3 source check.vim |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
4 |
19619
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
5 func Test_printoptions() |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
6 edit test_hardcopy.vim |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
7 syn on |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
8 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
9 for opt in ['left:5in,right:10pt,top:8mm,bottom:2pc', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
10 \ 'left:2in,top:30pt,right:16mm,bottom:3pc', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
11 \ 'header:3,syntax:y,number:y,wrap:n', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
12 \ 'header:3,syntax:n,number:y,wrap:y', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
13 \ 'duplex:short,collate:n,jobsplit:y,portrait:n', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
14 \ 'duplex:long,collate:y,jobsplit:n,portrait:y', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
15 \ 'paper:10x14', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
16 \ 'paper:A3', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
17 \ 'paper:A4', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
18 \ 'paper:A5', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
19 \ 'paper:B4', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
20 \ 'paper:B5', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
21 \ 'paper:executive', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
22 \ 'paper:folio', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
23 \ 'paper:ledger', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
24 \ 'paper:legal', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
25 \ 'paper:letter', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
26 \ 'paper:quarto', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
27 \ 'paper:statement', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
28 \ 'paper:tabloid', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
29 \ 'formfeed:y', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
30 \ ''] |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
31 exe 'set printoptions=' .. opt |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
32 if has('postscript') |
19663
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
33 1,50hardcopy > Xhardcopy_printoptions |
19619
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
34 let lines = readfile('Xhardcopy_printoptions') |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
35 call assert_true(len(lines) > 20, opt) |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
36 call assert_true(lines[0] =~ 'PS-Adobe', opt) |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
37 call delete('Xhardcopy_printoptions') |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
38 endif |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
39 endfor |
8829
a2c27f6aaf3a
commit https://github.com/vim/vim/commit/4afc7c5d4a73340831077a02bfe1f74935e7f4a1
Christian Brabandt <cb@256bit.org>
parents:
7588
diff
changeset
|
40 |
a2c27f6aaf3a
commit https://github.com/vim/vim/commit/4afc7c5d4a73340831077a02bfe1f74935e7f4a1
Christian Brabandt <cb@256bit.org>
parents:
7588
diff
changeset
|
41 call assert_fails('set printoptions=paper', 'E550:') |
a2c27f6aaf3a
commit https://github.com/vim/vim/commit/4afc7c5d4a73340831077a02bfe1f74935e7f4a1
Christian Brabandt <cb@256bit.org>
parents:
7588
diff
changeset
|
42 call assert_fails('set printoptions=shredder:on', 'E551:') |
a2c27f6aaf3a
commit https://github.com/vim/vim/commit/4afc7c5d4a73340831077a02bfe1f74935e7f4a1
Christian Brabandt <cb@256bit.org>
parents:
7588
diff
changeset
|
43 call assert_fails('set printoptions=left:no', 'E552:') |
19619
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
44 set printoptions& |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
45 bwipe |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
46 endfunc |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
47 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
48 func Test_printmbfont() |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
49 " Print a small help page which contains tabs to cover code that expands tabs to spaces. |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
50 help help |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
51 syn on |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
52 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
53 for opt in [':WadaMin-Regular,b:WadaMin-Bold,i:WadaMin-Italic,o:WadaMin-Bold-Italic,c:yes,a:no', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
54 \ ''] |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
55 exe 'set printmbfont=' .. opt |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
56 if has('postscript') |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
57 hardcopy > Xhardcopy_printmbfont |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
58 let lines = readfile('Xhardcopy_printmbfont') |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
59 call assert_true(len(lines) > 20, opt) |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
60 call assert_true(lines[0] =~ 'PS-Adobe', opt) |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
61 call delete('Xhardcopy_printmbfont') |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
62 endif |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
63 endfor |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
64 set printmbfont& |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
65 bwipe |
7580
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
66 endfunc |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
67 |
19663
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
68 func Test_printmbcharset() |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
69 CheckFeature postscript |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
70 |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
71 " digraph.txt has plenty of non-latin1 characters. |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
72 help digraph.txt |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
73 set printmbcharset=ISO10646 printencoding=utf-8 printmbfont=r:WadaMin-Regular |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
74 |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
75 hardcopy > Xhardcopy_printmbcharset |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
76 let lines = readfile('Xhardcopy_printmbcharset') |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
77 call assert_true(len(lines) > 20) |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
78 call assert_true(lines[0] =~ 'PS-Adobe') |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
79 |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
80 set printmbcharset=does-not-exist printencoding=utf-8 printmbfont=r:WadaMin-Regular |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
81 call assert_fails('hardcopy > Xhardcopy_printmbcharset', 'E456:') |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
82 |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
83 set printmbcharset=GB_2312-80 printencoding=utf-8 printmbfont=r:WadaMin-Regular |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
84 call assert_fails('hardcopy > Xhardcopy_printmbcharset', 'E673:') |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
85 |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
86 set printmbcharset=ISO10646 printencoding=utf-8 printmbfont= |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
87 call assert_fails('hardcopy > Xhardcopy_printmbcharset', 'E675:') |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
88 |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
89 call delete('Xhardcopy_printmbcharset') |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
90 set printmbcharset& printencoding& printmbfont& |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
91 bwipe |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
92 endfunc |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
93 |
19619
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
94 func Test_printexpr() |
19663
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
95 CheckFeature postscript |
19619
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
96 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
97 " Not a very useful printexpr value, but enough to test |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
98 " hardcopy with 'printexpr'. |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
99 function PrintFile(fname) |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
100 call writefile(['Test printexpr: ' .. v:cmdarg], |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
101 \ 'Xhardcopy_printexpr') |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
102 call delete(a:fname) |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
103 return 0 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
104 endfunc |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
105 set printexpr=PrintFile(v:fname_in) |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
106 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
107 help help |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
108 hardcopy dummy args |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
109 call assert_equal(['Test printexpr: dummy args'], |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
110 \ readfile('Xhardcopy_printexpr')) |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
111 call delete('Xhardcopy_printexpr') |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
112 |
19663
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
113 " Function returns 1 to test print failure. |
19619
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
114 function PrintFails(fname) |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
115 call delete(a:fname) |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
116 return 1 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
117 endfunc |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
118 set printexpr=PrintFails(v:fname_in) |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
119 call assert_fails('hardcopy', 'E365:') |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
120 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
121 set printexpr& |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
122 bwipe |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
123 endfunc |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
124 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
125 func Test_errors() |
19663
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
126 CheckFeature postscript |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
127 |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
128 edit test_hardcopy.vim |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
129 call assert_fails('hardcopy >', 'E324:') |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
130 bwipe |
19619
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
131 endfunc |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
132 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
133 func Test_dark_background() |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
134 edit test_hardcopy.vim |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
135 syn on |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
136 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
137 for bg in ['dark', 'light'] |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
138 exe 'set background=' .. bg |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
139 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
140 if has('postscript') |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
141 hardcopy > Xhardcopy_dark_background |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
142 let lines = readfile('Xhardcopy_dark_background') |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
143 call assert_true(len(lines) > 20) |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
144 call assert_true(lines[0] =~ 'PS-Adobe') |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
145 call delete('Xhardcopy_dark_background') |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
146 endif |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
147 endfor |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
148 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
149 set background& |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
150 bwipe |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
151 endfun |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
152 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
153 func Test_empty_buffer() |
19663
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
154 CheckFeature postscript |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
155 |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
156 new |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
157 call assert_equal("\nNo text to be printed", execute('hardcopy')) |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
158 bwipe |
7580
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
159 endfunc |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
160 |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
161 func Test_printheader_parsing() |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
162 " Only test that this doesn't throw an error. |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
163 set printheader=%<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
164 set printheader=%<%f%h%m%r%=%b\ 0x%B\ \ %l,%c%V\ %P |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
165 set printheader=%<%f%=\ [%1*%M%*%n%R%H]\ %-19(%3l,%02c%03V%)%O'%02b' |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
166 set printheader=...%r%{VarExists('b:gzflag','\ [GZ]')}%h... |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
167 set printheader= |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
168 set printheader& |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
169 endfunc |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
170 |
11463
6fff8b86e9bd
patch 8.0.0615: using % with :hardcopy wrongly escapes spaces
Christian Brabandt <cb@256bit.org>
parents:
8829
diff
changeset
|
171 func Test_fname_with_spaces() |
19663
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
172 CheckFeature postscript |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
173 |
14077
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
174 split t\ e\ s\ t.txt |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
175 call setline(1, ['just', 'some', 'text']) |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
176 hardcopy > %.ps |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
177 call assert_true(filereadable('t e s t.txt.ps')) |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
178 call delete('t e s t.txt.ps') |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
179 bwipe! |
11463
6fff8b86e9bd
patch 8.0.0615: using % with :hardcopy wrongly escapes spaces
Christian Brabandt <cb@256bit.org>
parents:
8829
diff
changeset
|
180 endfunc |
14077
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
181 |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
182 func Test_illegal_byte() |
19663
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
183 CheckFeature postscript |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
184 if &enc != 'utf-8' |
14077
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
185 return |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
186 endif |
19663
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
187 |
14077
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
188 new |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
189 " conversion of 0xff will fail, this used to cause a crash |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
190 call setline(1, "\xff") |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
191 hardcopy >Xpstest |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
192 |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
193 bwipe! |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
194 call delete('Xpstest') |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
195 endfunc |
19663
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
196 |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
197 " vim: shiftwidth=2 sts=2 expandtab |