Mercurial > vim
annotate src/testdir/test_compiler.vim @ 17890:645284afff66
Added tag v8.1.1941 for changeset 0d64e74be8b2150e63979db1f34aa0f653cac7fa
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 30 Aug 2019 13:15:04 +0200 |
parents | 0d7c87cad133 |
children | 9b7c7754ba9d |
rev | line source |
---|---|
13970
939cfab265b9
patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Test the :compiler command |
939cfab265b9
patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
939cfab265b9
patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 func Test_compiler() |
939cfab265b9
patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 if !executable('perl') |
939cfab265b9
patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 return |
939cfab265b9
patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 endif |
939cfab265b9
patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 |
14260
9ff35e144467
patch 8.1.0146: when $LANG is set the compiler test may fail
Christian Brabandt <cb@256bit.org>
parents:
13974
diff
changeset
|
8 " $LANG changes the output of Perl. |
9ff35e144467
patch 8.1.0146: when $LANG is set the compiler test may fail
Christian Brabandt <cb@256bit.org>
parents:
13974
diff
changeset
|
9 if $LANG != '' |
9ff35e144467
patch 8.1.0146: when $LANG is set the compiler test may fail
Christian Brabandt <cb@256bit.org>
parents:
13974
diff
changeset
|
10 unlet $LANG |
9ff35e144467
patch 8.1.0146: when $LANG is set the compiler test may fail
Christian Brabandt <cb@256bit.org>
parents:
13974
diff
changeset
|
11 endif |
9ff35e144467
patch 8.1.0146: when $LANG is set the compiler test may fail
Christian Brabandt <cb@256bit.org>
parents:
13974
diff
changeset
|
12 |
17572
0d7c87cad133
patch 8.1.1783: MS-Windows: compiler test may fail when using %:S
Bram Moolenaar <Bram@vim.org>
parents:
14260
diff
changeset
|
13 " %:S does not work properly with 'shellslash' set |
0d7c87cad133
patch 8.1.1783: MS-Windows: compiler test may fail when using %:S
Bram Moolenaar <Bram@vim.org>
parents:
14260
diff
changeset
|
14 let save_shellslash = &shellslash |
0d7c87cad133
patch 8.1.1783: MS-Windows: compiler test may fail when using %:S
Bram Moolenaar <Bram@vim.org>
parents:
14260
diff
changeset
|
15 set noshellslash |
0d7c87cad133
patch 8.1.1783: MS-Windows: compiler test may fail when using %:S
Bram Moolenaar <Bram@vim.org>
parents:
14260
diff
changeset
|
16 |
13970
939cfab265b9
patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 e Xfoo.pl |
939cfab265b9
patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 compiler perl |
939cfab265b9
patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 call assert_equal('perl', b:current_compiler) |
939cfab265b9
patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 call assert_fails('let g:current_compiler', 'E121:') |
939cfab265b9
patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 |
939cfab265b9
patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 call setline(1, ['#!/usr/bin/perl -w', 'use strict;', 'my $foo=1']) |
939cfab265b9
patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 w! |
939cfab265b9
patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 call feedkeys(":make\<CR>\<CR>", 'tx') |
939cfab265b9
patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 call assert_fails('clist', 'E42:') |
939cfab265b9
patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 |
939cfab265b9
patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 call setline(1, ['#!/usr/bin/perl -w', 'use strict;', '$foo=1']) |
939cfab265b9
patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 w! |
939cfab265b9
patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 call feedkeys(":make\<CR>\<CR>", 'tx') |
939cfab265b9
patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
30 let a=execute('clist') |
13972
255967236075
patch 8.1.0004: test for :compiler command sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
13970
diff
changeset
|
31 call assert_match("\n 1 Xfoo.pl:3: Global symbol \"\$foo\" " |
255967236075
patch 8.1.0004: test for :compiler command sometimes fails
Christian Brabandt <cb@256bit.org>
parents:
13970
diff
changeset
|
32 \ . "requires explicit package name", a) |
13970
939cfab265b9
patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 |
17572
0d7c87cad133
patch 8.1.1783: MS-Windows: compiler test may fail when using %:S
Bram Moolenaar <Bram@vim.org>
parents:
14260
diff
changeset
|
34 let &shellslash = save_shellslash |
13970
939cfab265b9
patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
35 call delete('Xfoo.pl') |
939cfab265b9
patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
36 bw! |
939cfab265b9
patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
37 endfunc |
939cfab265b9
patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
38 |
939cfab265b9
patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
39 func Test_compiler_without_arg() |
939cfab265b9
patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
40 let a=split(execute('compiler')) |
13974
13cdf007cd2c
patch 8.1.0005: test for :compiler command fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
13972
diff
changeset
|
41 call assert_match('^.*runtime/compiler/ant.vim$', a[0]) |
13cdf007cd2c
patch 8.1.0005: test for :compiler command fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
13972
diff
changeset
|
42 call assert_match('^.*runtime/compiler/bcc.vim$', a[1]) |
13cdf007cd2c
patch 8.1.0005: test for :compiler command fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
13972
diff
changeset
|
43 call assert_match('^.*runtime/compiler/xmlwf.vim$', a[-1]) |
13970
939cfab265b9
patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
44 endfunc |
939cfab265b9
patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
45 |
939cfab265b9
patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
46 func Test_compiler_completion() |
939cfab265b9
patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
47 call feedkeys(":compiler \<C-A>\<C-B>\"\<CR>", 'tx') |
939cfab265b9
patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
48 call assert_match('^"compiler ant bcc .* xmlwf$', @:) |
939cfab265b9
patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
49 |
939cfab265b9
patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
50 call feedkeys(":compiler p\<C-A>\<C-B>\"\<CR>", 'tx') |
939cfab265b9
patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
51 call assert_equal('"compiler pbx perl php pylint pyunit', @:) |
939cfab265b9
patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
52 |
939cfab265b9
patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
53 call feedkeys(":compiler! p\<C-A>\<C-B>\"\<CR>", 'tx') |
939cfab265b9
patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
54 call assert_equal('"compiler! pbx perl php pylint pyunit', @:) |
939cfab265b9
patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
55 endfunc |
939cfab265b9
patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
56 |
939cfab265b9
patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
57 func Test_compiler_error() |
939cfab265b9
patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
58 call assert_fails('compiler doesnotexist', 'E666:') |
939cfab265b9
patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
59 endfunc |