comparison src/testdir/test_quickfix.vim @ 8649:ec78ecf15de7 v7.4.1614

commit https://github.com/vim/vim/commit/7eba3d2cbf19e731dc51652bc26099cc253d538a Author: Bram Moolenaar <Bram@vim.org> Date: Sat Mar 19 22:54:09 2016 +0100 patch 7.4.1614 Problem: Still quickfix test in old style. Solution: Turn test 10 into a new style test.
author Christian Brabandt <cb@256bit.org>
date Sat, 19 Mar 2016 23:00:05 +0100
parents 536b9b88d1ca
children 39d6e4f2f748
comparison
equal deleted inserted replaced
8648:680477eae60e 8649:ec78ecf15de7
1 " Test for the quickfix commands. 1 " Test for the quickfix commands.
2 2
3 if !has('quickfix') 3 if !has('quickfix')
4 finish 4 finish
5 endif 5 endif
6
7 set encoding=utf-8
6 8
7 " Tests for the :clist and :llist commands 9 " Tests for the :clist and :llist commands
8 function XlistTests(cchar) 10 function XlistTests(cchar)
9 let Xlist = a:cchar . 'list' 11 let Xlist = a:cchar . 'list'
10 let Xgetexpr = a:cchar . 'getexpr' 12 let Xgetexpr = a:cchar . 'getexpr'
512 call setloclist(0, q) 514 call setloclist(0, q)
513 call assert_fails('lrewind', 'E924:') 515 call assert_fails('lrewind', 'E924:')
514 516
515 augroup! testgroup 517 augroup! testgroup
516 endfunction 518 endfunction
519
520 " More tests for 'errorformat'
521 function! Test_efm1()
522 if !has('unix')
523 " The 'errorformat' setting is different on non-Unix systems.
524 " This test works only on Unix-like systems.
525 return
526 endif
527
528 let l = [
529 \ '"Xtestfile", line 4.12: 1506-045 (S) Undeclared identifier fd_set.',
530 \ '"Xtestfile", line 6 col 19; this is an error',
531 \ 'gcc -c -DHAVE_CONFIsing-prototypes -I/usr/X11R6/include version.c',
532 \ 'Xtestfile:9: parse error before `asd''',
533 \ 'make: *** [vim] Error 1',
534 \ 'in file "Xtestfile" linenr 10: there is an error',
535 \ '',
536 \ '2 returned',
537 \ '"Xtestfile", line 11 col 1; this is an error',
538 \ '"Xtestfile", line 12 col 2; this is another error',
539 \ '"Xtestfile", line 14:10; this is an error in column 10',
540 \ '=Xtestfile=, line 15:10; this is another error, but in vcol 10 this time',
541 \ '"Xtestfile", linenr 16: yet another problem',
542 \ 'Error in "Xtestfile" at line 17:',
543 \ 'x should be a dot',
544 \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 17',
545 \ ' ^',
546 \ 'Error in "Xtestfile" at line 18:',
547 \ 'x should be a dot',
548 \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 18',
549 \ '.............^',
550 \ 'Error in "Xtestfile" at line 19:',
551 \ 'x should be a dot',
552 \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 19',
553 \ '--------------^',
554 \ 'Error in "Xtestfile" at line 20:',
555 \ 'x should be a dot',
556 \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 20',
557 \ ' ^',
558 \ '',
559 \ 'Does anyone know what is the problem and how to correction it?',
560 \ '"Xtestfile", line 21 col 9: What is the title of the quickfix window?',
561 \ '"Xtestfile", line 22 col 9: What is the title of the quickfix window?'
562 \ ]
563
564 call writefile(l, 'Xerrorfile1')
565 call writefile(l[:-2], 'Xerrorfile2')
566
567 let m = [
568 \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 2',
569 \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 3',
570 \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 4',
571 \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 5',
572 \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 6',
573 \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 7',
574 \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 8',
575 \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 9',
576 \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 10',
577 \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 11',
578 \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 12',
579 \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 13',
580 \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 14',
581 \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 15',
582 \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 16',
583 \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 17',
584 \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 18',
585 \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 19',
586 \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 20',
587 \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 21',
588 \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 22'
589 \ ]
590 call writefile(m, 'Xtestfile')
591
592 let save_efm = &efm
593 set efm+==%f=\\,\ line\ %l%*\\D%v%*[^\ ]\ %m
594 set efm^=%AError\ in\ \"%f\"\ at\ line\ %l:,%Z%p^,%C%m
595
596 exe 'cf Xerrorfile2'
597 clast
598 copen
599 call assert_equal(':cf Xerrorfile2', w:quickfix_title)
600 wincmd p
601
602 exe 'cf Xerrorfile1'
603 call assert_equal([4, 12], [line('.'), col('.')])
604 cn
605 call assert_equal([6, 19], [line('.'), col('.')])
606 cn
607 call assert_equal([9, 2], [line('.'), col('.')])
608 cn
609 call assert_equal([10, 2], [line('.'), col('.')])
610 cn
611 call assert_equal([11, 1], [line('.'), col('.')])
612 cn
613 call assert_equal([12, 2], [line('.'), col('.')])
614 cn
615 call assert_equal([14, 10], [line('.'), col('.')])
616 cn
617 call assert_equal([15, 3, 10], [line('.'), col('.'), virtcol('.')])
618 cn
619 call assert_equal([16, 2], [line('.'), col('.')])
620 cn
621 call assert_equal([17, 6], [line('.'), col('.')])
622 cn
623 call assert_equal([18, 7], [line('.'), col('.')])
624 cn
625 call assert_equal([19, 8], [line('.'), col('.')])
626 cn
627 call assert_equal([20, 9], [line('.'), col('.')])
628 clast
629 cprev
630 cprev
631 wincmd w
632 call assert_equal(':cf Xerrorfile1', w:quickfix_title)
633 wincmd p
634
635 let &efm = save_efm
636 call delete('Xerrorfile1')
637 call delete('Xerrorfile2')
638 call delete('Xtestfile')
639 endfunction