annotate src/testdir/test11.in @ 8744:ff9973bbbfcb v7.4.1661

commit https://github.com/vim/vim/commit/fa8b2e173dd5f6c4a5cfd326abdcf68b8eebf90d Author: Bram Moolenaar <Bram@vim.org> Date: Sat Mar 26 22:19:27 2016 +0100 patch 7.4.1661 Problem: No test for special characters in channel eval command. Solution: Testing sending and receiving text with special characters.
author Christian Brabandt <cb@256bit.org>
date Sat, 26 Mar 2016 22:30:04 +0100
parents 9d5b8b015e5f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 Tests for autocommands:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 - FileWritePre writing a compressed file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3 - FileReadPost reading a compressed file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4 - BufNewFile reading a file template
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5 - BufReadPre decompressing the file to be read
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 - FilterReadPre substituting characters in the temp file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 - FilterReadPost substituting characters after filtering
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 - FileReadPre set options for decompression
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 - FileReadPost decompress the file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10
2516
82193fef6172 Make test 11 pass when there is no gzip program. (John Beckett)
Bram Moolenaar <bram@vim.org>
parents: 1624
diff changeset
11 Note: This test is skipped if "gzip" is not available.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 $GZIP is made empty, "-v" would cause trouble.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 Use a FileChangedShell autocommand to avoid a prompt for "Xtestfile.gz" being
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 modified outside of Vim (noticed on Solaris).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 STARTTEST
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 :so small.vim
2516
82193fef6172 Make test 11 pass when there is no gzip program. (John Beckett)
Bram Moolenaar <bram@vim.org>
parents: 1624
diff changeset
18 :" drop out when there is no gzip program
82193fef6172 Make test 11 pass when there is no gzip program. (John Beckett)
Bram Moolenaar <bram@vim.org>
parents: 1624
diff changeset
19 :if !executable("gzip")
82193fef6172 Make test 11 pass when there is no gzip program. (John Beckett)
Bram Moolenaar <bram@vim.org>
parents: 1624
diff changeset
20 : e! test.ok
82193fef6172 Make test 11 pass when there is no gzip program. (John Beckett)
Bram Moolenaar <bram@vim.org>
parents: 1624
diff changeset
21 : w! test.out
82193fef6172 Make test 11 pass when there is no gzip program. (John Beckett)
Bram Moolenaar <bram@vim.org>
parents: 1624
diff changeset
22 : qa!
82193fef6172 Make test 11 pass when there is no gzip program. (John Beckett)
Bram Moolenaar <bram@vim.org>
parents: 1624
diff changeset
23 :endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 :let $GZIP = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 :au FileChangedShell * echo "caught FileChangedShell"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 :set bin
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 :au FileWritePre *.gz '[,']!gzip
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 :au FileWritePost *.gz undo
18
293621502c4d updated for version 7.0010
vimboss
parents: 7
diff changeset
29 :/^start of testfile/,/^end of testfile/w! Xtestfile.gz
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 :au FileReadPost *.gz '[,']!gzip -d
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 :$r Xtestfile.gz " Read and decompress the testfile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 :?startstart?,$w! test.out " Write contents of this file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 :au BufNewFile *.c read Xtest.c
18
293621502c4d updated for version 7.0010
vimboss
parents: 7
diff changeset
34 :/^start of test.c/+1,/^end of test.c/-1w! Xtest.c
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 :e! foo.c " Will load Xtest.c
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 :au FileAppendPre *.out '[,']s/new/NEW/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 :au FileAppendPost *.out !cat Xtest.c >>test.out
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 :w>>test.out " Append it to the output file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 :au! FileAppendPre
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 :" setup autocommands to decompress before reading and re-compress afterwards
1624
18ee39301b82 updated for version 7.2a
vimboss
parents: 167
diff changeset
41 :au BufReadPre *.gz exe '!gzip -d ' . shellescape(expand("<afile>"))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 :au BufReadPre *.gz call rename(expand("<afile>:r"), expand("<afile>"))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 :au BufReadPost *.gz call rename(expand("<afile>"), expand("<afile>:r"))
1624
18ee39301b82 updated for version 7.2a
vimboss
parents: 167
diff changeset
44 :au BufReadPost *.gz exe '!gzip ' . shellescape(expand("<afile>:r"))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 :e! Xtestfile.gz " Edit compressed file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 :w>>test.out " Append it to the output file
167
c93c9cad9618 updated for version 7.0051
vimboss
parents: 63
diff changeset
47 :set shelltemp " need temp files here
1624
18ee39301b82 updated for version 7.2a
vimboss
parents: 167
diff changeset
48 :au FilterReadPre *.out call rename(expand("<afile>"), expand("<afile>") . ".t")
6272
9d5b8b015e5f updated for version 7.4.470
Bram Moolenaar <bram@vim.org>
parents: 2516
diff changeset
49 :au FilterReadPre *.out exe 'silent !sed s/e/E/ ' . shellescape(expand("<afile>")) . ".t >" . shellescape(expand("<afile>"))
9d5b8b015e5f updated for version 7.4.470
Bram Moolenaar <bram@vim.org>
parents: 2516
diff changeset
50 :au FilterReadPre *.out exe 'silent !rm ' . shellescape(expand("<afile>")) . '.t'
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 :au FilterReadPost *.out '[,']s/x/X/g
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 :e! test.out " Edit the output file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 :23,$!cat
63
f6e33184ccc3 updated for version 7.0030
vimboss
parents: 18
diff changeset
54 :23,$s/\r$// " remove CR for when sed adds them
6272
9d5b8b015e5f updated for version 7.4.470
Bram Moolenaar <bram@vim.org>
parents: 2516
diff changeset
55 :au! FileReadPre *.gz exe 'silent !gzip -d ' . shellescape(expand("<afile>"))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 :au FileReadPre *.gz call rename(expand("<afile>:r"), expand("<afile>"))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 :au! FileReadPost *.gz '[,']s/l/L/
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 :$r Xtestfile.gz " Read compressed file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 :w " write it, after filtering
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 :au! " remove all autocommands
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 :e " Edit test.out again
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 :set nobin ff& " use the default fileformat for writing
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 :w
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 :qa!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 ENDTEST
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 startstart
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 start of testfile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 line 2 Abcdefghijklmnopqrstuvwxyz
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 line 4 Abcdefghijklmnopqrstuvwxyz
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 line 5 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 line 6 Abcdefghijklmnopqrstuvwxyz
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74 line 7 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 line 8 Abcdefghijklmnopqrstuvwxyz
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 line 9 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77 line 10 Abcdefghijklmnopqrstuvwxyz
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78 end of testfile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80 start of test.c
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 * Here is a new .c file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 end of test.c