Mercurial > vim
comparison src/testdir/test_search.vim @ 19370:02111977dd05 v8.2.0243
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Commit: https://github.com/vim/vim/commit/9f6277bdde97b7767ded43a0b5a2023eb601b3b7
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Feb 11 22:04:02 2020 +0100
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Problem: Insufficient code coverage for ex_docmd.c functions.
Solution: Add more tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5618)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 11 Feb 2020 22:15:04 +0100 |
parents | 6fd567c927c0 |
children | 8f8a5a15d00a |
comparison
equal
deleted
inserted
replaced
19369:05c259d4233d | 19370:02111977dd05 |
---|---|
1455 set t_PE= | 1455 set t_PE= |
1456 exe "norm /\x80PS" | 1456 exe "norm /\x80PS" |
1457 endfunc | 1457 endfunc |
1458 | 1458 |
1459 " Test for command failures when the last search pattern is not set. | 1459 " Test for command failures when the last search pattern is not set. |
1460 " Need to run this in a new vim instance where last search pattern is not set. | |
1460 func Test_search_with_no_last_pat() | 1461 func Test_search_with_no_last_pat() |
1461 call test_clear_search_pat() | 1462 let lines =<< trim [SCRIPT] |
1462 call assert_fails("normal i\<C-R>/\e", 'E35:') | 1463 call assert_fails("normal i\<C-R>/\e", 'E35:') |
1463 call assert_fails("exe '/'", 'E35:') | 1464 call assert_fails("exe '/'", 'E35:') |
1464 call assert_fails("exe '?'", 'E35:') | 1465 call assert_fails("exe '?'", 'E35:') |
1465 call assert_fails("/", 'E35:') | 1466 call assert_fails("/", 'E35:') |
1466 call assert_fails("?", 'E35:') | 1467 call assert_fails("?", 'E35:') |
1467 call assert_fails("normal n", 'E35:') | 1468 call assert_fails("normal n", 'E35:') |
1468 call assert_fails("normal N", 'E35:') | 1469 call assert_fails("normal N", 'E35:') |
1469 call assert_fails("normal gn", 'E35:') | 1470 call assert_fails("normal gn", 'E35:') |
1470 call assert_fails("normal gN", 'E35:') | 1471 call assert_fails("normal gN", 'E35:') |
1471 call assert_fails("normal cgn", 'E35:') | 1472 call assert_fails("normal cgn", 'E35:') |
1472 call assert_fails("normal cgN", 'E35:') | 1473 call assert_fails("normal cgN", 'E35:') |
1473 let p = [] | 1474 let p = [] |
1474 let p = @/ | 1475 let p = @/ |
1475 call assert_equal('', p) | 1476 call assert_equal('', p) |
1476 call assert_fails("normal :\<C-R>/", 'E35:') | 1477 call assert_fails("normal :\<C-R>/", 'E35:') |
1477 call assert_fails("//p", 'E35:') | 1478 call assert_fails("//p", 'E35:') |
1478 call assert_fails(";//p", 'E35:') | 1479 call assert_fails(";//p", 'E35:') |
1479 call assert_fails("??p", 'E35:') | 1480 call assert_fails("??p", 'E35:') |
1480 call assert_fails(";??p", 'E35:') | 1481 call assert_fails(";??p", 'E35:') |
1481 call assert_fails('g//p', 'E476:') | 1482 call assert_fails('g//p', 'E476:') |
1482 call assert_fails('v//p', 'E476:') | 1483 call assert_fails('v//p', 'E476:') |
1484 call writefile(v:errors, 'Xresult') | |
1485 qall! | |
1486 [SCRIPT] | |
1487 call writefile(lines, 'Xscript') | |
1488 | |
1489 if RunVim([], [], '--clean -S Xscript') | |
1490 call assert_equal([], readfile('Xresult')) | |
1491 endif | |
1492 call delete('Xscript') | |
1493 call delete('Xresult') | |
1483 endfunc | 1494 endfunc |
1484 | 1495 |
1485 " Test for using tilde (~) atom in search. This should use the last used | 1496 " Test for using tilde (~) atom in search. This should use the last used |
1486 " substitute pattern | 1497 " substitute pattern |
1487 func Test_search_tilde_pat() | 1498 func Test_search_tilde_pat() |
1488 call test_clear_search_pat() | 1499 let lines =<< trim [SCRIPT] |
1489 set regexpengine=1 | 1500 set regexpengine=1 |
1490 call assert_fails('exe "normal /~\<CR>"', 'E33:') | 1501 call assert_fails('exe "normal /~\<CR>"', 'E33:') |
1491 call assert_fails('exe "normal ?~\<CR>"', 'E33:') | 1502 call assert_fails('exe "normal ?~\<CR>"', 'E33:') |
1492 set regexpengine=2 | 1503 set regexpengine=2 |
1493 call assert_fails('exe "normal /~\<CR>"', 'E383:') | 1504 call assert_fails('exe "normal /~\<CR>"', 'E383:') |
1494 call assert_fails('exe "normal ?~\<CR>"', 'E383:') | 1505 call assert_fails('exe "normal ?~\<CR>"', 'E383:') |
1495 set regexpengine& | 1506 set regexpengine& |
1507 call writefile(v:errors, 'Xresult') | |
1508 qall! | |
1509 [SCRIPT] | |
1510 call writefile(lines, 'Xscript') | |
1511 if RunVim([], [], '--clean -S Xscript') | |
1512 call assert_equal([], readfile('Xresult')) | |
1513 endif | |
1514 call delete('Xscript') | |
1515 call delete('Xresult') | |
1496 endfunc | 1516 endfunc |
1497 | 1517 |
1498 " vim: shiftwidth=2 sts=2 expandtab | 1518 " vim: shiftwidth=2 sts=2 expandtab |