Skip to content

Commit 10561fe

Browse files
committed
patch 8.1.0003: the :compiler command is not tested
Problem: The :compiler command is not tested. Solution: Add a test. (Dominique Pelle, closes #2930)
1 parent 2abad54 commit 10561fe

4 files changed

Lines changed: 54 additions & 0 deletions

File tree

src/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2150,6 +2150,7 @@ test_arglist \
21502150
test_cmdline \
21512151
test_command_count \
21522152
test_comparators \
2153+
test_compiler \
21532154
test_crypt \
21542155
test_cscope \
21552156
test_cursor_func \

src/testdir/test_alot.vim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ source test_assign.vim
55
source test_bufline.vim
66
source test_cd.vim
77
source test_changedtick.vim
8+
source test_compiler.vim
89
source test_cursor_func.vim
910
source test_delete.vim
1011
source test_ex_undo.vim

src/testdir/test_compiler.vim

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
" Test the :compiler command
2+
3+
func Test_compiler()
4+
if !executable('perl')
5+
return
6+
endif
7+
8+
e Xfoo.pl
9+
compiler perl
10+
call assert_equal('perl', b:current_compiler)
11+
call assert_fails('let g:current_compiler', 'E121:')
12+
13+
call setline(1, ['#!/usr/bin/perl -w', 'use strict;', 'my $foo=1'])
14+
w!
15+
call feedkeys(":make\<CR>\<CR>", 'tx')
16+
call assert_fails('clist', 'E42:')
17+
18+
call setline(1, ['#!/usr/bin/perl -w', 'use strict;', '$foo=1'])
19+
w!
20+
call feedkeys(":make\<CR>\<CR>", 'tx')
21+
let a=execute('clist')
22+
call assert_equal("\n 1 Xfoo.pl:3: Global symbol \"\$foo\" "
23+
\ . "requires explicit package name "
24+
\ . "(did you forget to declare \"my $foo\"?)", a)
25+
26+
call delete('Xfoo.pl')
27+
bw!
28+
endfunc
29+
30+
func Test_compiler_without_arg()
31+
let a=split(execute('compiler'))
32+
call assert_equal($VIMRUNTIME . '/compiler/ant.vim', a[0])
33+
call assert_equal($VIMRUNTIME . '/compiler/bcc.vim', a[1])
34+
call assert_equal($VIMRUNTIME . '/compiler/xmlwf.vim', a[-1])
35+
endfunc
36+
37+
func Test_compiler_completion()
38+
call feedkeys(":compiler \<C-A>\<C-B>\"\<CR>", 'tx')
39+
call assert_match('^"compiler ant bcc .* xmlwf$', @:)
40+
41+
call feedkeys(":compiler p\<C-A>\<C-B>\"\<CR>", 'tx')
42+
call assert_equal('"compiler pbx perl php pylint pyunit', @:)
43+
44+
call feedkeys(":compiler! p\<C-A>\<C-B>\"\<CR>", 'tx')
45+
call assert_equal('"compiler! pbx perl php pylint pyunit', @:)
46+
endfunc
47+
48+
func Test_compiler_error()
49+
call assert_fails('compiler doesnotexist', 'E666:')
50+
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,8 @@ static char *(features[]) =
761761

762762
static int included_patches[] =
763763
{ /* Add new patch number below this line */
764+
/**/
765+
3,
764766
/**/
765767
2,
766768
/**/

0 commit comments

Comments
 (0)