~ubuntu-branches/debian/sid/neovim/sid

« back to all changes in this revision

Viewing changes to src/nvim/testdir/test11.in

  • Committer: Package Import Robot
  • Author(s): James McCoy
  • Date: 2016-04-18 21:42:19 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20160418214219-1e6d4o1fwqarzk46
Tags: 0.1.3-1
* New upstream release.  (Closes: #820562)
* debian/control:
  + Remove unnecessary luarocks Build-Depends
  + Add libkvm-dev Build-Depends for kfreebsd-*
  + Add python(3)-neovim to Recommends.  (Closes: #812737)
  + Declare compiance with policy 3.9.8, no changes needed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Tests for autocommands:
2
 
- FileWritePre          writing a compressed file
3
 
- FileReadPost          reading a compressed file
4
 
- BufNewFile            reading a file template
5
 
- BufReadPre            decompressing the file to be read
6
 
- FilterReadPre         substituting characters in the temp file
7
 
- FilterReadPost        substituting characters after filtering
8
 
- FileReadPre           set options for decompression
9
 
- FileReadPost          decompress the file
10
 
 
11
 
Note: This test is skipped if "gzip" is not available.
12
 
$GZIP is made empty, "-v" would cause trouble.
13
 
Use a FileChangedShell autocommand to avoid a prompt for "Xtestfile.gz" being
14
 
modified outside of Vim (noticed on Solaris).
15
 
 
16
 
STARTTEST
17
 
:so small.vim
18
 
:" drop out when there is no gzip program
19
 
:if !executable("gzip")
20
 
: e! test.ok
21
 
: w! test.out
22
 
: qa!
23
 
:endif
24
 
:let $GZIP = ""
25
 
:au FileChangedShell * echo "caught FileChangedShell"
26
 
:set bin
27
 
:au FileWritePre    *.gz   '[,']!gzip
28
 
:au FileWritePost   *.gz   undo
29
 
:/^start of testfile/,/^end of testfile/w! Xtestfile.gz
30
 
:au FileReadPost    *.gz   '[,']!gzip -d
31
 
:$r Xtestfile.gz                " Read and decompress the testfile
32
 
:?startstart?,$w! test.out      " Write contents of this file
33
 
:au BufNewFile      *.c    read Xtest.c
34
 
:/^start of test.c/+1,/^end of test.c/-1w! Xtest.c
35
 
:e! foo.c                       " Will load Xtest.c
36
 
:au FileAppendPre   *.out  '[,']s/new/NEW/
37
 
:au FileAppendPost  *.out  !cat Xtest.c >>test.out
38
 
:w>>test.out                    " Append it to the output file
39
 
:au! FileAppendPre
40
 
:" setup autocommands to decompress before reading and re-compress afterwards
41
 
:au BufReadPre      *.gz   exe '!gzip -d ' . shellescape(expand("<afile>"))
42
 
:au BufReadPre      *.gz   call rename(expand("<afile>:r"), expand("<afile>"))
43
 
:au BufReadPost     *.gz   call rename(expand("<afile>"), expand("<afile>:r"))
44
 
:au BufReadPost     *.gz   exe '!gzip ' . shellescape(expand("<afile>:r"))
45
 
:e! Xtestfile.gz                " Edit compressed file
46
 
:w>>test.out                    " Append it to the output file
47
 
:set shelltemp                  " need temp files here
48
 
:au FilterReadPre   *.out  call rename(expand("<afile>"), expand("<afile>") . ".t")
49
 
:au FilterReadPre   *.out  exe 'silent !sed s/e/E/ ' . shellescape(expand("<afile>")) . ".t >" . shellescape(expand("<afile>"))
50
 
:au FilterReadPre   *.out  exe 'silent !rm ' . shellescape(expand("<afile>")) . '.t'
51
 
:au FilterReadPost  *.out  '[,']s/x/X/g
52
 
:e! test.out                    " Edit the output file
53
 
:23,$!cat
54
 
:23,$s/\r$//                 " remove CR for when sed adds them
55
 
:au! FileReadPre    *.gz   exe 'silent !gzip -d ' . shellescape(expand("<afile>"))
56
 
:au  FileReadPre    *.gz   call rename(expand("<afile>:r"), expand("<afile>"))
57
 
:au! FileReadPost   *.gz   '[,']s/l/L/
58
 
:$r Xtestfile.gz             " Read compressed file
59
 
:w                           " write it, after filtering
60
 
:au!             " remove all autocommands
61
 
:e               " Edit test.out again
62
 
:set nobin ff&   " use the default fileformat for writing
63
 
:w
64
 
:qa!
65
 
ENDTEST
66
 
 
67
 
startstart
68
 
start of testfile
69
 
line 2  Abcdefghijklmnopqrstuvwxyz
70
 
line 3  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
71
 
line 4  Abcdefghijklmnopqrstuvwxyz
72
 
line 5  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
73
 
line 6  Abcdefghijklmnopqrstuvwxyz
74
 
line 7  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
75
 
line 8  Abcdefghijklmnopqrstuvwxyz
76
 
line 9  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
77
 
line 10 Abcdefghijklmnopqrstuvwxyz
78
 
end of testfile
79
 
 
80
 
start of test.c
81
 
/*
82
 
 * Here is a new .c file
83
 
 */
84
 
end of test.c