annotate src/testdir/test_filetype.vim @ 11545:1780e6fecb30 v8.0.0655

patch 8.0.0655: not easy to make sure a function does not exist commit https://github.com/vim/vim/commit/d6abcd154cdc6a8dd4b7c6ccad37617ea8a1b4aa Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jun 22 19:15:24 2017 +0200 patch 8.0.0655: not easy to make sure a function does not exist Problem: Not easy to make sure a function does not exist. Solution: Add ! as an optional argument to :delfunc.
author Christian Brabandt <cb@256bit.org>
date Thu, 22 Jun 2017 19:30:04 +0200
parents 561b76ed9d12
children c2aa4af29251
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11459
561b76ed9d12 patch 8.0.0613: the conf filetype is used before ftdetect from packages
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Test :setfiletype
561b76ed9d12 patch 8.0.0613: the conf filetype is used before ftdetect from packages
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
561b76ed9d12 patch 8.0.0613: the conf filetype is used before ftdetect from packages
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 func Test_detection()
561b76ed9d12 patch 8.0.0613: the conf filetype is used before ftdetect from packages
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 filetype on
561b76ed9d12 patch 8.0.0613: the conf filetype is used before ftdetect from packages
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 augroup filetypedetect
561b76ed9d12 patch 8.0.0613: the conf filetype is used before ftdetect from packages
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 au BufNewFile,BufRead * call assert_equal(1, did_filetype())
561b76ed9d12 patch 8.0.0613: the conf filetype is used before ftdetect from packages
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 augroup END
561b76ed9d12 patch 8.0.0613: the conf filetype is used before ftdetect from packages
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 new something.vim
561b76ed9d12 patch 8.0.0613: the conf filetype is used before ftdetect from packages
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 call assert_equal('vim', &filetype)
561b76ed9d12 patch 8.0.0613: the conf filetype is used before ftdetect from packages
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10
561b76ed9d12 patch 8.0.0613: the conf filetype is used before ftdetect from packages
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 bwipe!
561b76ed9d12 patch 8.0.0613: the conf filetype is used before ftdetect from packages
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 filetype off
561b76ed9d12 patch 8.0.0613: the conf filetype is used before ftdetect from packages
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 endfunc
561b76ed9d12 patch 8.0.0613: the conf filetype is used before ftdetect from packages
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14
561b76ed9d12 patch 8.0.0613: the conf filetype is used before ftdetect from packages
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 func Test_conf_type()
561b76ed9d12 patch 8.0.0613: the conf filetype is used before ftdetect from packages
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 filetype on
561b76ed9d12 patch 8.0.0613: the conf filetype is used before ftdetect from packages
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 call writefile(['# some comment', 'must be conf'], 'Xfile')
561b76ed9d12 patch 8.0.0613: the conf filetype is used before ftdetect from packages
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 augroup filetypedetect
561b76ed9d12 patch 8.0.0613: the conf filetype is used before ftdetect from packages
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 au BufNewFile,BufRead * call assert_equal(0, did_filetype())
561b76ed9d12 patch 8.0.0613: the conf filetype is used before ftdetect from packages
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 augroup END
561b76ed9d12 patch 8.0.0613: the conf filetype is used before ftdetect from packages
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 split Xfile
561b76ed9d12 patch 8.0.0613: the conf filetype is used before ftdetect from packages
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 call assert_equal('conf', &filetype)
561b76ed9d12 patch 8.0.0613: the conf filetype is used before ftdetect from packages
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23
561b76ed9d12 patch 8.0.0613: the conf filetype is used before ftdetect from packages
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 bwipe!
561b76ed9d12 patch 8.0.0613: the conf filetype is used before ftdetect from packages
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 call delete('Xfile')
561b76ed9d12 patch 8.0.0613: the conf filetype is used before ftdetect from packages
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 filetype off
561b76ed9d12 patch 8.0.0613: the conf filetype is used before ftdetect from packages
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 endfunc
561b76ed9d12 patch 8.0.0613: the conf filetype is used before ftdetect from packages
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28
561b76ed9d12 patch 8.0.0613: the conf filetype is used before ftdetect from packages
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 func Test_other_type()
561b76ed9d12 patch 8.0.0613: the conf filetype is used before ftdetect from packages
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 filetype on
561b76ed9d12 patch 8.0.0613: the conf filetype is used before ftdetect from packages
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 augroup filetypedetect
561b76ed9d12 patch 8.0.0613: the conf filetype is used before ftdetect from packages
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 au BufNewFile,BufRead * call assert_equal(0, did_filetype())
561b76ed9d12 patch 8.0.0613: the conf filetype is used before ftdetect from packages
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 au BufNewFile,BufRead Xfile setf testfile
561b76ed9d12 patch 8.0.0613: the conf filetype is used before ftdetect from packages
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 au BufNewFile,BufRead * call assert_equal(1, did_filetype())
561b76ed9d12 patch 8.0.0613: the conf filetype is used before ftdetect from packages
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 augroup END
561b76ed9d12 patch 8.0.0613: the conf filetype is used before ftdetect from packages
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 call writefile(['# some comment', 'must be conf'], 'Xfile')
561b76ed9d12 patch 8.0.0613: the conf filetype is used before ftdetect from packages
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 split Xfile
561b76ed9d12 patch 8.0.0613: the conf filetype is used before ftdetect from packages
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 call assert_equal('testfile', &filetype)
561b76ed9d12 patch 8.0.0613: the conf filetype is used before ftdetect from packages
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39
561b76ed9d12 patch 8.0.0613: the conf filetype is used before ftdetect from packages
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 bwipe!
561b76ed9d12 patch 8.0.0613: the conf filetype is used before ftdetect from packages
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 call delete('Xfile')
561b76ed9d12 patch 8.0.0613: the conf filetype is used before ftdetect from packages
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 filetype off
561b76ed9d12 patch 8.0.0613: the conf filetype is used before ftdetect from packages
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 endfunc