Mercurial > vim
annotate src/testdir/test_hardcopy.vim @ 33622:ff131131b561 v9.0.2053
patch 9.0.2053: zig filetype detection test wrong
Commit: https://github.com/vim/vim/commit/a8c664a042707e293d887d5b90f944f6fd5c99aa
Author: Gregory Anders <greg@gpanders.com>
Date: Thu Oct 19 19:57:57 2023 +0200
patch 9.0.2053: zig filetype detection test wrong
Problem: zig filetype detection test wrong
Solution: Remove .zir pattern, add new test for .zon pattern
closes: #13389
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Gregory Anders <greg@gpanders.com>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 19 Oct 2023 20:00:03 +0200 |
parents | c2c40cefc17b |
children |
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', |
23452
8fa9d31cd248
patch 8.2.2269: not all :hardcopy code covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19663
diff
changeset
|
13 \ 'header:0,syntax:a,number:y,wrap:y', |
19619
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
14 \ '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
|
15 \ 'duplex:long,collate:y,jobsplit:n,portrait:y', |
23452
8fa9d31cd248
patch 8.2.2269: not all :hardcopy code covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19663
diff
changeset
|
16 \ 'duplex:off,collate:y,jobsplit:y,portrait:y', |
19619
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
17 \ 'paper:10x14', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
18 \ 'paper:A3', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
19 \ 'paper:A4', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
20 \ 'paper:A5', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
21 \ 'paper:B4', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
22 \ 'paper:B5', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
23 \ 'paper:executive', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
24 \ 'paper:folio', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
25 \ 'paper:ledger', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
26 \ 'paper:legal', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
27 \ 'paper:letter', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
28 \ 'paper:quarto', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
29 \ 'paper:statement', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
30 \ 'paper:tabloid', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
31 \ 'formfeed:y', |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
32 \ ''] |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
33 exe 'set printoptions=' .. opt |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
34 if has('postscript') |
19663
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
35 1,50hardcopy > Xhardcopy_printoptions |
19619
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
36 let lines = readfile('Xhardcopy_printoptions') |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
37 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
|
38 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
|
39 call delete('Xhardcopy_printoptions') |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
40 endif |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
41 endfor |
8829
a2c27f6aaf3a
commit https://github.com/vim/vim/commit/4afc7c5d4a73340831077a02bfe1f74935e7f4a1
Christian Brabandt <cb@256bit.org>
parents:
7588
diff
changeset
|
42 |
a2c27f6aaf3a
commit https://github.com/vim/vim/commit/4afc7c5d4a73340831077a02bfe1f74935e7f4a1
Christian Brabandt <cb@256bit.org>
parents:
7588
diff
changeset
|
43 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
|
44 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
|
45 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
|
46 set printoptions& |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
47 bwipe |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
48 endfunc |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
49 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
50 func Test_printmbfont() |
23452
8fa9d31cd248
patch 8.2.2269: not all :hardcopy code covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19663
diff
changeset
|
51 " Print a help page which contains tabs, underlines (etc) to recover more code. |
8fa9d31cd248
patch 8.2.2269: not all :hardcopy code covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19663
diff
changeset
|
52 help syntax.txt |
19619
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
53 syn on |
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 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
|
56 \ ''] |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
57 exe 'set printmbfont=' .. opt |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
58 if has('postscript') |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
59 hardcopy > Xhardcopy_printmbfont |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
60 let lines = readfile('Xhardcopy_printmbfont') |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
61 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
|
62 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
|
63 call delete('Xhardcopy_printmbfont') |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
64 endif |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
65 endfor |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
66 set printmbfont& |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
67 bwipe |
7580
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
68 endfunc |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
69 |
19663
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
70 func Test_printmbcharset() |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
71 CheckFeature postscript |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
72 |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
73 " 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
|
74 help digraph.txt |
23452
8fa9d31cd248
patch 8.2.2269: not all :hardcopy code covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19663
diff
changeset
|
75 set printmbcharset=ISO10646 printencoding=utf-8 |
8fa9d31cd248
patch 8.2.2269: not all :hardcopy code covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19663
diff
changeset
|
76 for courier in ['yes', 'no'] |
8fa9d31cd248
patch 8.2.2269: not all :hardcopy code covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19663
diff
changeset
|
77 for ascii in ['yes', 'no'] |
8fa9d31cd248
patch 8.2.2269: not all :hardcopy code covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19663
diff
changeset
|
78 exe 'set printmbfont=r:WadaMin-Regular,b:WadaMin-Bold,i:WadaMin-Italic,o:WadaMin-BoldItalic' |
8fa9d31cd248
patch 8.2.2269: not all :hardcopy code covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19663
diff
changeset
|
79 \ .. ',c:' .. courier .. ',a:' .. ascii |
8fa9d31cd248
patch 8.2.2269: not all :hardcopy code covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19663
diff
changeset
|
80 hardcopy > Xhardcopy_printmbcharset |
8fa9d31cd248
patch 8.2.2269: not all :hardcopy code covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19663
diff
changeset
|
81 let lines = readfile('Xhardcopy_printmbcharset') |
8fa9d31cd248
patch 8.2.2269: not all :hardcopy code covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19663
diff
changeset
|
82 call assert_true(len(lines) > 20) |
8fa9d31cd248
patch 8.2.2269: not all :hardcopy code covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19663
diff
changeset
|
83 call assert_true(lines[0] =~ 'PS-Adobe') |
8fa9d31cd248
patch 8.2.2269: not all :hardcopy code covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19663
diff
changeset
|
84 endfor |
8fa9d31cd248
patch 8.2.2269: not all :hardcopy code covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19663
diff
changeset
|
85 endfor |
19663
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
86 |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
87 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
|
88 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
|
89 |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
90 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
|
91 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
|
92 |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
93 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
|
94 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
|
95 |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
96 call delete('Xhardcopy_printmbcharset') |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
97 set printmbcharset& printencoding& printmbfont& |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
98 bwipe |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
99 endfunc |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
100 |
19619
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
101 func Test_printexpr() |
19663
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
102 CheckFeature postscript |
19619
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
103 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
104 " 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
|
105 " hardcopy with 'printexpr'. |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
106 function PrintFile(fname) |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
107 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
|
108 \ 'Xhardcopy_printexpr') |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
109 call delete(a:fname) |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
110 return 0 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
111 endfunc |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
112 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
|
113 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
114 help help |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
115 hardcopy dummy args |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
116 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
|
117 \ readfile('Xhardcopy_printexpr')) |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
118 call delete('Xhardcopy_printexpr') |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
119 |
19663
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
120 " 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
|
121 function PrintFails(fname) |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
122 call delete(a:fname) |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
123 return 1 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
124 endfunc |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
125 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
|
126 call assert_fails('hardcopy', 'E365:') |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
127 |
26743
c2c40cefc17b
patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents:
23452
diff
changeset
|
128 " Using a script-local function |
c2c40cefc17b
patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents:
23452
diff
changeset
|
129 func s:NewPrintExpr() |
c2c40cefc17b
patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents:
23452
diff
changeset
|
130 endfunc |
c2c40cefc17b
patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents:
23452
diff
changeset
|
131 set printexpr=s:NewPrintExpr() |
c2c40cefc17b
patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents:
23452
diff
changeset
|
132 call assert_equal(expand('<SID>') .. 'NewPrintExpr()', &printexpr) |
c2c40cefc17b
patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents:
23452
diff
changeset
|
133 set printexpr=<SID>NewPrintExpr() |
c2c40cefc17b
patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents:
23452
diff
changeset
|
134 call assert_equal(expand('<SID>') .. 'NewPrintExpr()', &printexpr) |
c2c40cefc17b
patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents:
23452
diff
changeset
|
135 |
19619
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
136 set printexpr& |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
137 bwipe |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
138 endfunc |
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 func Test_errors() |
19663
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
141 CheckFeature postscript |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
142 |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
143 edit test_hardcopy.vim |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
144 call assert_fails('hardcopy >', 'E324:') |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
145 bwipe |
19619
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
146 endfunc |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
147 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
148 func Test_dark_background() |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
149 edit test_hardcopy.vim |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
150 syn on |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
151 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
152 for bg in ['dark', 'light'] |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
153 exe 'set background=' .. bg |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
154 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
155 if has('postscript') |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
156 hardcopy > Xhardcopy_dark_background |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
157 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
|
158 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
|
159 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
|
160 call delete('Xhardcopy_dark_background') |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
161 endif |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
162 endfor |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
163 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
164 set background& |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
165 bwipe |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
166 endfun |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
167 |
1eb83d461033
patch 8.2.0366: hardcopy command not tested enough
Bram Moolenaar <Bram@vim.org>
parents:
14077
diff
changeset
|
168 func Test_empty_buffer() |
19663
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
169 CheckFeature postscript |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
170 |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
171 new |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
172 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
|
173 bwipe |
7580
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
174 endfunc |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
175 |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
176 func Test_printheader_parsing() |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
177 " 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
|
178 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
|
179 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
|
180 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
|
181 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
|
182 set printheader= |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
183 set printheader& |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
184 endfunc |
e9c8eacb6760
commit https://github.com/vim/vim/commit/b5690794cf081773628fa0f1f2b948fd129d5b39
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
185 |
11463
6fff8b86e9bd
patch 8.0.0615: using % with :hardcopy wrongly escapes spaces
Christian Brabandt <cb@256bit.org>
parents:
8829
diff
changeset
|
186 func Test_fname_with_spaces() |
19663
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
187 CheckFeature postscript |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
188 |
14077
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
189 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
|
190 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
|
191 hardcopy > %.ps |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
192 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
|
193 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
|
194 bwipe! |
11463
6fff8b86e9bd
patch 8.0.0615: using % with :hardcopy wrongly escapes spaces
Christian Brabandt <cb@256bit.org>
parents:
8829
diff
changeset
|
195 endfunc |
14077
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
196 |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
197 func Test_illegal_byte() |
19663
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
198 CheckFeature postscript |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
199 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
|
200 return |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
201 endif |
19663
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
202 |
14077
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
203 new |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
204 " 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
|
205 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
|
206 hardcopy >Xpstest |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
207 |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
208 bwipe! |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
209 call delete('Xpstest') |
873542706b0b
patch 8.1.0056: crash when using :hardcopy with illegal byte
Christian Brabandt <cb@256bit.org>
parents:
12692
diff
changeset
|
210 endfunc |
19663
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
211 |
f43c0e669bd6
patch 8.2.0388: printmbcharset option not tested
Bram Moolenaar <Bram@vim.org>
parents:
19619
diff
changeset
|
212 " vim: shiftwidth=2 sts=2 expandtab |