annotate src/testdir/test_compiler.vim @ 15062:3a94f7918980 v8.1.0542

patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account commit https://github.com/vim/vim/commit/f951416a8396a54bbbe21de1a8b16716428549f2 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Nov 22 03:08:29 2018 +0100 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account Problem: shiftwidth() does not take 'vartabstop' into account. Solution: Use the cursor position or a position explicitly passed. Also make >> and << work better with 'vartabstop'. (Christian Brabandt)
author Bram Moolenaar <Bram@vim.org>
date Thu, 22 Nov 2018 03:15:10 +0100
parents 9ff35e144467
children 0d7c87cad133
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
13970
939cfab265b9 patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 e Xfoo.pl
939cfab265b9 patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 compiler perl
939cfab265b9 patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 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
16 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
17
939cfab265b9 patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 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
19 w!
939cfab265b9 patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 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
21 call assert_fails('clist', 'E42:')
939cfab265b9 patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22
939cfab265b9 patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 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
24 w!
939cfab265b9 patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 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
26 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
27 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
28 \ . "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
29
939cfab265b9 patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 call delete('Xfoo.pl')
939cfab265b9 patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 bw!
939cfab265b9 patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 endfunc
939cfab265b9 patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33
939cfab265b9 patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 func Test_compiler_without_arg()
939cfab265b9 patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 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
36 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
37 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
38 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
39 endfunc
939cfab265b9 patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40
939cfab265b9 patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 func Test_compiler_completion()
939cfab265b9 patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 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
43 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
44
939cfab265b9 patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 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
46 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
47
939cfab265b9 patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 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
49 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
50 endfunc
939cfab265b9 patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51
939cfab265b9 patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 func Test_compiler_error()
939cfab265b9 patch 8.1.0003: the :compiler command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 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
54 endfunc