annotate src/testdir/test_search.vim @ 32764:d35204b890af v9.0.1701

patch 9.0.1701: vim9 crash when class member overridden Commit: https://github.com/vim/vim/commit/57a02ccf4c75a6abb270194c90be926d5221b3ce Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Sun Aug 13 10:19:38 2023 +0200 patch 9.0.1701: vim9 crash when class member overridden Problem: vim9 crash when class member overridden Solution: Use method_count field instead closes: #12676 closes: #12677 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
author Christian Brabandt <cb@256bit.org>
date Sun, 13 Aug 2023 10:30:07 +0200
parents ce3269eea32c
children bd61ec7b743f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Test for the search command
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
12720
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
3 source shared.vim
13790
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
4 source screendump.vim
17657
0da9bc55c31a patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents: 17411
diff changeset
5 source check.vim
12720
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
6
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 func Test_search_cmdline()
19705
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
8 CheckOption incsearch
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
9
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 " need to disable char_avail,
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 " so that expansion of commandline works
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
12 call test_override("char_avail", 1)
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 new
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 call setline(1, [' 1', ' 2 these', ' 3 the', ' 4 their', ' 5 there', ' 6 their', ' 7 the', ' 8 them', ' 9 these', ' 10 foobar'])
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 " Test 1
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 " CTRL-N / CTRL-P skips through the previous search history
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 set noincsearch
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 :1
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 call feedkeys("/foobar\<cr>", 'tx')
19973
9f5758ee0b10 patch 8.2.0542: no test for E386
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
20 call feedkeys("/the\<cr>", 'tx')
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 call assert_equal('the', @/)
19973
9f5758ee0b10 patch 8.2.0542: no test for E386
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
22 call feedkeys("/thes\<C-P>\<C-P>\<cr>", 'tx')
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 call assert_equal('foobar', @/)
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 " Test 2
9990
6a1793d9c895 commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents: 9971
diff changeset
26 " Ctrl-G goes from one match to the next
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 " until the end of the buffer
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 set incsearch nowrapscan
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 :1
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 " first match
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 call feedkeys("/the\<cr>", 'tx')
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 call assert_equal(' 2 these', getline('.'))
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 :1
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 " second match
9990
6a1793d9c895 commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents: 9971
diff changeset
35 call feedkeys("/the\<C-G>\<cr>", 'tx')
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 call assert_equal(' 3 the', getline('.'))
10098
72e4b7f90465 commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents: 9990
diff changeset
37 call assert_equal([0, 0, 0, 0], getpos('"'))
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 :1
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 " third match
9990
6a1793d9c895 commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents: 9971
diff changeset
40 call feedkeys("/the".repeat("\<C-G>", 2)."\<cr>", 'tx')
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 call assert_equal(' 4 their', getline('.'))
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 :1
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 " fourth match
9990
6a1793d9c895 commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents: 9971
diff changeset
44 call feedkeys("/the".repeat("\<C-G>", 3)."\<cr>", 'tx')
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 call assert_equal(' 5 there', getline('.'))
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 :1
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 " fifth match
9990
6a1793d9c895 commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents: 9971
diff changeset
48 call feedkeys("/the".repeat("\<C-G>", 4)."\<cr>", 'tx')
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
49 call assert_equal(' 6 their', getline('.'))
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50 :1
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51 " sixth match
9990
6a1793d9c895 commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents: 9971
diff changeset
52 call feedkeys("/the".repeat("\<C-G>", 5)."\<cr>", 'tx')
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 call assert_equal(' 7 the', getline('.'))
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
54 :1
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
55 " seventh match
9990
6a1793d9c895 commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents: 9971
diff changeset
56 call feedkeys("/the".repeat("\<C-G>", 6)."\<cr>", 'tx')
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57 call assert_equal(' 8 them', getline('.'))
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
58 :1
18935
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
59 " eighth match
9990
6a1793d9c895 commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents: 9971
diff changeset
60 call feedkeys("/the".repeat("\<C-G>", 7)."\<cr>", 'tx')
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61 call assert_equal(' 9 these', getline('.'))
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
62 :1
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
63 " no further match
9990
6a1793d9c895 commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents: 9971
diff changeset
64 call feedkeys("/the".repeat("\<C-G>", 8)."\<cr>", 'tx')
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
65 call assert_equal(' 9 these', getline('.'))
10098
72e4b7f90465 commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents: 9990
diff changeset
66 call assert_equal([0, 0, 0, 0], getpos('"'))
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
67
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
68 " Test 3
9990
6a1793d9c895 commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents: 9971
diff changeset
69 " Ctrl-G goes from one match to the next
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
70 " and continues back at the top
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
71 set incsearch wrapscan
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
72 :1
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
73 " first match
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
74 call feedkeys("/the\<cr>", 'tx')
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
75 call assert_equal(' 2 these', getline('.'))
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
76 :1
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
77 " second match
9990
6a1793d9c895 commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents: 9971
diff changeset
78 call feedkeys("/the\<C-G>\<cr>", 'tx')
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
79 call assert_equal(' 3 the', getline('.'))
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
80 :1
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
81 " third match
9990
6a1793d9c895 commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents: 9971
diff changeset
82 call feedkeys("/the".repeat("\<C-G>", 2)."\<cr>", 'tx')
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
83 call assert_equal(' 4 their', getline('.'))
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
84 :1
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
85 " fourth match
9990
6a1793d9c895 commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents: 9971
diff changeset
86 call feedkeys("/the".repeat("\<C-G>", 3)."\<cr>", 'tx')
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
87 call assert_equal(' 5 there', getline('.'))
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
88 :1
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
89 " fifth match
9990
6a1793d9c895 commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents: 9971
diff changeset
90 call feedkeys("/the".repeat("\<C-G>", 4)."\<cr>", 'tx')
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
91 call assert_equal(' 6 their', getline('.'))
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
92 :1
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
93 " sixth match
9990
6a1793d9c895 commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents: 9971
diff changeset
94 call feedkeys("/the".repeat("\<C-G>", 5)."\<cr>", 'tx')
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
95 call assert_equal(' 7 the', getline('.'))
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
96 :1
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
97 " seventh match
9990
6a1793d9c895 commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents: 9971
diff changeset
98 call feedkeys("/the".repeat("\<C-G>", 6)."\<cr>", 'tx')
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
99 call assert_equal(' 8 them', getline('.'))
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
100 :1
18935
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
101 " eighth match
9990
6a1793d9c895 commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents: 9971
diff changeset
102 call feedkeys("/the".repeat("\<C-G>", 7)."\<cr>", 'tx')
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
103 call assert_equal(' 9 these', getline('.'))
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
104 :1
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
105 " back at first match
9990
6a1793d9c895 commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents: 9971
diff changeset
106 call feedkeys("/the".repeat("\<C-G>", 8)."\<cr>", 'tx')
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
107 call assert_equal(' 2 these', getline('.'))
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
108
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
109 " Test 4
9990
6a1793d9c895 commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents: 9971
diff changeset
110 " CTRL-T goes to the previous match
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
111 set incsearch nowrapscan
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
112 $
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
113 " first match
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
114 call feedkeys("?the\<cr>", 'tx')
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
115 call assert_equal(' 9 these', getline('.'))
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
116 $
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
117 " first match
9990
6a1793d9c895 commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents: 9971
diff changeset
118 call feedkeys("?the\<C-G>\<cr>", 'tx')
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
119 call assert_equal(' 9 these', getline('.'))
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
120 $
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
121 " second match
9990
6a1793d9c895 commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents: 9971
diff changeset
122 call feedkeys("?the".repeat("\<C-T>", 1)."\<cr>", 'tx')
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
123 call assert_equal(' 8 them', getline('.'))
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
124 $
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
125 " last match
9990
6a1793d9c895 commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents: 9971
diff changeset
126 call feedkeys("?the".repeat("\<C-T>", 7)."\<cr>", 'tx')
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
127 call assert_equal(' 2 these', getline('.'))
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
128 $
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
129 " last match
9990
6a1793d9c895 commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents: 9971
diff changeset
130 call feedkeys("?the".repeat("\<C-T>", 8)."\<cr>", 'tx')
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
131 call assert_equal(' 2 these', getline('.'))
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
132
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
133 " Test 5
9990
6a1793d9c895 commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents: 9971
diff changeset
134 " CTRL-T goes to the previous match
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
135 set incsearch wrapscan
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
136 $
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
137 " first match
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
138 call feedkeys("?the\<cr>", 'tx')
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
139 call assert_equal(' 9 these', getline('.'))
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
140 $
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
141 " first match at the top
9990
6a1793d9c895 commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents: 9971
diff changeset
142 call feedkeys("?the\<C-G>\<cr>", 'tx')
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
143 call assert_equal(' 2 these', getline('.'))
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
144 $
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
145 " second match
9990
6a1793d9c895 commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents: 9971
diff changeset
146 call feedkeys("?the".repeat("\<C-T>", 1)."\<cr>", 'tx')
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
147 call assert_equal(' 8 them', getline('.'))
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
148 $
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
149 " last match
9990
6a1793d9c895 commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents: 9971
diff changeset
150 call feedkeys("?the".repeat("\<C-T>", 7)."\<cr>", 'tx')
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
151 call assert_equal(' 2 these', getline('.'))
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
152 $
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
153 " back at the bottom of the buffer
9990
6a1793d9c895 commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents: 9971
diff changeset
154 call feedkeys("?the".repeat("\<C-T>", 8)."\<cr>", 'tx')
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
155 call assert_equal(' 9 these', getline('.'))
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
156
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
157 " Test 6
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
158 " CTRL-L adds to the search pattern
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
159 set incsearch wrapscan
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
160 1
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
161 " first match
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
162 call feedkeys("/the\<c-l>\<cr>", 'tx')
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
163 call assert_equal(' 2 these', getline('.'))
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
164 1
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
165 " go to next match of 'thes'
9990
6a1793d9c895 commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents: 9971
diff changeset
166 call feedkeys("/the\<c-l>\<C-G>\<cr>", 'tx')
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
167 call assert_equal(' 9 these', getline('.'))
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
168 1
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
169 " wrap around
9990
6a1793d9c895 commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents: 9971
diff changeset
170 call feedkeys("/the\<c-l>\<C-G>\<C-G>\<cr>", 'tx')
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
171 call assert_equal(' 2 these', getline('.'))
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
172 1
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
173 " wrap around
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
174 set nowrapscan
9990
6a1793d9c895 commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents: 9971
diff changeset
175 call feedkeys("/the\<c-l>\<C-G>\<C-G>\<cr>", 'tx')
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
176 call assert_equal(' 9 these', getline('.'))
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
177
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
178 " Test 7
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
179 " <bs> remove from match, but stay at current match
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
180 set incsearch wrapscan
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
181 1
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
182 " first match
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
183 call feedkeys("/thei\<cr>", 'tx')
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
184 call assert_equal(' 4 their', getline('.'))
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
185 1
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
186 " delete one char, add another
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
187 call feedkeys("/thei\<bs>s\<cr>", 'tx')
10098
72e4b7f90465 commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents: 9990
diff changeset
188 call assert_equal(' 2 these', getline('.'))
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
189 1
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
190 " delete one char, add another, go to previous match, add one char
9990
6a1793d9c895 commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents: 9971
diff changeset
191 call feedkeys("/thei\<bs>s\<bs>\<C-T>\<c-l>\<cr>", 'tx')
10098
72e4b7f90465 commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents: 9990
diff changeset
192 call assert_equal(' 9 these', getline('.'))
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
193 1
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
194 " delete all chars, start from the beginning again
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
195 call feedkeys("/them". repeat("\<bs>",4).'the\>'."\<cr>", 'tx')
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
196 call assert_equal(' 3 the', getline('.'))
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
197
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
198 " clean up
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
199 call test_override("char_avail", 0)
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
200 bw!
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
201 endfunc
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
202
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
203 func Test_search_cmdline2()
19705
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
204 CheckOption incsearch
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
205
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
206 " need to disable char_avail,
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
207 " so that expansion of commandline works
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
208 call test_override("char_avail", 1)
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
209 new
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
210 call setline(1, [' 1', ' 2 these', ' 3 the theother'])
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
211 " Test 1
9990
6a1793d9c895 commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents: 9971
diff changeset
212 " Ctrl-T goes correctly back and forth
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
213 set incsearch
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
214 1
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
215 " first match
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
216 call feedkeys("/the\<cr>", 'tx')
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
217 call assert_equal(' 2 these', getline('.'))
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
218 1
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
219 " go to next match (on next line)
9990
6a1793d9c895 commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents: 9971
diff changeset
220 call feedkeys("/the\<C-G>\<cr>", 'tx')
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
221 call assert_equal(' 3 the theother', getline('.'))
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
222 1
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
223 " go to next match (still on line 3)
9990
6a1793d9c895 commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents: 9971
diff changeset
224 call feedkeys("/the\<C-G>\<C-G>\<cr>", 'tx')
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
225 call assert_equal(' 3 the theother', getline('.'))
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
226 1
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
227 " go to next match (still on line 3)
9990
6a1793d9c895 commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents: 9971
diff changeset
228 call feedkeys("/the\<C-G>\<C-G>\<C-G>\<cr>", 'tx')
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
229 call assert_equal(' 3 the theother', getline('.'))
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
230 1
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
231 " go to previous match (on line 3)
9990
6a1793d9c895 commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents: 9971
diff changeset
232 call feedkeys("/the\<C-G>\<C-G>\<C-G>\<C-T>\<cr>", 'tx')
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
233 call assert_equal(' 3 the theother', getline('.'))
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
234 1
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
235 " go to previous match (on line 3)
9990
6a1793d9c895 commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents: 9971
diff changeset
236 call feedkeys("/the\<C-G>\<C-G>\<C-G>\<C-T>\<C-T>\<cr>", 'tx')
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
237 call assert_equal(' 3 the theother', getline('.'))
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
238 1
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
239 " go to previous match (on line 2)
9990
6a1793d9c895 commit https://github.com/vim/vim/commit/1195669f9e434fa9ab8b57ee9470bf951e4990b8
Christian Brabandt <cb@256bit.org>
parents: 9971
diff changeset
240 call feedkeys("/the\<C-G>\<C-G>\<C-G>\<C-T>\<C-T>\<C-T>\<cr>", 'tx')
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
241 call assert_equal(' 2 these', getline('.'))
17411
9c4ddc78df74 patch 8.1.1704: C-R C-W does not work after C-G when using 'incsearch'
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
242 1
9c4ddc78df74 patch 8.1.1704: C-R C-W does not work after C-G when using 'incsearch'
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
243 " go to previous match (on line 2)
9c4ddc78df74 patch 8.1.1704: C-R C-W does not work after C-G when using 'incsearch'
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
244 call feedkeys("/the\<C-G>\<C-R>\<C-W>\<cr>", 'tx')
9c4ddc78df74 patch 8.1.1704: C-R C-W does not work after C-G when using 'incsearch'
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
245 call assert_equal('theother', @/)
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
246
10098
72e4b7f90465 commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents: 9990
diff changeset
247 " Test 2: keep the view,
72e4b7f90465 commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents: 9990
diff changeset
248 " after deleting a character from the search cmd
72e4b7f90465 commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents: 9990
diff changeset
249 call setline(1, [' 1', ' 2 these', ' 3 the', ' 4 their', ' 5 there', ' 6 their', ' 7 the', ' 8 them', ' 9 these', ' 10 foobar'])
72e4b7f90465 commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents: 9990
diff changeset
250 resize 5
72e4b7f90465 commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents: 9990
diff changeset
251 1
72e4b7f90465 commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents: 9990
diff changeset
252 call feedkeys("/foo\<bs>\<cr>", 'tx')
72e4b7f90465 commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents: 9990
diff changeset
253 redraw
72e4b7f90465 commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents: 9990
diff changeset
254 call assert_equal({'lnum': 10, 'leftcol': 0, 'col': 4, 'topfill': 0, 'topline': 6, 'coladd': 0, 'skipcol': 0, 'curswant': 4}, winsaveview())
72e4b7f90465 commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents: 9990
diff changeset
255
72e4b7f90465 commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents: 9990
diff changeset
256 " remove all history entries
17411
9c4ddc78df74 patch 8.1.1704: C-R C-W does not work after C-G when using 'incsearch'
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
257 for i in range(11)
10098
72e4b7f90465 commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents: 9990
diff changeset
258 call histdel('/')
72e4b7f90465 commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents: 9990
diff changeset
259 endfor
72e4b7f90465 commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents: 9990
diff changeset
260
72e4b7f90465 commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents: 9990
diff changeset
261 " Test 3: reset the view,
72e4b7f90465 commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents: 9990
diff changeset
262 " after deleting all characters from the search cmd
72e4b7f90465 commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents: 9990
diff changeset
263 norm! 1gg0
72e4b7f90465 commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents: 9990
diff changeset
264 " unfortunately, neither "/foo\<c-w>\<cr>", nor "/foo\<bs>\<bs>\<bs>\<cr>",
72e4b7f90465 commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents: 9990
diff changeset
265 " nor "/foo\<c-u>\<cr>" works to delete the commandline.
72e4b7f90465 commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents: 9990
diff changeset
266 " In that case Vim should return "E35 no previous regular expression",
72e4b7f90465 commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents: 9990
diff changeset
267 " but it looks like Vim still sees /foo and therefore the test fails.
17918
9606c0adc148 patch 8.1.1955: tests contain typos
Bram Moolenaar <Bram@vim.org>
parents: 17849
diff changeset
268 " Therefore, disabling this test
22087
ff21e2962490 patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents: 21491
diff changeset
269 "call assert_fails(feedkeys("/foo\<c-w>\<cr>", 'tx'), 'E35:')
10098
72e4b7f90465 commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents: 9990
diff changeset
270 "call assert_equal({'lnum': 1, 'leftcol': 0, 'col': 0, 'topfill': 0, 'topline': 1, 'coladd': 0, 'skipcol': 0, 'curswant': 0}, winsaveview())
72e4b7f90465 commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents: 9990
diff changeset
271
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
272 " clean up
10098
72e4b7f90465 commit https://github.com/vim/vim/commit/dda933d06c06c2792bd686d059f6ad19191ad30b
Christian Brabandt <cb@256bit.org>
parents: 9990
diff changeset
273 set noincsearch
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
274 call test_override("char_avail", 0)
9971
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
275 bw!
98b39d2eb895 commit https://github.com/vim/vim/commit/4d6f32cbfbaf324ac4a25c0206a5db0e9f7a48f7
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
276 endfunc
10172
ab45de65977b commit https://github.com/vim/vim/commit/ea683da58cf9ecf3afab9d650d3d2da76e5298d3
Christian Brabandt <cb@256bit.org>
parents: 10098
diff changeset
277
ab45de65977b commit https://github.com/vim/vim/commit/ea683da58cf9ecf3afab9d650d3d2da76e5298d3
Christian Brabandt <cb@256bit.org>
parents: 10098
diff changeset
278 func Test_use_sub_pat()
ab45de65977b commit https://github.com/vim/vim/commit/ea683da58cf9ecf3afab9d650d3d2da76e5298d3
Christian Brabandt <cb@256bit.org>
parents: 10098
diff changeset
279 split
ab45de65977b commit https://github.com/vim/vim/commit/ea683da58cf9ecf3afab9d650d3d2da76e5298d3
Christian Brabandt <cb@256bit.org>
parents: 10098
diff changeset
280 let @/ = ''
ab45de65977b commit https://github.com/vim/vim/commit/ea683da58cf9ecf3afab9d650d3d2da76e5298d3
Christian Brabandt <cb@256bit.org>
parents: 10098
diff changeset
281 func X()
ab45de65977b commit https://github.com/vim/vim/commit/ea683da58cf9ecf3afab9d650d3d2da76e5298d3
Christian Brabandt <cb@256bit.org>
parents: 10098
diff changeset
282 s/^/a/
ab45de65977b commit https://github.com/vim/vim/commit/ea683da58cf9ecf3afab9d650d3d2da76e5298d3
Christian Brabandt <cb@256bit.org>
parents: 10098
diff changeset
283 /
ab45de65977b commit https://github.com/vim/vim/commit/ea683da58cf9ecf3afab9d650d3d2da76e5298d3
Christian Brabandt <cb@256bit.org>
parents: 10098
diff changeset
284 endfunc
ab45de65977b commit https://github.com/vim/vim/commit/ea683da58cf9ecf3afab9d650d3d2da76e5298d3
Christian Brabandt <cb@256bit.org>
parents: 10098
diff changeset
285 call X()
ab45de65977b commit https://github.com/vim/vim/commit/ea683da58cf9ecf3afab9d650d3d2da76e5298d3
Christian Brabandt <cb@256bit.org>
parents: 10098
diff changeset
286 bwipe!
ab45de65977b commit https://github.com/vim/vim/commit/ea683da58cf9ecf3afab9d650d3d2da76e5298d3
Christian Brabandt <cb@256bit.org>
parents: 10098
diff changeset
287 endfunc
10514
1435e45ee6fa commit https://github.com/vim/vim/commit/6e450a57541676036203a72d40b2e604e938371e
Christian Brabandt <cb@256bit.org>
parents: 10172
diff changeset
288
1435e45ee6fa commit https://github.com/vim/vim/commit/6e450a57541676036203a72d40b2e604e938371e
Christian Brabandt <cb@256bit.org>
parents: 10172
diff changeset
289 func Test_searchpair()
1435e45ee6fa commit https://github.com/vim/vim/commit/6e450a57541676036203a72d40b2e604e938371e
Christian Brabandt <cb@256bit.org>
parents: 10172
diff changeset
290 new
18935
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
291 call setline(1, ['other code', 'here [', ' [', ' " cursor here', ' ]]'])
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
292
22405
0ef3ae4ec70e patch 8.2.1751: using 2 where bool is expected may throw an error
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
293 " should not give an error for using "42"
0ef3ae4ec70e patch 8.2.1751: using 2 where bool is expected may throw an error
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
294 call assert_equal(0, searchpair('a', 'b', 'c', '', 42))
0ef3ae4ec70e patch 8.2.1751: using 2 where bool is expected may throw an error
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
295
18935
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
296 4
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
297 call assert_equal(3, searchpair('\[', '', ']', 'bW'))
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
298 call assert_equal([0, 3, 2, 0], getpos('.'))
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
299 4
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
300 call assert_equal(2, searchpair('\[', '', ']', 'bWr'))
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
301 call assert_equal([0, 2, 6, 0], getpos('.'))
10514
1435e45ee6fa commit https://github.com/vim/vim/commit/6e450a57541676036203a72d40b2e604e938371e
Christian Brabandt <cb@256bit.org>
parents: 10172
diff changeset
302 4
18935
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
303 call assert_equal(1, searchpair('\[', '', ']', 'bWm'))
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
304 call assert_equal([0, 3, 2, 0], getpos('.'))
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
305 4|norm ^
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
306 call assert_equal(5, searchpair('\[', '', ']', 'Wn'))
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
307 call assert_equal([0, 4, 2, 0], getpos('.'))
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
308 4
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
309 call assert_equal(2, searchpair('\[', '', ']', 'bW',
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
310 \ 'getline(".") =~ "^\\s*\["'))
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
311 call assert_equal([0, 2, 6, 0], getpos('.'))
10514
1435e45ee6fa commit https://github.com/vim/vim/commit/6e450a57541676036203a72d40b2e604e938371e
Christian Brabandt <cb@256bit.org>
parents: 10172
diff changeset
312 set nomagic
1435e45ee6fa commit https://github.com/vim/vim/commit/6e450a57541676036203a72d40b2e604e938371e
Christian Brabandt <cb@256bit.org>
parents: 10172
diff changeset
313 4
18935
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
314 call assert_equal(3, searchpair('\[', '', ']', 'bW'))
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
315 call assert_equal([0, 3, 2, 0], getpos('.'))
10514
1435e45ee6fa commit https://github.com/vim/vim/commit/6e450a57541676036203a72d40b2e604e938371e
Christian Brabandt <cb@256bit.org>
parents: 10172
diff changeset
316 set magic
18935
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
317 4|norm ^
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
318 call assert_equal(0, searchpair('{', '', '}', 'bW'))
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
319 call assert_equal([0, 4, 2, 0], getpos('.'))
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
320
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
321 %d
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
322 call setline(1, ['if 1', ' if 2', ' else', ' endif 2', 'endif 1'])
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
323
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
324 /\<if 1
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
325 call assert_equal(5, searchpair('\<if\>', '\<else\>', '\<endif\>', 'W'))
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
326 call assert_equal([0, 5, 1, 0], getpos('.'))
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
327 /\<if 2
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
328 call assert_equal(3, searchpair('\<if\>', '\<else\>', '\<endif\>', 'W'))
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
329 call assert_equal([0, 3, 3, 0], getpos('.'))
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
330
29189
d1e263ecf634 patch 8.2.5114: time limit on searchpair() does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 29071
diff changeset
331 bwipe!
d1e263ecf634 patch 8.2.5114: time limit on searchpair() does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 29071
diff changeset
332 endfunc
d1e263ecf634 patch 8.2.5114: time limit on searchpair() does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 29071
diff changeset
333
d1e263ecf634 patch 8.2.5114: time limit on searchpair() does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 29071
diff changeset
334 func Test_searchpair_timeout()
d1e263ecf634 patch 8.2.5114: time limit on searchpair() does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 29071
diff changeset
335 CheckFeature reltime
29243
cdb22dde06b9 patch 8.2.5140: seachpair timeout test is flaky
Bram Moolenaar <Bram@vim.org>
parents: 29234
diff changeset
336 let g:test_is_flaky = 1
29189
d1e263ecf634 patch 8.2.5114: time limit on searchpair() does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 29071
diff changeset
337
d1e263ecf634 patch 8.2.5114: time limit on searchpair() does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 29071
diff changeset
338 func Waitabit()
d1e263ecf634 patch 8.2.5114: time limit on searchpair() does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 29071
diff changeset
339 sleep 20m
d1e263ecf634 patch 8.2.5114: time limit on searchpair() does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 29071
diff changeset
340 return 1 " skip match
d1e263ecf634 patch 8.2.5114: time limit on searchpair() does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 29071
diff changeset
341 endfunc
d1e263ecf634 patch 8.2.5114: time limit on searchpair() does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 29071
diff changeset
342
d1e263ecf634 patch 8.2.5114: time limit on searchpair() does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 29071
diff changeset
343 new
d1e263ecf634 patch 8.2.5114: time limit on searchpair() does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 29071
diff changeset
344 call setline(1, range(100))
d1e263ecf634 patch 8.2.5114: time limit on searchpair() does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 29071
diff changeset
345 call setline(1, "(start here")
d1e263ecf634 patch 8.2.5114: time limit on searchpair() does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 29071
diff changeset
346 call setline(100, "end here)")
d1e263ecf634 patch 8.2.5114: time limit on searchpair() does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 29071
diff changeset
347 let starttime = reltime()
d1e263ecf634 patch 8.2.5114: time limit on searchpair() does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 29071
diff changeset
348
d1e263ecf634 patch 8.2.5114: time limit on searchpair() does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 29071
diff changeset
349 " A timeout of 100 msec should happen after about five times of 20 msec wait
d1e263ecf634 patch 8.2.5114: time limit on searchpair() does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 29071
diff changeset
350 " in Waitabit(). When the timeout applies to each search the elapsed time
d1e263ecf634 patch 8.2.5114: time limit on searchpair() does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 29071
diff changeset
351 " will be much longer.
d1e263ecf634 patch 8.2.5114: time limit on searchpair() does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 29071
diff changeset
352 call assert_equal(0, searchpair('(', '\d', ')', '', "Waitabit()", 0, 100))
d1e263ecf634 patch 8.2.5114: time limit on searchpair() does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 29071
diff changeset
353 let elapsed = reltime(starttime)->reltimefloat()
d1e263ecf634 patch 8.2.5114: time limit on searchpair() does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 29071
diff changeset
354 call assert_inrange(0.09, 0.300, elapsed)
d1e263ecf634 patch 8.2.5114: time limit on searchpair() does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 29071
diff changeset
355
29257
4795d56a245b patch 8.2.5147: flaky test always fails on retry
Bram Moolenaar <Bram@vim.org>
parents: 29243
diff changeset
356 delfunc Waitabit
29189
d1e263ecf634 patch 8.2.5114: time limit on searchpair() does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 29071
diff changeset
357 bwipe!
18935
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
358 endfunc
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
359
29224
ca46658481cf patch 8.2.5131: timeout implementation is not optimal
Bram Moolenaar <Bram@vim.org>
parents: 29191
diff changeset
360 func SearchpairSkip()
ca46658481cf patch 8.2.5131: timeout implementation is not optimal
Bram Moolenaar <Bram@vim.org>
parents: 29191
diff changeset
361 let id = synID(line('.'), col('.'), 0)
ca46658481cf patch 8.2.5131: timeout implementation is not optimal
Bram Moolenaar <Bram@vim.org>
parents: 29191
diff changeset
362 let attr = synIDattr(id, 'name')
ca46658481cf patch 8.2.5131: timeout implementation is not optimal
Bram Moolenaar <Bram@vim.org>
parents: 29191
diff changeset
363 return attr !~ 'comment'
ca46658481cf patch 8.2.5131: timeout implementation is not optimal
Bram Moolenaar <Bram@vim.org>
parents: 29191
diff changeset
364 endfunc
ca46658481cf patch 8.2.5131: timeout implementation is not optimal
Bram Moolenaar <Bram@vim.org>
parents: 29191
diff changeset
365
ca46658481cf patch 8.2.5131: timeout implementation is not optimal
Bram Moolenaar <Bram@vim.org>
parents: 29191
diff changeset
366 func Test_searchpair_timeout_with_skip()
ca46658481cf patch 8.2.5131: timeout implementation is not optimal
Bram Moolenaar <Bram@vim.org>
parents: 29191
diff changeset
367 let g:test_is_flaky = 1
ca46658481cf patch 8.2.5131: timeout implementation is not optimal
Bram Moolenaar <Bram@vim.org>
parents: 29191
diff changeset
368
ca46658481cf patch 8.2.5131: timeout implementation is not optimal
Bram Moolenaar <Bram@vim.org>
parents: 29191
diff changeset
369 edit ../evalfunc.c
ca46658481cf patch 8.2.5131: timeout implementation is not optimal
Bram Moolenaar <Bram@vim.org>
parents: 29191
diff changeset
370 if has('win32')
ca46658481cf patch 8.2.5131: timeout implementation is not optimal
Bram Moolenaar <Bram@vim.org>
parents: 29191
diff changeset
371 " Windows timeouts are rather coarse grained, about 16ms.
ca46658481cf patch 8.2.5131: timeout implementation is not optimal
Bram Moolenaar <Bram@vim.org>
parents: 29191
diff changeset
372 let ms = 20
ca46658481cf patch 8.2.5131: timeout implementation is not optimal
Bram Moolenaar <Bram@vim.org>
parents: 29191
diff changeset
373 let min_time = 0.016
ca46658481cf patch 8.2.5131: timeout implementation is not optimal
Bram Moolenaar <Bram@vim.org>
parents: 29191
diff changeset
374 let max_time = min_time * 10.0
ca46658481cf patch 8.2.5131: timeout implementation is not optimal
Bram Moolenaar <Bram@vim.org>
parents: 29191
diff changeset
375 else
ca46658481cf patch 8.2.5131: timeout implementation is not optimal
Bram Moolenaar <Bram@vim.org>
parents: 29191
diff changeset
376 let ms = 1
ca46658481cf patch 8.2.5131: timeout implementation is not optimal
Bram Moolenaar <Bram@vim.org>
parents: 29191
diff changeset
377 let min_time = 0.001
31571
c51111774ea8 patch 9.0.1118: sporadic test failures when using a terminal window
Bram Moolenaar <Bram@vim.org>
parents: 31233
diff changeset
378 let max_time = min_time * 15.0
29234
96ff6c230a66 patch 8.2.5136: debugger test fails when run with valgrind
Bram Moolenaar <Bram@vim.org>
parents: 29224
diff changeset
379 if RunningWithValgrind()
29224
ca46658481cf patch 8.2.5131: timeout implementation is not optimal
Bram Moolenaar <Bram@vim.org>
parents: 29191
diff changeset
380 let max_time += 0.04 " this can be slow with valgrind
ca46658481cf patch 8.2.5131: timeout implementation is not optimal
Bram Moolenaar <Bram@vim.org>
parents: 29191
diff changeset
381 endif
29277
6e7b9156b08f patch 8.2.5156: search timeout test often fails with FreeBSD
Bram Moolenaar <Bram@vim.org>
parents: 29257
diff changeset
382 if has('bsd')
6e7b9156b08f patch 8.2.5156: search timeout test often fails with FreeBSD
Bram Moolenaar <Bram@vim.org>
parents: 29257
diff changeset
383 " test often fails with FreeBSD
6e7b9156b08f patch 8.2.5156: search timeout test often fails with FreeBSD
Bram Moolenaar <Bram@vim.org>
parents: 29257
diff changeset
384 let max_time = max_time * 2.0
6e7b9156b08f patch 8.2.5156: search timeout test often fails with FreeBSD
Bram Moolenaar <Bram@vim.org>
parents: 29257
diff changeset
385 endif
29224
ca46658481cf patch 8.2.5131: timeout implementation is not optimal
Bram Moolenaar <Bram@vim.org>
parents: 29191
diff changeset
386 endif
ca46658481cf patch 8.2.5131: timeout implementation is not optimal
Bram Moolenaar <Bram@vim.org>
parents: 29191
diff changeset
387 let start = reltime()
ca46658481cf patch 8.2.5131: timeout implementation is not optimal
Bram Moolenaar <Bram@vim.org>
parents: 29191
diff changeset
388 let found = searchpair('(', '', ')', 'crnm', 'SearchpairSkip()', 0, ms)
ca46658481cf patch 8.2.5131: timeout implementation is not optimal
Bram Moolenaar <Bram@vim.org>
parents: 29191
diff changeset
389 let elapsed = reltimefloat(reltime(start))
ca46658481cf patch 8.2.5131: timeout implementation is not optimal
Bram Moolenaar <Bram@vim.org>
parents: 29191
diff changeset
390 call assert_inrange(min_time, max_time, elapsed)
ca46658481cf patch 8.2.5131: timeout implementation is not optimal
Bram Moolenaar <Bram@vim.org>
parents: 29191
diff changeset
391
ca46658481cf patch 8.2.5131: timeout implementation is not optimal
Bram Moolenaar <Bram@vim.org>
parents: 29191
diff changeset
392 bwipe!
ca46658481cf patch 8.2.5131: timeout implementation is not optimal
Bram Moolenaar <Bram@vim.org>
parents: 29191
diff changeset
393 endfunc
ca46658481cf patch 8.2.5131: timeout implementation is not optimal
Bram Moolenaar <Bram@vim.org>
parents: 29191
diff changeset
394
18935
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
395 func Test_searchpairpos()
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
396 new
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
397 call setline(1, ['other code', 'here [', ' [', ' " cursor here', ' ]]'])
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
398
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
399 4
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
400 call assert_equal([3, 2], searchpairpos('\[', '', ']', 'bW'))
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
401 call assert_equal([0, 3, 2, 0], getpos('.'))
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
402 4
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
403 call assert_equal([2, 6], searchpairpos('\[', '', ']', 'bWr'))
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
404 call assert_equal([0, 2, 6, 0], getpos('.'))
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
405 4|norm ^
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
406 call assert_equal([5, 2], searchpairpos('\[', '', ']', 'Wn'))
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
407 call assert_equal([0, 4, 2, 0], getpos('.'))
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
408 4
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
409 call assert_equal([2, 6], searchpairpos('\[', '', ']', 'bW',
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
410 \ 'getline(".") =~ "^\\s*\["'))
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
411 call assert_equal([0, 2, 6, 0], getpos('.'))
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
412 4
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
413 call assert_equal([2, 6], searchpairpos('\[', '', ']', 'bWr'))
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
414 call assert_equal([0, 2, 6, 0], getpos('.'))
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
415 set nomagic
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
416 4
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
417 call assert_equal([3, 2], searchpairpos('\[', '', ']', 'bW'))
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
418 call assert_equal([0, 3, 2, 0], getpos('.'))
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
419 set magic
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
420 4|norm ^
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
421 call assert_equal([0, 0], searchpairpos('{', '', '}', 'bW'))
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
422 call assert_equal([0, 4, 2, 0], getpos('.'))
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
423
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
424 %d
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
425 call setline(1, ['if 1', ' if 2', ' else', ' endif 2', 'endif 1'])
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
426 /\<if 1
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
427 call assert_equal([5, 1], searchpairpos('\<if\>', '\<else\>', '\<endif\>', 'W'))
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
428 call assert_equal([0, 5, 1, 0], getpos('.'))
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
429 /\<if 2
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
430 call assert_equal([3, 3], searchpairpos('\<if\>', '\<else\>', '\<endif\>', 'W'))
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
431 call assert_equal([0, 3, 3, 0], getpos('.'))
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
432
10514
1435e45ee6fa commit https://github.com/vim/vim/commit/6e450a57541676036203a72d40b2e604e938371e
Christian Brabandt <cb@256bit.org>
parents: 10172
diff changeset
433 q!
1435e45ee6fa commit https://github.com/vim/vim/commit/6e450a57541676036203a72d40b2e604e938371e
Christian Brabandt <cb@256bit.org>
parents: 10172
diff changeset
434 endfunc
1435e45ee6fa commit https://github.com/vim/vim/commit/6e450a57541676036203a72d40b2e604e938371e
Christian Brabandt <cb@256bit.org>
parents: 10172
diff changeset
435
14189
0181a2cad0a1 patch 8.1.0112: no error when using bad arguments with searchpair()
Christian Brabandt <cb@256bit.org>
parents: 13808
diff changeset
436 func Test_searchpair_errors()
25198
eafc0e07b188 patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24745
diff changeset
437 call assert_fails("call searchpair([0], 'middle', 'end', 'bW', 'skip', 99, 100)", 'E730: Using a List as a String')
eafc0e07b188 patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24745
diff changeset
438 call assert_fails("call searchpair('start', {-> 0}, 'end', 'bW', 'skip', 99, 100)", 'E729: Using a Funcref as a String')
eafc0e07b188 patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24745
diff changeset
439 call assert_fails("call searchpair('start', 'middle', {'one': 1}, 'bW', 'skip', 99, 100)", 'E731: Using a Dictionary as a String')
14189
0181a2cad0a1 patch 8.1.0112: no error when using bad arguments with searchpair()
Christian Brabandt <cb@256bit.org>
parents: 13808
diff changeset
440 call assert_fails("call searchpair('start', 'middle', 'end', 'flags', 'skip', 99, 100)", 'E475: Invalid argument: flags')
0181a2cad0a1 patch 8.1.0112: no error when using bad arguments with searchpair()
Christian Brabandt <cb@256bit.org>
parents: 13808
diff changeset
441 call assert_fails("call searchpair('start', 'middle', 'end', 'bW', 'func', -99, 100)", 'E475: Invalid argument: -99')
0181a2cad0a1 patch 8.1.0112: no error when using bad arguments with searchpair()
Christian Brabandt <cb@256bit.org>
parents: 13808
diff changeset
442 call assert_fails("call searchpair('start', 'middle', 'end', 'bW', 'func', 99, -100)", 'E475: Invalid argument: -100')
18935
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
443 call assert_fails("call searchpair('start', 'middle', 'end', 'e')", 'E475: Invalid argument: e')
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
444 call assert_fails("call searchpair('start', 'middle', 'end', 'sn')", 'E475: Invalid argument: sn')
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
445 endfunc
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
446
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
447 func Test_searchpairpos_errors()
25198
eafc0e07b188 patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24745
diff changeset
448 call assert_fails("call searchpairpos([0], 'middle', 'end', 'bW', 'skip', 99, 100)", 'E730: Using a List as a String')
eafc0e07b188 patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24745
diff changeset
449 call assert_fails("call searchpairpos('start', {-> 0}, 'end', 'bW', 'skip', 99, 100)", 'E729: Using a Funcref as a String')
eafc0e07b188 patch 8.2.3135: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24745
diff changeset
450 call assert_fails("call searchpairpos('start', 'middle', {'one': 1}, 'bW', 'skip', 99, 100)", 'E731: Using a Dictionary as a String')
18935
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
451 call assert_fails("call searchpairpos('start', 'middle', 'end', 'flags', 'skip', 99, 100)", 'E475: Invalid argument: flags')
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
452 call assert_fails("call searchpairpos('start', 'middle', 'end', 'bW', 'func', -99, 100)", 'E475: Invalid argument: -99')
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
453 call assert_fails("call searchpairpos('start', 'middle', 'end', 'bW', 'func', 99, -100)", 'E475: Invalid argument: -100')
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
454 call assert_fails("call searchpairpos('start', 'middle', 'end', 'e')", 'E475: Invalid argument: e')
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
455 call assert_fails("call searchpairpos('start', 'middle', 'end', 'sn')", 'E475: Invalid argument: sn')
14189
0181a2cad0a1 patch 8.1.0112: no error when using bad arguments with searchpair()
Christian Brabandt <cb@256bit.org>
parents: 13808
diff changeset
456 endfunc
0181a2cad0a1 patch 8.1.0112: no error when using bad arguments with searchpair()
Christian Brabandt <cb@256bit.org>
parents: 13808
diff changeset
457
12722
7749260f261c patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents: 12720
diff changeset
458 func Test_searchpair_skip()
7749260f261c patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents: 12720
diff changeset
459 func Zero()
18935
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
460 return 0
12722
7749260f261c patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents: 12720
diff changeset
461 endfunc
7749260f261c patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents: 12720
diff changeset
462 func Partial(x)
18935
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
463 return a:x
12722
7749260f261c patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents: 12720
diff changeset
464 endfunc
7749260f261c patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents: 12720
diff changeset
465 new
7749260f261c patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents: 12720
diff changeset
466 call setline(1, ['{', 'foo', 'foo', 'foo', '}'])
7749260f261c patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents: 12720
diff changeset
467 3 | call assert_equal(1, searchpair('{', '', '}', 'bWn', ''))
7749260f261c patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents: 12720
diff changeset
468 3 | call assert_equal(1, searchpair('{', '', '}', 'bWn', '0'))
7749260f261c patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents: 12720
diff changeset
469 3 | call assert_equal(1, searchpair('{', '', '}', 'bWn', {-> 0}))
7749260f261c patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents: 12720
diff changeset
470 3 | call assert_equal(1, searchpair('{', '', '}', 'bWn', function('Zero')))
7749260f261c patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents: 12720
diff changeset
471 3 | call assert_equal(1, searchpair('{', '', '}', 'bWn', function('Partial', [0])))
7749260f261c patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents: 12720
diff changeset
472 bw!
7749260f261c patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents: 12720
diff changeset
473 endfunc
7749260f261c patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents: 12720
diff changeset
474
14331
f8280e1bfc84 patch 8.1.0181: memory leak with trailing characters in skip expression
Christian Brabandt <cb@256bit.org>
parents: 14189
diff changeset
475 func Test_searchpair_leak()
f8280e1bfc84 patch 8.1.0181: memory leak with trailing characters in skip expression
Christian Brabandt <cb@256bit.org>
parents: 14189
diff changeset
476 new
f8280e1bfc84 patch 8.1.0181: memory leak with trailing characters in skip expression
Christian Brabandt <cb@256bit.org>
parents: 14189
diff changeset
477 call setline(1, 'if one else another endif')
f8280e1bfc84 patch 8.1.0181: memory leak with trailing characters in skip expression
Christian Brabandt <cb@256bit.org>
parents: 14189
diff changeset
478
f8280e1bfc84 patch 8.1.0181: memory leak with trailing characters in skip expression
Christian Brabandt <cb@256bit.org>
parents: 14189
diff changeset
479 " The error in the skip expression caused memory to leak.
f8280e1bfc84 patch 8.1.0181: memory leak with trailing characters in skip expression
Christian Brabandt <cb@256bit.org>
parents: 14189
diff changeset
480 call assert_fails("call searchpair('\\<if\\>', '\\<else\\>', '\\<endif\\>', '', '\"foo\" 2')", 'E15:')
f8280e1bfc84 patch 8.1.0181: memory leak with trailing characters in skip expression
Christian Brabandt <cb@256bit.org>
parents: 14189
diff changeset
481
f8280e1bfc84 patch 8.1.0181: memory leak with trailing characters in skip expression
Christian Brabandt <cb@256bit.org>
parents: 14189
diff changeset
482 bwipe!
f8280e1bfc84 patch 8.1.0181: memory leak with trailing characters in skip expression
Christian Brabandt <cb@256bit.org>
parents: 14189
diff changeset
483 endfunc
f8280e1bfc84 patch 8.1.0181: memory leak with trailing characters in skip expression
Christian Brabandt <cb@256bit.org>
parents: 14189
diff changeset
484
11018
654fc5636b37 patch 8.0.0398: illegal memory access with "t"
Christian Brabandt <cb@256bit.org>
parents: 10514
diff changeset
485 func Test_searchc()
654fc5636b37 patch 8.0.0398: illegal memory access with "t"
Christian Brabandt <cb@256bit.org>
parents: 10514
diff changeset
486 " These commands used to cause memory overflow in searchc().
654fc5636b37 patch 8.0.0398: illegal memory access with "t"
Christian Brabandt <cb@256bit.org>
parents: 10514
diff changeset
487 new
654fc5636b37 patch 8.0.0398: illegal memory access with "t"
Christian Brabandt <cb@256bit.org>
parents: 10514
diff changeset
488 norm ixx
654fc5636b37 patch 8.0.0398: illegal memory access with "t"
Christian Brabandt <cb@256bit.org>
parents: 10514
diff changeset
489 exe "norm 0t\u93cf"
654fc5636b37 patch 8.0.0398: illegal memory access with "t"
Christian Brabandt <cb@256bit.org>
parents: 10514
diff changeset
490 bw!
654fc5636b37 patch 8.0.0398: illegal memory access with "t"
Christian Brabandt <cb@256bit.org>
parents: 10514
diff changeset
491 endfunc
11613
7428a08c2f68 patch 8.0.0689: ~ character not escaped when extending search pattern
Christian Brabandt <cb@256bit.org>
parents: 11105
diff changeset
492
14515
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
493 func Cmdline3_prep()
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
494 " need to disable char_avail,
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
495 " so that expansion of commandline works
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
496 call test_override("char_avail", 1)
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
497 new
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
498 call setline(1, [' 1', ' 2 the~e', ' 3 the theother'])
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
499 set incsearch
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
500 endfunc
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
501
14524
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
502 func Incsearch_cleanup()
14515
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
503 set noincsearch
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
504 call test_override("char_avail", 0)
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
505 bw!
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
506 endfunc
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
507
14522
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
508 func Test_search_cmdline3()
19705
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
509 CheckOption incsearch
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
510
14522
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
511 call Cmdline3_prep()
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
512 1
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
513 " first match
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
514 call feedkeys("/the\<c-l>\<cr>", 'tx')
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
515 call assert_equal(' 2 the~e', getline('.'))
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
516
14524
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
517 call Incsearch_cleanup()
14522
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
518 endfunc
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
519
14515
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
520 func Test_search_cmdline3s()
19705
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
521 CheckOption incsearch
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
522
14515
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
523 call Cmdline3_prep()
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
524 1
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
525 call feedkeys(":%s/the\<c-l>/xxx\<cr>", 'tx')
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
526 call assert_equal(' 2 xxxe', getline('.'))
14522
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
527 undo
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
528 call feedkeys(":%subs/the\<c-l>/xxx\<cr>", 'tx')
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
529 call assert_equal(' 2 xxxe', getline('.'))
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
530 undo
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
531 call feedkeys(":%substitute/the\<c-l>/xxx\<cr>", 'tx')
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
532 call assert_equal(' 2 xxxe', getline('.'))
14546
35e7ead872db patch 8.1.0286: 'incsearch' does not apply to :smagic and :snomagic
Christian Brabandt <cb@256bit.org>
parents: 14542
diff changeset
533 undo
35e7ead872db patch 8.1.0286: 'incsearch' does not apply to :smagic and :snomagic
Christian Brabandt <cb@256bit.org>
parents: 14542
diff changeset
534 call feedkeys(":%smagic/the.e/xxx\<cr>", 'tx')
35e7ead872db patch 8.1.0286: 'incsearch' does not apply to :smagic and :snomagic
Christian Brabandt <cb@256bit.org>
parents: 14542
diff changeset
535 call assert_equal(' 2 xxx', getline('.'))
35e7ead872db patch 8.1.0286: 'incsearch' does not apply to :smagic and :snomagic
Christian Brabandt <cb@256bit.org>
parents: 14542
diff changeset
536 undo
22087
ff21e2962490 patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents: 21491
diff changeset
537 call assert_fails(":%snomagic/the.e/xxx\<cr>", 'E486:')
14546
35e7ead872db patch 8.1.0286: 'incsearch' does not apply to :smagic and :snomagic
Christian Brabandt <cb@256bit.org>
parents: 14542
diff changeset
538 "
35e7ead872db patch 8.1.0286: 'incsearch' does not apply to :smagic and :snomagic
Christian Brabandt <cb@256bit.org>
parents: 14542
diff changeset
539 call feedkeys(":%snomagic/the\\.e/xxx\<cr>", 'tx')
35e7ead872db patch 8.1.0286: 'incsearch' does not apply to :smagic and :snomagic
Christian Brabandt <cb@256bit.org>
parents: 14542
diff changeset
540 call assert_equal(' 2 xxx', getline('.'))
14515
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
541
14524
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
542 call Incsearch_cleanup()
14515
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
543 endfunc
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
544
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
545 func Test_search_cmdline3g()
19705
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
546 CheckOption incsearch
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
547
14515
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
548 call Cmdline3_prep()
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
549 1
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
550 call feedkeys(":g/the\<c-l>/d\<cr>", 'tx')
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
551 call assert_equal(' 3 the theother', getline(2))
14522
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
552 undo
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
553 call feedkeys(":global/the\<c-l>/d\<cr>", 'tx')
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
554 call assert_equal(' 3 the theother', getline(2))
14534
8fa7f5ff2649 patch 8.1.0280: 'incsearch' highlighting does not work for ":g!/"
Christian Brabandt <cb@256bit.org>
parents: 14532
diff changeset
555 undo
8fa7f5ff2649 patch 8.1.0280: 'incsearch' highlighting does not work for ":g!/"
Christian Brabandt <cb@256bit.org>
parents: 14532
diff changeset
556 call feedkeys(":g!/the\<c-l>/d\<cr>", 'tx')
8fa7f5ff2649 patch 8.1.0280: 'incsearch' highlighting does not work for ":g!/"
Christian Brabandt <cb@256bit.org>
parents: 14532
diff changeset
557 call assert_equal(1, line('$'))
8fa7f5ff2649 patch 8.1.0280: 'incsearch' highlighting does not work for ":g!/"
Christian Brabandt <cb@256bit.org>
parents: 14532
diff changeset
558 call assert_equal(' 2 the~e', getline(1))
8fa7f5ff2649 patch 8.1.0280: 'incsearch' highlighting does not work for ":g!/"
Christian Brabandt <cb@256bit.org>
parents: 14532
diff changeset
559 undo
8fa7f5ff2649 patch 8.1.0280: 'incsearch' highlighting does not work for ":g!/"
Christian Brabandt <cb@256bit.org>
parents: 14532
diff changeset
560 call feedkeys(":global!/the\<c-l>/d\<cr>", 'tx')
8fa7f5ff2649 patch 8.1.0280: 'incsearch' highlighting does not work for ":g!/"
Christian Brabandt <cb@256bit.org>
parents: 14532
diff changeset
561 call assert_equal(1, line('$'))
8fa7f5ff2649 patch 8.1.0280: 'incsearch' highlighting does not work for ":g!/"
Christian Brabandt <cb@256bit.org>
parents: 14532
diff changeset
562 call assert_equal(' 2 the~e', getline(1))
14515
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
563
14524
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
564 call Incsearch_cleanup()
14515
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
565 endfunc
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
566
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
567 func Test_search_cmdline3v()
19705
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
568 CheckOption incsearch
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
569
14515
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
570 call Cmdline3_prep()
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
571 1
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
572 call feedkeys(":v/the\<c-l>/d\<cr>", 'tx')
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
573 call assert_equal(1, line('$'))
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
574 call assert_equal(' 2 the~e', getline(1))
14522
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
575 undo
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
576 call feedkeys(":vglobal/the\<c-l>/d\<cr>", 'tx')
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
577 call assert_equal(1, line('$'))
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
578 call assert_equal(' 2 the~e', getline(1))
14515
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
579
14524
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
580 call Incsearch_cleanup()
14515
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
581 endfunc
3648e74dd523 patch 8.1.0271: 'incsearch' doesn't work for :s, :g or :v
Christian Brabandt <cb@256bit.org>
parents: 14331
diff changeset
582
11619
80af4916eadc patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents: 11613
diff changeset
583 func Test_search_cmdline4()
19705
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
584 CheckOption incsearch
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
585
11619
80af4916eadc patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents: 11613
diff changeset
586 " need to disable char_avail,
80af4916eadc patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents: 11613
diff changeset
587 " so that expansion of commandline works
80af4916eadc patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents: 11613
diff changeset
588 call test_override("char_avail", 1)
80af4916eadc patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents: 11613
diff changeset
589 new
80af4916eadc patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents: 11613
diff changeset
590 call setline(1, [' 1 the first', ' 2 the second', ' 3 the third'])
80af4916eadc patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents: 11613
diff changeset
591 set incsearch
80af4916eadc patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents: 11613
diff changeset
592 $
80af4916eadc patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents: 11613
diff changeset
593 call feedkeys("?the\<c-g>\<cr>", 'tx')
80af4916eadc patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents: 11613
diff changeset
594 call assert_equal(' 3 the third', getline('.'))
80af4916eadc patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents: 11613
diff changeset
595 $
80af4916eadc patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents: 11613
diff changeset
596 call feedkeys("?the\<c-g>\<c-g>\<cr>", 'tx')
80af4916eadc patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents: 11613
diff changeset
597 call assert_equal(' 1 the first', getline('.'))
80af4916eadc patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents: 11613
diff changeset
598 $
80af4916eadc patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents: 11613
diff changeset
599 call feedkeys("?the\<c-g>\<c-g>\<c-g>\<cr>", 'tx')
80af4916eadc patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents: 11613
diff changeset
600 call assert_equal(' 2 the second', getline('.'))
80af4916eadc patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents: 11613
diff changeset
601 $
80af4916eadc patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents: 11613
diff changeset
602 call feedkeys("?the\<c-t>\<cr>", 'tx')
80af4916eadc patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents: 11613
diff changeset
603 call assert_equal(' 1 the first', getline('.'))
80af4916eadc patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents: 11613
diff changeset
604 $
80af4916eadc patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents: 11613
diff changeset
605 call feedkeys("?the\<c-t>\<c-t>\<cr>", 'tx')
80af4916eadc patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents: 11613
diff changeset
606 call assert_equal(' 3 the third', getline('.'))
80af4916eadc patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents: 11613
diff changeset
607 $
80af4916eadc patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents: 11613
diff changeset
608 call feedkeys("?the\<c-t>\<c-t>\<c-t>\<cr>", 'tx')
80af4916eadc patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents: 11613
diff changeset
609 call assert_equal(' 2 the second', getline('.'))
80af4916eadc patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents: 11613
diff changeset
610 " clean up
80af4916eadc patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents: 11613
diff changeset
611 set noincsearch
80af4916eadc patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents: 11613
diff changeset
612 call test_override("char_avail", 0)
80af4916eadc patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents: 11613
diff changeset
613 bw!
80af4916eadc patch 8.0.0692: CTRL-G with 'incsearch' and ? goes in the wrong direction
Christian Brabandt <cb@256bit.org>
parents: 11613
diff changeset
614 endfunc
12560
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
615
12664
42cd1f315e8b patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
616 func Test_search_cmdline5()
19705
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
617 CheckOption incsearch
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
618
12664
42cd1f315e8b patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
619 " Do not call test_override("char_avail", 1) so that <C-g> and <C-t> work
42cd1f315e8b patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
620 " regardless char_avail.
42cd1f315e8b patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
621 new
17411
9c4ddc78df74 patch 8.1.1704: C-R C-W does not work after C-G when using 'incsearch'
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
622 call setline(1, [' 1 the first', ' 2 the second', ' 3 the third', ''])
12664
42cd1f315e8b patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
623 set incsearch
42cd1f315e8b patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
624 1
42cd1f315e8b patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
625 call feedkeys("/the\<c-g>\<c-g>\<cr>", 'tx')
42cd1f315e8b patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
626 call assert_equal(' 3 the third', getline('.'))
42cd1f315e8b patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
627 $
42cd1f315e8b patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
628 call feedkeys("?the\<c-t>\<c-t>\<c-t>\<cr>", 'tx')
17411
9c4ddc78df74 patch 8.1.1704: C-R C-W does not work after C-G when using 'incsearch'
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
629 call assert_equal(' 1 the first', getline('.'))
12664
42cd1f315e8b patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
630 " clean up
42cd1f315e8b patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
631 set noincsearch
42cd1f315e8b patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
632 bw!
42cd1f315e8b patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
633 endfunc
42cd1f315e8b patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
634
12744
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
635 func Test_search_cmdline6()
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
636 " Test that consecutive matches
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
637 " are caught by <c-g>/<c-t>
19705
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
638 CheckOption incsearch
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
639
12744
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
640 " need to disable char_avail,
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
641 " so that expansion of commandline works
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
642 call test_override("char_avail", 1)
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
643 new
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
644 call setline(1, [' bbvimb', ''])
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
645 set incsearch
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
646 " first match
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
647 norm! gg0
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
648 call feedkeys("/b\<cr>", 'tx')
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
649 call assert_equal([0,1,2,0], getpos('.'))
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
650 " second match
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
651 norm! gg0
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
652 call feedkeys("/b\<c-g>\<cr>", 'tx')
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
653 call assert_equal([0,1,3,0], getpos('.'))
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
654 " third match
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
655 norm! gg0
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
656 call feedkeys("/b\<c-g>\<c-g>\<cr>", 'tx')
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
657 call assert_equal([0,1,7,0], getpos('.'))
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
658 " first match again
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
659 norm! gg0
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
660 call feedkeys("/b\<c-g>\<c-g>\<c-g>\<cr>", 'tx')
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
661 call assert_equal([0,1,2,0], getpos('.'))
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
662 set nowrapscan
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
663 " last match
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
664 norm! gg0
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
665 call feedkeys("/b\<c-g>\<c-g>\<c-g>\<cr>", 'tx')
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
666 call assert_equal([0,1,7,0], getpos('.'))
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
667 " clean up
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
668 set wrapscan&vim
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
669 set noincsearch
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
670 call test_override("char_avail", 0)
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
671 bw!
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
672 endfunc
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
673
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
674 func Test_search_cmdline7()
21491
e3c1e12f062c patch 8.2.1296: some part of using 'smarcase' was not tested
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
675 " Test that pressing <c-g> in an empty command line
12744
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
676 " does not move the cursor
19705
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
677 CheckOption incsearch
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
678
12744
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
679 " need to disable char_avail,
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
680 " so that expansion of commandline works
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
681 call test_override("char_avail", 1)
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
682 new
14522
97641c4f5687 patch 8.1.0274: 'incsearch' triggers on ":source"
Christian Brabandt <cb@256bit.org>
parents: 14515
diff changeset
683 let @/ = 'b'
12744
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
684 call setline(1, [' bbvimb', ''])
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
685 set incsearch
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
686 " first match
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
687 norm! gg0
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
688 " moves to next match of previous search pattern, just like /<cr>
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
689 call feedkeys("/\<c-g>\<cr>", 'tx')
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
690 call assert_equal([0,1,2,0], getpos('.'))
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
691 " moves to next match of previous search pattern, just like /<cr>
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
692 call feedkeys("/\<cr>", 'tx')
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
693 call assert_equal([0,1,3,0], getpos('.'))
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
694 " moves to next match of previous search pattern, just like /<cr>
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
695 call feedkeys("/\<c-t>\<cr>", 'tx')
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
696 call assert_equal([0,1,7,0], getpos('.'))
12855
3c09e451af3a patch 8.0.1304: CTRL-G/CTRL-T don't work with incsearch and empty pattern
Christian Brabandt <cb@256bit.org>
parents: 12788
diff changeset
697
3c09e451af3a patch 8.0.1304: CTRL-G/CTRL-T don't work with incsearch and empty pattern
Christian Brabandt <cb@256bit.org>
parents: 12788
diff changeset
698 " using an offset uses the last search pattern
3c09e451af3a patch 8.0.1304: CTRL-G/CTRL-T don't work with incsearch and empty pattern
Christian Brabandt <cb@256bit.org>
parents: 12788
diff changeset
699 call cursor(1, 1)
3c09e451af3a patch 8.0.1304: CTRL-G/CTRL-T don't work with incsearch and empty pattern
Christian Brabandt <cb@256bit.org>
parents: 12788
diff changeset
700 call setline(1, ['1 bbvimb', ' 2 bbvimb'])
3c09e451af3a patch 8.0.1304: CTRL-G/CTRL-T don't work with incsearch and empty pattern
Christian Brabandt <cb@256bit.org>
parents: 12788
diff changeset
701 let @/ = 'b'
3c09e451af3a patch 8.0.1304: CTRL-G/CTRL-T don't work with incsearch and empty pattern
Christian Brabandt <cb@256bit.org>
parents: 12788
diff changeset
702 call feedkeys("//e\<c-g>\<cr>", 'tx')
3c09e451af3a patch 8.0.1304: CTRL-G/CTRL-T don't work with incsearch and empty pattern
Christian Brabandt <cb@256bit.org>
parents: 12788
diff changeset
703 call assert_equal('1 bbvimb', getline('.'))
3c09e451af3a patch 8.0.1304: CTRL-G/CTRL-T don't work with incsearch and empty pattern
Christian Brabandt <cb@256bit.org>
parents: 12788
diff changeset
704 call assert_equal(4, col('.'))
3c09e451af3a patch 8.0.1304: CTRL-G/CTRL-T don't work with incsearch and empty pattern
Christian Brabandt <cb@256bit.org>
parents: 12788
diff changeset
705
12744
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
706 set noincsearch
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
707 call test_override("char_avail", 0)
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
708 bw!
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
709 endfunc
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
710
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
711 func Test_search_cmdline8()
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
712 " Highlighting is cleared in all windows
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
713 " since hls applies to all windows
17657
0da9bc55c31a patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents: 17411
diff changeset
714 CheckOption incsearch
0da9bc55c31a patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents: 17411
diff changeset
715 CheckFeature terminal
0da9bc55c31a patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents: 17411
diff changeset
716 CheckNotGui
12744
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
717 if has("win32")
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
718 throw "Skipped: Bug with sending <ESC> to terminal window not fixed yet"
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
719 endif
17657
0da9bc55c31a patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents: 17411
diff changeset
720
12744
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
721 let h = winheight(0)
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
722 if h < 3
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
723 return
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
724 endif
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
725 " Prepare buffer text
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
726 let lines = ['abb vim vim vi', 'vimvivim']
30769
ae10b91ac6b3 patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 29277
diff changeset
727 call writefile(lines, 'Xsearch.txt', 'D')
12763
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
728 let buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile', 'Xsearch.txt'], {'term_rows': 3})
12744
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
729
13808
16a062cf08c2 patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents: 13790
diff changeset
730 call WaitForAssert({-> assert_equal(lines, [term_getline(buf, 1), term_getline(buf, 2)])})
12744
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
731
12763
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
732 call term_sendkeys(buf, ":set incsearch hlsearch\<cr>")
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
733 call term_sendkeys(buf, ":14vsp\<cr>")
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
734 call term_sendkeys(buf, "/vim\<cr>")
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
735 call term_sendkeys(buf, "/b\<esc>")
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
736 call term_sendkeys(buf, "gg0")
19954
c087099e9163 patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents: 19950
diff changeset
737 call TermWait(buf, 250)
12763
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
738 let screen_line = term_scrape(buf, 1)
12744
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
739 let [a0,a1,a2,a3] = [screen_line[3].attr, screen_line[4].attr,
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
740 \ screen_line[18].attr, screen_line[19].attr]
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
741 call assert_notequal(a0, a1)
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
742 call assert_notequal(a0, a3)
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
743 call assert_notequal(a1, a2)
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
744 call assert_equal(a0, a2)
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
745 call assert_equal(a1, a3)
30769
ae10b91ac6b3 patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 29277
diff changeset
746
12744
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
747 " clean up
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
748 bwipe!
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
749 endfunc
0c704288ced4 patch 8.0.1250: 'hlsearch' highlighting not removed after incsearch
Christian Brabandt <cb@256bit.org>
parents: 12732
diff changeset
750
12560
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
751 " Tests for regexp with various magic settings
19958
0b42b5e50344 patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
752 func Run_search_regexp_magic_opt()
12560
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
753 put ='1 a aa abb abbccc'
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
754 exe 'normal! /a*b\{2}c\+/e' . "\<CR>"
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
755 call assert_equal([0, 2, 17, 0], getpos('.'))
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
756
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
757 put ='2 d dd dee deefff'
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
758 exe 'normal! /\Md\*e\{2}f\+/e' . "\<CR>"
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
759 call assert_equal([0, 3, 17, 0], getpos('.'))
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
760
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
761 set nomagic
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
762 put ='3 g gg ghh ghhiii'
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
763 exe 'normal! /g\*h\{2}i\+/e' . "\<CR>"
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
764 call assert_equal([0, 4, 17, 0], getpos('.'))
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
765
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
766 put ='4 j jj jkk jkklll'
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
767 exe 'normal! /\mj*k\{2}l\+/e' . "\<CR>"
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
768 call assert_equal([0, 5, 17, 0], getpos('.'))
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
769
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
770 put ='5 m mm mnn mnnooo'
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
771 exe 'normal! /\vm*n{2}o+/e' . "\<CR>"
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
772 call assert_equal([0, 6, 17, 0], getpos('.'))
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
773
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
774 put ='6 x ^aa$ x'
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
775 exe 'normal! /\V^aa$' . "\<CR>"
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
776 call assert_equal([0, 7, 5, 0], getpos('.'))
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
777
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
778 set magic
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
779 put ='7 (a)(b) abbaa'
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
780 exe 'normal! /\v(a)(b)\2\1\1/e' . "\<CR>"
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
781 call assert_equal([0, 8, 14, 0], getpos('.'))
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
782
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
783 put ='8 axx [ab]xx'
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
784 exe 'normal! /\V[ab]\(\[xy]\)\1' . "\<CR>"
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
785 call assert_equal([0, 9, 7, 0], getpos('.'))
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
786
19958
0b42b5e50344 patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
787 %d
0b42b5e50344 patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
788 endfunc
0b42b5e50344 patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
789
0b42b5e50344 patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
790 func Test_search_regexp()
0b42b5e50344 patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
791 enew!
0b42b5e50344 patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
792
0b42b5e50344 patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
793 set regexpengine=1
0b42b5e50344 patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
794 call Run_search_regexp_magic_opt()
0b42b5e50344 patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
795 set regexpengine=2
0b42b5e50344 patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
796 call Run_search_regexp_magic_opt()
0b42b5e50344 patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
797 set regexpengine&
0b42b5e50344 patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
798
12560
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
799 set undolevels=100
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
800 put ='9 foobar'
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
801 put =''
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
802 exe "normal! a\<C-G>u\<Esc>"
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
803 normal G
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
804 exe 'normal! dv?bar?' . "\<CR>"
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
805 call assert_equal('9 foo', getline('.'))
19958
0b42b5e50344 patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
806 call assert_equal([0, 2, 5, 0], getpos('.'))
0b42b5e50344 patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
807 call assert_equal(2, line('$'))
12560
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
808 normal u
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
809 call assert_equal('9 foobar', getline('.'))
19958
0b42b5e50344 patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
810 call assert_equal([0, 2, 6, 0], getpos('.'))
0b42b5e50344 patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
811 call assert_equal(3, line('$'))
12560
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
812
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
813 set undolevels&
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
814 enew!
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 11619
diff changeset
815 endfunc
12720
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
816
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
817 func Test_search_cmdline_incsearch_highlight()
19705
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
818 CheckOption incsearch
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
819
12720
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
820 set incsearch hlsearch
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
821 " need to disable char_avail,
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
822 " so that expansion of commandline works
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
823 call test_override("char_avail", 1)
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
824 new
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
825 call setline(1, ['aaa 1 the first', ' 2 the second', ' 3 the third'])
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
826
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
827 1
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
828 call feedkeys("/second\<cr>", 'tx')
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
829 call assert_equal('second', @/)
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
830 call assert_equal(' 2 the second', getline('.'))
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
831
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
832 " Canceling search won't change @/
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
833 1
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
834 let @/ = 'last pattern'
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
835 call feedkeys("/third\<C-c>", 'tx')
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
836 call assert_equal('last pattern', @/)
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
837 call feedkeys("/third\<Esc>", 'tx')
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
838 call assert_equal('last pattern', @/)
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
839 call feedkeys("/3\<bs>\<bs>", 'tx')
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
840 call assert_equal('last pattern', @/)
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
841 call feedkeys("/third\<c-g>\<c-t>\<Esc>", 'tx')
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
842 call assert_equal('last pattern', @/)
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
843
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
844 " clean up
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
845 set noincsearch nohlsearch
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
846 bw!
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
847 endfunc
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
848
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
849 func Test_search_cmdline_incsearch_highlight_attr()
17657
0da9bc55c31a patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents: 17411
diff changeset
850 CheckOption incsearch
0da9bc55c31a patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents: 17411
diff changeset
851 CheckFeature terminal
0da9bc55c31a patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents: 17411
diff changeset
852 CheckNotGui
0da9bc55c31a patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents: 17411
diff changeset
853
12720
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
854 let h = winheight(0)
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
855 if h < 3
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
856 return
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
857 endif
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
858
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
859 " Prepare buffer text
12763
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
860 let lines = ['abb vim vim vi', 'vimvivim']
30769
ae10b91ac6b3 patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 29277
diff changeset
861 call writefile(lines, 'Xsearch.txt', 'D')
12763
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
862 let buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile', 'Xsearch.txt'], {'term_rows': 3})
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
863
13808
16a062cf08c2 patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why
Christian Brabandt <cb@256bit.org>
parents: 13790
diff changeset
864 call WaitForAssert({-> assert_equal(lines, [term_getline(buf, 1), term_getline(buf, 2)])})
13132
fe0cec169589 patch 8.0.1440: terminal window: some vterm responses are delayed
Christian Brabandt <cb@256bit.org>
parents: 13084
diff changeset
865 " wait for vim to complete initialization
19954
c087099e9163 patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents: 19950
diff changeset
866 call TermWait(buf)
12720
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
867
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
868 " Get attr of normal(a0), incsearch(a1), hlsearch(a2) highlight
12763
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
869 call term_sendkeys(buf, ":set incsearch hlsearch\<cr>")
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
870 call term_sendkeys(buf, '/b')
19954
c087099e9163 patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents: 19950
diff changeset
871 call TermWait(buf, 100)
12763
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
872 let screen_line1 = term_scrape(buf, 1)
12720
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
873 call assert_true(len(screen_line1) > 2)
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
874 " a0: attr_normal
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
875 let a0 = screen_line1[0].attr
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
876 " a1: attr_incsearch
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
877 let a1 = screen_line1[1].attr
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
878 " a2: attr_hlsearch
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
879 let a2 = screen_line1[2].attr
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
880 call assert_notequal(a0, a1)
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
881 call assert_notequal(a0, a2)
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
882 call assert_notequal(a1, a2)
12763
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
883 call term_sendkeys(buf, "\<cr>gg0")
12720
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
884
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
885 " Test incremental highlight search
12763
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
886 call term_sendkeys(buf, "/vim")
19954
c087099e9163 patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents: 19950
diff changeset
887 call TermWait(buf, 100)
12720
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
888 " Buffer:
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
889 " abb vim vim vi
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
890 " vimvivim
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
891 " Search: /vim
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
892 let attr_line1 = [a0,a0,a0,a0,a1,a1,a1,a0,a2,a2,a2,a0,a0,a0]
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
893 let attr_line2 = [a2,a2,a2,a0,a0,a2,a2,a2]
12763
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
894 call assert_equal(attr_line1, map(term_scrape(buf, 1)[:len(attr_line1)-1], 'v:val.attr'))
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
895 call assert_equal(attr_line2, map(term_scrape(buf, 2)[:len(attr_line2)-1], 'v:val.attr'))
12720
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
896
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
897 " Test <C-g>
12763
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
898 call term_sendkeys(buf, "\<C-g>\<C-g>")
19954
c087099e9163 patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents: 19950
diff changeset
899 call TermWait(buf, 100)
12720
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
900 let attr_line1 = [a0,a0,a0,a0,a2,a2,a2,a0,a2,a2,a2,a0,a0,a0]
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
901 let attr_line2 = [a1,a1,a1,a0,a0,a2,a2,a2]
12763
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
902 call assert_equal(attr_line1, map(term_scrape(buf, 1)[:len(attr_line1)-1], 'v:val.attr'))
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
903 call assert_equal(attr_line2, map(term_scrape(buf, 2)[:len(attr_line2)-1], 'v:val.attr'))
12720
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
904
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
905 " Test <C-t>
12763
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
906 call term_sendkeys(buf, "\<C-t>")
19954
c087099e9163 patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents: 19950
diff changeset
907 call TermWait(buf, 100)
12720
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
908 let attr_line1 = [a0,a0,a0,a0,a2,a2,a2,a0,a1,a1,a1,a0,a0,a0]
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
909 let attr_line2 = [a2,a2,a2,a0,a0,a2,a2,a2]
12763
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
910 call assert_equal(attr_line1, map(term_scrape(buf, 1)[:len(attr_line1)-1], 'v:val.attr'))
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
911 call assert_equal(attr_line2, map(term_scrape(buf, 2)[:len(attr_line2)-1], 'v:val.attr'))
12720
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
912
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
913 " Type Enter and a1(incsearch highlight) should become a2(hlsearch highlight)
12763
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
914 call term_sendkeys(buf, "\<cr>")
19954
c087099e9163 patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents: 19950
diff changeset
915 call TermWait(buf, 100)
12720
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
916 let attr_line1 = [a0,a0,a0,a0,a2,a2,a2,a0,a2,a2,a2,a0,a0,a0]
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
917 let attr_line2 = [a2,a2,a2,a0,a0,a2,a2,a2]
12763
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
918 call assert_equal(attr_line1, map(term_scrape(buf, 1)[:len(attr_line1)-1], 'v:val.attr'))
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
919 call assert_equal(attr_line2, map(term_scrape(buf, 2)[:len(attr_line2)-1], 'v:val.attr'))
12720
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
920
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
921 " Test nohlsearch. a2(hlsearch highlight) should become a0(normal highlight)
12763
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
922 call term_sendkeys(buf, ":1\<cr>")
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
923 call term_sendkeys(buf, ":set nohlsearch\<cr>")
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
924 call term_sendkeys(buf, "/vim")
19954
c087099e9163 patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents: 19950
diff changeset
925 call TermWait(buf, 100)
12720
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
926 let attr_line1 = [a0,a0,a0,a0,a1,a1,a1,a0,a0,a0,a0,a0,a0,a0]
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
927 let attr_line2 = [a0,a0,a0,a0,a0,a0,a0,a0]
12763
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
928 call assert_equal(attr_line1, map(term_scrape(buf, 1)[:len(attr_line1)-1], 'v:val.attr'))
7f27e9769f62 patch 8.0.1259: search test can be flaky
Christian Brabandt <cb@256bit.org>
parents: 12759
diff changeset
929 call assert_equal(attr_line2, map(term_scrape(buf, 2)[:len(attr_line2)-1], 'v:val.attr'))
12720
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
930
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
931 bwipe!
37c384802df4 patch 8.0.1238: incremental search only shows one match
Christian Brabandt <cb@256bit.org>
parents: 12664
diff changeset
932 endfunc
12730
6fa9f6b4d159 patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents: 12722
diff changeset
933
15263
ad065b8123e8 patch 8.1.0640: get E14 while typing command :tab with 'incsearch' set
Bram Moolenaar <Bram@vim.org>
parents: 15148
diff changeset
934 func Test_incsearch_cmdline_modifier()
19705
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
935 CheckOption incsearch
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
936
15263
ad065b8123e8 patch 8.1.0640: get E14 while typing command :tab with 'incsearch' set
Bram Moolenaar <Bram@vim.org>
parents: 15148
diff changeset
937 call test_override("char_avail", 1)
ad065b8123e8 patch 8.1.0640: get E14 while typing command :tab with 'incsearch' set
Bram Moolenaar <Bram@vim.org>
parents: 15148
diff changeset
938 new
ad065b8123e8 patch 8.1.0640: get E14 while typing command :tab with 'incsearch' set
Bram Moolenaar <Bram@vim.org>
parents: 15148
diff changeset
939 call setline(1, ['foo'])
ad065b8123e8 patch 8.1.0640: get E14 while typing command :tab with 'incsearch' set
Bram Moolenaar <Bram@vim.org>
parents: 15148
diff changeset
940 set incsearch
ad065b8123e8 patch 8.1.0640: get E14 while typing command :tab with 'incsearch' set
Bram Moolenaar <Bram@vim.org>
parents: 15148
diff changeset
941 " Test that error E14 does not occur in parsing command modifier.
ad065b8123e8 patch 8.1.0640: get E14 while typing command :tab with 'incsearch' set
Bram Moolenaar <Bram@vim.org>
parents: 15148
diff changeset
942 call feedkeys("V:tab", 'tx')
ad065b8123e8 patch 8.1.0640: get E14 while typing command :tab with 'incsearch' set
Bram Moolenaar <Bram@vim.org>
parents: 15148
diff changeset
943
ad065b8123e8 patch 8.1.0640: get E14 while typing command :tab with 'incsearch' set
Bram Moolenaar <Bram@vim.org>
parents: 15148
diff changeset
944 call Incsearch_cleanup()
ad065b8123e8 patch 8.1.0640: get E14 while typing command :tab with 'incsearch' set
Bram Moolenaar <Bram@vim.org>
parents: 15148
diff changeset
945 endfunc
ad065b8123e8 patch 8.1.0640: get E14 while typing command :tab with 'incsearch' set
Bram Moolenaar <Bram@vim.org>
parents: 15148
diff changeset
946
13790
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
947 func Test_incsearch_scrolling()
20625
116c7bd5e980 patch 8.2.0866: not enough tests for buffer writing
Bram Moolenaar <Bram@vim.org>
parents: 20199
diff changeset
948 CheckRunVimInTerminal
13790
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
949 call assert_equal(0, &scrolloff)
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
950 call writefile([
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
951 \ 'let dots = repeat(".", 120)',
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
952 \ 'set incsearch cmdheight=2 scrolloff=0',
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
953 \ 'call setline(1, [dots, dots, dots, "", "target", dots, dots])',
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
954 \ 'normal gg',
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
955 \ 'redraw',
30769
ae10b91ac6b3 patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 29277
diff changeset
956 \ ], 'Xscript', 'D')
13790
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
957 let buf = RunVimInTerminal('-S Xscript', {'rows': 9, 'cols': 70})
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
958 " Need to send one key at a time to force a redraw
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
959 call term_sendkeys(buf, '/')
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
960 sleep 100m
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
961 call term_sendkeys(buf, 't')
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
962 sleep 100m
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
963 call term_sendkeys(buf, 'a')
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
964 sleep 100m
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
965 call term_sendkeys(buf, 'r')
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
966 sleep 100m
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
967 call term_sendkeys(buf, 'g')
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
968 call VerifyScreenDump(buf, 'Test_incsearch_scrolling_01', {})
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
969
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
970 call term_sendkeys(buf, "\<Esc>")
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
971 call StopVimInTerminal(buf)
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
972 endfunc
dd6a63e3e7c4 patch 8.0.1767: with 'incsearch' text may jump up and down
Christian Brabandt <cb@256bit.org>
parents: 13132
diff changeset
973
14615
c6b41d47bac1 patch 8.1.0321: 'incsearch' regression: / highlights everything
Christian Brabandt <cb@256bit.org>
parents: 14613
diff changeset
974 func Test_incsearch_search_dump()
19705
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
975 CheckOption incsearch
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
976 CheckScreendump
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
977
14615
c6b41d47bac1 patch 8.1.0321: 'incsearch' regression: / highlights everything
Christian Brabandt <cb@256bit.org>
parents: 14613
diff changeset
978 call writefile([
c6b41d47bac1 patch 8.1.0321: 'incsearch' regression: / highlights everything
Christian Brabandt <cb@256bit.org>
parents: 14613
diff changeset
979 \ 'set incsearch hlsearch scrolloff=0',
c6b41d47bac1 patch 8.1.0321: 'incsearch' regression: / highlights everything
Christian Brabandt <cb@256bit.org>
parents: 14613
diff changeset
980 \ 'for n in range(1, 8)',
c6b41d47bac1 patch 8.1.0321: 'incsearch' regression: / highlights everything
Christian Brabandt <cb@256bit.org>
parents: 14613
diff changeset
981 \ ' call setline(n, "foo " . n)',
c6b41d47bac1 patch 8.1.0321: 'incsearch' regression: / highlights everything
Christian Brabandt <cb@256bit.org>
parents: 14613
diff changeset
982 \ 'endfor',
c6b41d47bac1 patch 8.1.0321: 'incsearch' regression: / highlights everything
Christian Brabandt <cb@256bit.org>
parents: 14613
diff changeset
983 \ '3',
30769
ae10b91ac6b3 patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 29277
diff changeset
984 \ ], 'Xis_search_script', 'D')
14615
c6b41d47bac1 patch 8.1.0321: 'incsearch' regression: / highlights everything
Christian Brabandt <cb@256bit.org>
parents: 14613
diff changeset
985 let buf = RunVimInTerminal('-S Xis_search_script', {'rows': 9, 'cols': 70})
c6b41d47bac1 patch 8.1.0321: 'incsearch' regression: / highlights everything
Christian Brabandt <cb@256bit.org>
parents: 14613
diff changeset
986 " Give Vim a chance to redraw to get rid of the spaces in line 2 caused by
c6b41d47bac1 patch 8.1.0321: 'incsearch' regression: / highlights everything
Christian Brabandt <cb@256bit.org>
parents: 14613
diff changeset
987 " the 'ambiwidth' check.
c6b41d47bac1 patch 8.1.0321: 'incsearch' regression: / highlights everything
Christian Brabandt <cb@256bit.org>
parents: 14613
diff changeset
988 sleep 100m
c6b41d47bac1 patch 8.1.0321: 'incsearch' regression: / highlights everything
Christian Brabandt <cb@256bit.org>
parents: 14613
diff changeset
989
c6b41d47bac1 patch 8.1.0321: 'incsearch' regression: / highlights everything
Christian Brabandt <cb@256bit.org>
parents: 14613
diff changeset
990 " Need to send one key at a time to force a redraw.
c6b41d47bac1 patch 8.1.0321: 'incsearch' regression: / highlights everything
Christian Brabandt <cb@256bit.org>
parents: 14613
diff changeset
991 call term_sendkeys(buf, '/fo')
c6b41d47bac1 patch 8.1.0321: 'incsearch' regression: / highlights everything
Christian Brabandt <cb@256bit.org>
parents: 14613
diff changeset
992 call VerifyScreenDump(buf, 'Test_incsearch_search_01', {})
c6b41d47bac1 patch 8.1.0321: 'incsearch' regression: / highlights everything
Christian Brabandt <cb@256bit.org>
parents: 14613
diff changeset
993 call term_sendkeys(buf, "\<Esc>")
c6b41d47bac1 patch 8.1.0321: 'incsearch' regression: / highlights everything
Christian Brabandt <cb@256bit.org>
parents: 14613
diff changeset
994 sleep 100m
c6b41d47bac1 patch 8.1.0321: 'incsearch' regression: / highlights everything
Christian Brabandt <cb@256bit.org>
parents: 14613
diff changeset
995
c6b41d47bac1 patch 8.1.0321: 'incsearch' regression: / highlights everything
Christian Brabandt <cb@256bit.org>
parents: 14613
diff changeset
996 call term_sendkeys(buf, '/\v')
c6b41d47bac1 patch 8.1.0321: 'incsearch' regression: / highlights everything
Christian Brabandt <cb@256bit.org>
parents: 14613
diff changeset
997 call VerifyScreenDump(buf, 'Test_incsearch_search_02', {})
c6b41d47bac1 patch 8.1.0321: 'incsearch' regression: / highlights everything
Christian Brabandt <cb@256bit.org>
parents: 14613
diff changeset
998 call term_sendkeys(buf, "\<Esc>")
c6b41d47bac1 patch 8.1.0321: 'incsearch' regression: / highlights everything
Christian Brabandt <cb@256bit.org>
parents: 14613
diff changeset
999
c6b41d47bac1 patch 8.1.0321: 'incsearch' regression: / highlights everything
Christian Brabandt <cb@256bit.org>
parents: 14613
diff changeset
1000 call StopVimInTerminal(buf)
c6b41d47bac1 patch 8.1.0321: 'incsearch' regression: / highlights everything
Christian Brabandt <cb@256bit.org>
parents: 14613
diff changeset
1001 endfunc
c6b41d47bac1 patch 8.1.0321: 'incsearch' regression: / highlights everything
Christian Brabandt <cb@256bit.org>
parents: 14613
diff changeset
1002
24000
bb2e921d2601 patch 8.2.2542: highlight of char beyond line end is not correct
Bram Moolenaar <Bram@vim.org>
parents: 23505
diff changeset
1003 func Test_hlsearch_dump()
bb2e921d2601 patch 8.2.2542: highlight of char beyond line end is not correct
Bram Moolenaar <Bram@vim.org>
parents: 23505
diff changeset
1004 CheckOption hlsearch
bb2e921d2601 patch 8.2.2542: highlight of char beyond line end is not correct
Bram Moolenaar <Bram@vim.org>
parents: 23505
diff changeset
1005 CheckScreendump
bb2e921d2601 patch 8.2.2542: highlight of char beyond line end is not correct
Bram Moolenaar <Bram@vim.org>
parents: 23505
diff changeset
1006
bb2e921d2601 patch 8.2.2542: highlight of char beyond line end is not correct
Bram Moolenaar <Bram@vim.org>
parents: 23505
diff changeset
1007 call writefile([
bb2e921d2601 patch 8.2.2542: highlight of char beyond line end is not correct
Bram Moolenaar <Bram@vim.org>
parents: 23505
diff changeset
1008 \ 'set hlsearch cursorline',
bb2e921d2601 patch 8.2.2542: highlight of char beyond line end is not correct
Bram Moolenaar <Bram@vim.org>
parents: 23505
diff changeset
1009 \ 'call setline(1, ["xxx", "xxx", "xxx"])',
bb2e921d2601 patch 8.2.2542: highlight of char beyond line end is not correct
Bram Moolenaar <Bram@vim.org>
parents: 23505
diff changeset
1010 \ '/.*',
bb2e921d2601 patch 8.2.2542: highlight of char beyond line end is not correct
Bram Moolenaar <Bram@vim.org>
parents: 23505
diff changeset
1011 \ '2',
30769
ae10b91ac6b3 patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 29277
diff changeset
1012 \ ], 'Xhlsearch_script', 'D')
24000
bb2e921d2601 patch 8.2.2542: highlight of char beyond line end is not correct
Bram Moolenaar <Bram@vim.org>
parents: 23505
diff changeset
1013 let buf = RunVimInTerminal('-S Xhlsearch_script', {'rows': 6, 'cols': 50})
bb2e921d2601 patch 8.2.2542: highlight of char beyond line end is not correct
Bram Moolenaar <Bram@vim.org>
parents: 23505
diff changeset
1014 call VerifyScreenDump(buf, 'Test_hlsearch_1', {})
bb2e921d2601 patch 8.2.2542: highlight of char beyond line end is not correct
Bram Moolenaar <Bram@vim.org>
parents: 23505
diff changeset
1015
bb2e921d2601 patch 8.2.2542: highlight of char beyond line end is not correct
Bram Moolenaar <Bram@vim.org>
parents: 23505
diff changeset
1016 call term_sendkeys(buf, "/\\_.*\<CR>")
bb2e921d2601 patch 8.2.2542: highlight of char beyond line end is not correct
Bram Moolenaar <Bram@vim.org>
parents: 23505
diff changeset
1017 call VerifyScreenDump(buf, 'Test_hlsearch_2', {})
bb2e921d2601 patch 8.2.2542: highlight of char beyond line end is not correct
Bram Moolenaar <Bram@vim.org>
parents: 23505
diff changeset
1018
bb2e921d2601 patch 8.2.2542: highlight of char beyond line end is not correct
Bram Moolenaar <Bram@vim.org>
parents: 23505
diff changeset
1019 call StopVimInTerminal(buf)
bb2e921d2601 patch 8.2.2542: highlight of char beyond line end is not correct
Bram Moolenaar <Bram@vim.org>
parents: 23505
diff changeset
1020 endfunc
bb2e921d2601 patch 8.2.2542: highlight of char beyond line end is not correct
Bram Moolenaar <Bram@vim.org>
parents: 23505
diff changeset
1021
24514
e3efa11b6a1e patch 8.2.2797: Search highlight disappears in the Visual area
Bram Moolenaar <Bram@vim.org>
parents: 24000
diff changeset
1022 func Test_hlsearch_and_visual()
e3efa11b6a1e patch 8.2.2797: Search highlight disappears in the Visual area
Bram Moolenaar <Bram@vim.org>
parents: 24000
diff changeset
1023 CheckOption hlsearch
e3efa11b6a1e patch 8.2.2797: Search highlight disappears in the Visual area
Bram Moolenaar <Bram@vim.org>
parents: 24000
diff changeset
1024 CheckScreendump
e3efa11b6a1e patch 8.2.2797: Search highlight disappears in the Visual area
Bram Moolenaar <Bram@vim.org>
parents: 24000
diff changeset
1025
e3efa11b6a1e patch 8.2.2797: Search highlight disappears in the Visual area
Bram Moolenaar <Bram@vim.org>
parents: 24000
diff changeset
1026 call writefile([
e3efa11b6a1e patch 8.2.2797: Search highlight disappears in the Visual area
Bram Moolenaar <Bram@vim.org>
parents: 24000
diff changeset
1027 \ 'set hlsearch',
e3efa11b6a1e patch 8.2.2797: Search highlight disappears in the Visual area
Bram Moolenaar <Bram@vim.org>
parents: 24000
diff changeset
1028 \ 'call setline(1, repeat(["xxx yyy zzz"], 3))',
e3efa11b6a1e patch 8.2.2797: Search highlight disappears in the Visual area
Bram Moolenaar <Bram@vim.org>
parents: 24000
diff changeset
1029 \ 'hi Search cterm=bold',
e3efa11b6a1e patch 8.2.2797: Search highlight disappears in the Visual area
Bram Moolenaar <Bram@vim.org>
parents: 24000
diff changeset
1030 \ '/yyy',
e3efa11b6a1e patch 8.2.2797: Search highlight disappears in the Visual area
Bram Moolenaar <Bram@vim.org>
parents: 24000
diff changeset
1031 \ 'call cursor(1, 6)',
30769
ae10b91ac6b3 patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 29277
diff changeset
1032 \ ], 'Xhlvisual_script', 'D')
24514
e3efa11b6a1e patch 8.2.2797: Search highlight disappears in the Visual area
Bram Moolenaar <Bram@vim.org>
parents: 24000
diff changeset
1033 let buf = RunVimInTerminal('-S Xhlvisual_script', {'rows': 6, 'cols': 40})
e3efa11b6a1e patch 8.2.2797: Search highlight disappears in the Visual area
Bram Moolenaar <Bram@vim.org>
parents: 24000
diff changeset
1034 call term_sendkeys(buf, "vjj")
e3efa11b6a1e patch 8.2.2797: Search highlight disappears in the Visual area
Bram Moolenaar <Bram@vim.org>
parents: 24000
diff changeset
1035 call VerifyScreenDump(buf, 'Test_hlsearch_visual_1', {})
e3efa11b6a1e patch 8.2.2797: Search highlight disappears in the Visual area
Bram Moolenaar <Bram@vim.org>
parents: 24000
diff changeset
1036 call term_sendkeys(buf, "\<Esc>")
e3efa11b6a1e patch 8.2.2797: Search highlight disappears in the Visual area
Bram Moolenaar <Bram@vim.org>
parents: 24000
diff changeset
1037
e3efa11b6a1e patch 8.2.2797: Search highlight disappears in the Visual area
Bram Moolenaar <Bram@vim.org>
parents: 24000
diff changeset
1038 call StopVimInTerminal(buf)
e3efa11b6a1e patch 8.2.2797: Search highlight disappears in the Visual area
Bram Moolenaar <Bram@vim.org>
parents: 24000
diff changeset
1039 endfunc
e3efa11b6a1e patch 8.2.2797: Search highlight disappears in the Visual area
Bram Moolenaar <Bram@vim.org>
parents: 24000
diff changeset
1040
24745
b1fa3f005c93 patch 8.2.2911: pattern "%V" does not match all of block selection
Bram Moolenaar <Bram@vim.org>
parents: 24693
diff changeset
1041 func Test_hlsearch_block_visual_match()
b1fa3f005c93 patch 8.2.2911: pattern "%V" does not match all of block selection
Bram Moolenaar <Bram@vim.org>
parents: 24693
diff changeset
1042 CheckScreendump
b1fa3f005c93 patch 8.2.2911: pattern "%V" does not match all of block selection
Bram Moolenaar <Bram@vim.org>
parents: 24693
diff changeset
1043
b1fa3f005c93 patch 8.2.2911: pattern "%V" does not match all of block selection
Bram Moolenaar <Bram@vim.org>
parents: 24693
diff changeset
1044 let lines =<< trim END
b1fa3f005c93 patch 8.2.2911: pattern "%V" does not match all of block selection
Bram Moolenaar <Bram@vim.org>
parents: 24693
diff changeset
1045 set hlsearch
b1fa3f005c93 patch 8.2.2911: pattern "%V" does not match all of block selection
Bram Moolenaar <Bram@vim.org>
parents: 24693
diff changeset
1046 call setline(1, ['aa', 'bbbb', 'cccccc'])
b1fa3f005c93 patch 8.2.2911: pattern "%V" does not match all of block selection
Bram Moolenaar <Bram@vim.org>
parents: 24693
diff changeset
1047 END
30769
ae10b91ac6b3 patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 29277
diff changeset
1048 call writefile(lines, 'Xhlsearch_block', 'D')
24745
b1fa3f005c93 patch 8.2.2911: pattern "%V" does not match all of block selection
Bram Moolenaar <Bram@vim.org>
parents: 24693
diff changeset
1049 let buf = RunVimInTerminal('-S Xhlsearch_block', {'rows': 9, 'cols': 60})
b1fa3f005c93 patch 8.2.2911: pattern "%V" does not match all of block selection
Bram Moolenaar <Bram@vim.org>
parents: 24693
diff changeset
1050
b1fa3f005c93 patch 8.2.2911: pattern "%V" does not match all of block selection
Bram Moolenaar <Bram@vim.org>
parents: 24693
diff changeset
1051 call term_sendkeys(buf, "G\<C-V>$kk\<Esc>")
b1fa3f005c93 patch 8.2.2911: pattern "%V" does not match all of block selection
Bram Moolenaar <Bram@vim.org>
parents: 24693
diff changeset
1052 sleep 100m
b1fa3f005c93 patch 8.2.2911: pattern "%V" does not match all of block selection
Bram Moolenaar <Bram@vim.org>
parents: 24693
diff changeset
1053 call term_sendkeys(buf, "/\\%V\<CR>")
b1fa3f005c93 patch 8.2.2911: pattern "%V" does not match all of block selection
Bram Moolenaar <Bram@vim.org>
parents: 24693
diff changeset
1054 sleep 100m
b1fa3f005c93 patch 8.2.2911: pattern "%V" does not match all of block selection
Bram Moolenaar <Bram@vim.org>
parents: 24693
diff changeset
1055 call VerifyScreenDump(buf, 'Test_hlsearch_block_visual_match', {})
b1fa3f005c93 patch 8.2.2911: pattern "%V" does not match all of block selection
Bram Moolenaar <Bram@vim.org>
parents: 24693
diff changeset
1056
b1fa3f005c93 patch 8.2.2911: pattern "%V" does not match all of block selection
Bram Moolenaar <Bram@vim.org>
parents: 24693
diff changeset
1057 call StopVimInTerminal(buf)
b1fa3f005c93 patch 8.2.2911: pattern "%V" does not match all of block selection
Bram Moolenaar <Bram@vim.org>
parents: 24693
diff changeset
1058 endfunc
b1fa3f005c93 patch 8.2.2911: pattern "%V" does not match all of block selection
Bram Moolenaar <Bram@vim.org>
parents: 24693
diff changeset
1059
14524
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
1060 func Test_incsearch_substitute()
19705
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
1061 CheckOption incsearch
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
1062
14524
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
1063 call test_override("char_avail", 1)
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
1064 new
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
1065 set incsearch
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
1066 for n in range(1, 10)
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
1067 call setline(n, 'foo ' . n)
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
1068 endfor
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
1069 4
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
1070 call feedkeys(":.,.+2s/foo\<BS>o\<BS>o/xxx\<cr>", 'tx')
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
1071 call assert_equal('foo 3', getline(3))
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
1072 call assert_equal('xxx 4', getline(4))
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
1073 call assert_equal('xxx 5', getline(5))
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
1074 call assert_equal('xxx 6', getline(6))
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
1075 call assert_equal('foo 7', getline(7))
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
1076
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
1077 call Incsearch_cleanup()
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
1078 endfunc
e36d6e01708c patch 8.1.0275: 'incsearch' with :s doesn't start at cursor line
Christian Brabandt <cb@256bit.org>
parents: 14522
diff changeset
1079
22478
5193420617f1 patch 8.2.1787: crash with 'incsearch' and very long line
Bram Moolenaar <Bram@vim.org>
parents: 22405
diff changeset
1080 func Test_incsearch_substitute_long_line()
5193420617f1 patch 8.2.1787: crash with 'incsearch' and very long line
Bram Moolenaar <Bram@vim.org>
parents: 22405
diff changeset
1081 new
5193420617f1 patch 8.2.1787: crash with 'incsearch' and very long line
Bram Moolenaar <Bram@vim.org>
parents: 22405
diff changeset
1082 call test_override("char_avail", 1)
5193420617f1 patch 8.2.1787: crash with 'incsearch' and very long line
Bram Moolenaar <Bram@vim.org>
parents: 22405
diff changeset
1083 set incsearch
5193420617f1 patch 8.2.1787: crash with 'incsearch' and very long line
Bram Moolenaar <Bram@vim.org>
parents: 22405
diff changeset
1084
5193420617f1 patch 8.2.1787: crash with 'incsearch' and very long line
Bram Moolenaar <Bram@vim.org>
parents: 22405
diff changeset
1085 call repeat('x', 100000)->setline(1)
5193420617f1 patch 8.2.1787: crash with 'incsearch' and very long line
Bram Moolenaar <Bram@vim.org>
parents: 22405
diff changeset
1086 call feedkeys(':s/\%c', 'xt')
5193420617f1 patch 8.2.1787: crash with 'incsearch' and very long line
Bram Moolenaar <Bram@vim.org>
parents: 22405
diff changeset
1087 redraw
5193420617f1 patch 8.2.1787: crash with 'incsearch' and very long line
Bram Moolenaar <Bram@vim.org>
parents: 22405
diff changeset
1088 call feedkeys("\<Esc>", 'xt')
5193420617f1 patch 8.2.1787: crash with 'incsearch' and very long line
Bram Moolenaar <Bram@vim.org>
parents: 22405
diff changeset
1089
5193420617f1 patch 8.2.1787: crash with 'incsearch' and very long line
Bram Moolenaar <Bram@vim.org>
parents: 22405
diff changeset
1090 call Incsearch_cleanup()
5193420617f1 patch 8.2.1787: crash with 'incsearch' and very long line
Bram Moolenaar <Bram@vim.org>
parents: 22405
diff changeset
1091 bwipe!
5193420617f1 patch 8.2.1787: crash with 'incsearch' and very long line
Bram Moolenaar <Bram@vim.org>
parents: 22405
diff changeset
1092 endfunc
5193420617f1 patch 8.2.1787: crash with 'incsearch' and very long line
Bram Moolenaar <Bram@vim.org>
parents: 22405
diff changeset
1093
28399
d395fadbaf67 patch 8.2.4724: current instance of last search pattern not easily spotted
Bram Moolenaar <Bram@vim.org>
parents: 26907
diff changeset
1094 func Test_hlsearch_cursearch()
d395fadbaf67 patch 8.2.4724: current instance of last search pattern not easily spotted
Bram Moolenaar <Bram@vim.org>
parents: 26907
diff changeset
1095 CheckScreendump
d395fadbaf67 patch 8.2.4724: current instance of last search pattern not easily spotted
Bram Moolenaar <Bram@vim.org>
parents: 26907
diff changeset
1096
d395fadbaf67 patch 8.2.4724: current instance of last search pattern not easily spotted
Bram Moolenaar <Bram@vim.org>
parents: 26907
diff changeset
1097 let lines =<< trim END
d395fadbaf67 patch 8.2.4724: current instance of last search pattern not easily spotted
Bram Moolenaar <Bram@vim.org>
parents: 26907
diff changeset
1098 set hlsearch scrolloff=0
28562
e96111a91a21 patch 8.2.4805: CurSearch used for all matches in current line
Bram Moolenaar <Bram@vim.org>
parents: 28469
diff changeset
1099 call setline(1, ['one', 'foo', 'bar', 'baz', 'foo the foo and foo', 'bar'])
28399
d395fadbaf67 patch 8.2.4724: current instance of last search pattern not easily spotted
Bram Moolenaar <Bram@vim.org>
parents: 26907
diff changeset
1100 hi Search ctermbg=yellow
d395fadbaf67 patch 8.2.4724: current instance of last search pattern not easily spotted
Bram Moolenaar <Bram@vim.org>
parents: 26907
diff changeset
1101 hi CurSearch ctermbg=blue
d395fadbaf67 patch 8.2.4724: current instance of last search pattern not easily spotted
Bram Moolenaar <Bram@vim.org>
parents: 26907
diff changeset
1102 END
30769
ae10b91ac6b3 patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 29277
diff changeset
1103 call writefile(lines, 'Xhlsearch_cursearch', 'D')
28399
d395fadbaf67 patch 8.2.4724: current instance of last search pattern not easily spotted
Bram Moolenaar <Bram@vim.org>
parents: 26907
diff changeset
1104 let buf = RunVimInTerminal('-S Xhlsearch_cursearch', {'rows': 9, 'cols': 60})
d395fadbaf67 patch 8.2.4724: current instance of last search pattern not easily spotted
Bram Moolenaar <Bram@vim.org>
parents: 26907
diff changeset
1105
d395fadbaf67 patch 8.2.4724: current instance of last search pattern not easily spotted
Bram Moolenaar <Bram@vim.org>
parents: 26907
diff changeset
1106 call term_sendkeys(buf, "gg/foo\<CR>")
d395fadbaf67 patch 8.2.4724: current instance of last search pattern not easily spotted
Bram Moolenaar <Bram@vim.org>
parents: 26907
diff changeset
1107 call VerifyScreenDump(buf, 'Test_hlsearch_cursearch_single_line_1', {})
d395fadbaf67 patch 8.2.4724: current instance of last search pattern not easily spotted
Bram Moolenaar <Bram@vim.org>
parents: 26907
diff changeset
1108
d395fadbaf67 patch 8.2.4724: current instance of last search pattern not easily spotted
Bram Moolenaar <Bram@vim.org>
parents: 26907
diff changeset
1109 call term_sendkeys(buf, "n")
d395fadbaf67 patch 8.2.4724: current instance of last search pattern not easily spotted
Bram Moolenaar <Bram@vim.org>
parents: 26907
diff changeset
1110 call VerifyScreenDump(buf, 'Test_hlsearch_cursearch_single_line_2', {})
d395fadbaf67 patch 8.2.4724: current instance of last search pattern not easily spotted
Bram Moolenaar <Bram@vim.org>
parents: 26907
diff changeset
1111
28562
e96111a91a21 patch 8.2.4805: CurSearch used for all matches in current line
Bram Moolenaar <Bram@vim.org>
parents: 28469
diff changeset
1112 call term_sendkeys(buf, "n")
e96111a91a21 patch 8.2.4805: CurSearch used for all matches in current line
Bram Moolenaar <Bram@vim.org>
parents: 28469
diff changeset
1113 call VerifyScreenDump(buf, 'Test_hlsearch_cursearch_single_line_2a', {})
e96111a91a21 patch 8.2.4805: CurSearch used for all matches in current line
Bram Moolenaar <Bram@vim.org>
parents: 28469
diff changeset
1114
e96111a91a21 patch 8.2.4805: CurSearch used for all matches in current line
Bram Moolenaar <Bram@vim.org>
parents: 28469
diff changeset
1115 call term_sendkeys(buf, "n")
e96111a91a21 patch 8.2.4805: CurSearch used for all matches in current line
Bram Moolenaar <Bram@vim.org>
parents: 28469
diff changeset
1116 call VerifyScreenDump(buf, 'Test_hlsearch_cursearch_single_line_2b', {})
e96111a91a21 patch 8.2.4805: CurSearch used for all matches in current line
Bram Moolenaar <Bram@vim.org>
parents: 28469
diff changeset
1117
e96111a91a21 patch 8.2.4805: CurSearch used for all matches in current line
Bram Moolenaar <Bram@vim.org>
parents: 28469
diff changeset
1118 call term_sendkeys(buf, ":call setline(5, 'foo')\<CR>")
e96111a91a21 patch 8.2.4805: CurSearch used for all matches in current line
Bram Moolenaar <Bram@vim.org>
parents: 28469
diff changeset
1119 call term_sendkeys(buf, "0?\<CR>")
28399
d395fadbaf67 patch 8.2.4724: current instance of last search pattern not easily spotted
Bram Moolenaar <Bram@vim.org>
parents: 26907
diff changeset
1120 call VerifyScreenDump(buf, 'Test_hlsearch_cursearch_single_line_3', {})
d395fadbaf67 patch 8.2.4724: current instance of last search pattern not easily spotted
Bram Moolenaar <Bram@vim.org>
parents: 26907
diff changeset
1121
d395fadbaf67 patch 8.2.4724: current instance of last search pattern not easily spotted
Bram Moolenaar <Bram@vim.org>
parents: 26907
diff changeset
1122 call term_sendkeys(buf, "gg/foo\\nbar\<CR>")
28469
9ff0e5a29037 patch 8.2.4759: CurSearch highlight does not work for multi-line match
Bram Moolenaar <Bram@vim.org>
parents: 28399
diff changeset
1123 call VerifyScreenDump(buf, 'Test_hlsearch_cursearch_multiple_line_1', {})
9ff0e5a29037 patch 8.2.4759: CurSearch highlight does not work for multi-line match
Bram Moolenaar <Bram@vim.org>
parents: 28399
diff changeset
1124
9ff0e5a29037 patch 8.2.4759: CurSearch highlight does not work for multi-line match
Bram Moolenaar <Bram@vim.org>
parents: 28399
diff changeset
1125 call term_sendkeys(buf, ":call setline(1, ['---', 'abcdefg', 'hijkl', '---', 'abcdefg', 'hijkl'])\<CR>")
9ff0e5a29037 patch 8.2.4759: CurSearch highlight does not work for multi-line match
Bram Moolenaar <Bram@vim.org>
parents: 28399
diff changeset
1126 call term_sendkeys(buf, "gg/efg\\nhij\<CR>")
9ff0e5a29037 patch 8.2.4759: CurSearch highlight does not work for multi-line match
Bram Moolenaar <Bram@vim.org>
parents: 28399
diff changeset
1127 call VerifyScreenDump(buf, 'Test_hlsearch_cursearch_multiple_line_2', {})
9ff0e5a29037 patch 8.2.4759: CurSearch highlight does not work for multi-line match
Bram Moolenaar <Bram@vim.org>
parents: 28399
diff changeset
1128 call term_sendkeys(buf, "h\<C-L>")
9ff0e5a29037 patch 8.2.4759: CurSearch highlight does not work for multi-line match
Bram Moolenaar <Bram@vim.org>
parents: 28399
diff changeset
1129 call VerifyScreenDump(buf, 'Test_hlsearch_cursearch_multiple_line_3', {})
9ff0e5a29037 patch 8.2.4759: CurSearch highlight does not work for multi-line match
Bram Moolenaar <Bram@vim.org>
parents: 28399
diff changeset
1130 call term_sendkeys(buf, "j\<C-L>")
9ff0e5a29037 patch 8.2.4759: CurSearch highlight does not work for multi-line match
Bram Moolenaar <Bram@vim.org>
parents: 28399
diff changeset
1131 call VerifyScreenDump(buf, 'Test_hlsearch_cursearch_multiple_line_4', {})
9ff0e5a29037 patch 8.2.4759: CurSearch highlight does not work for multi-line match
Bram Moolenaar <Bram@vim.org>
parents: 28399
diff changeset
1132 call term_sendkeys(buf, "h\<C-L>")
9ff0e5a29037 patch 8.2.4759: CurSearch highlight does not work for multi-line match
Bram Moolenaar <Bram@vim.org>
parents: 28399
diff changeset
1133 call VerifyScreenDump(buf, 'Test_hlsearch_cursearch_multiple_line_5', {})
28399
d395fadbaf67 patch 8.2.4724: current instance of last search pattern not easily spotted
Bram Moolenaar <Bram@vim.org>
parents: 26907
diff changeset
1134
29050
a2710736125a patch 8.2.5047: CurSearch highlight is often wrong
Bram Moolenaar <Bram@vim.org>
parents: 28562
diff changeset
1135 " check clearing CurSearch when using it for another match
a2710736125a patch 8.2.5047: CurSearch highlight is often wrong
Bram Moolenaar <Bram@vim.org>
parents: 28562
diff changeset
1136 call term_sendkeys(buf, "G?^abcd\<CR>Y")
a2710736125a patch 8.2.5047: CurSearch highlight is often wrong
Bram Moolenaar <Bram@vim.org>
parents: 28562
diff changeset
1137 call term_sendkeys(buf, "kkP")
a2710736125a patch 8.2.5047: CurSearch highlight is often wrong
Bram Moolenaar <Bram@vim.org>
parents: 28562
diff changeset
1138 call VerifyScreenDump(buf, 'Test_hlsearch_cursearch_changed_1', {})
a2710736125a patch 8.2.5047: CurSearch highlight is often wrong
Bram Moolenaar <Bram@vim.org>
parents: 28562
diff changeset
1139
28399
d395fadbaf67 patch 8.2.4724: current instance of last search pattern not easily spotted
Bram Moolenaar <Bram@vim.org>
parents: 26907
diff changeset
1140 call StopVimInTerminal(buf)
d395fadbaf67 patch 8.2.4724: current instance of last search pattern not easily spotted
Bram Moolenaar <Bram@vim.org>
parents: 26907
diff changeset
1141 endfunc
d395fadbaf67 patch 8.2.4724: current instance of last search pattern not easily spotted
Bram Moolenaar <Bram@vim.org>
parents: 26907
diff changeset
1142
14526
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
1143 " Similar to Test_incsearch_substitute() but with a screendump halfway.
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
1144 func Test_incsearch_substitute_dump()
19705
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
1145 CheckOption incsearch
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
1146 CheckScreendump
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
1147
14526
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
1148 call writefile([
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
1149 \ 'set incsearch hlsearch scrolloff=0',
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
1150 \ 'for n in range(1, 10)',
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
1151 \ ' call setline(n, "foo " . n)',
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
1152 \ 'endfor',
14542
116a01c73fd8 patch 8.1.0284: 'cursorline' highlighting wrong with 'incsearch'
Christian Brabandt <cb@256bit.org>
parents: 14538
diff changeset
1153 \ 'call setline(11, "bar 11")',
14526
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
1154 \ '3',
30769
ae10b91ac6b3 patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 29277
diff changeset
1155 \ ], 'Xis_subst_script', 'D')
14526
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
1156 let buf = RunVimInTerminal('-S Xis_subst_script', {'rows': 9, 'cols': 70})
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
1157 " Give Vim a chance to redraw to get rid of the spaces in line 2 caused by
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
1158 " the 'ambiwidth' check.
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
1159 sleep 100m
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
1160
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
1161 " Need to send one key at a time to force a redraw.
14528
58ca11610819 patch 8.1.0277: 'incsearch' highlighting wrong in a few cases
Christian Brabandt <cb@256bit.org>
parents: 14526
diff changeset
1162 " Select three lines at the cursor with typed pattern.
14526
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
1163 call term_sendkeys(buf, ':.,.+2s/')
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
1164 sleep 100m
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
1165 call term_sendkeys(buf, 'f')
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
1166 sleep 100m
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
1167 call term_sendkeys(buf, 'o')
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
1168 sleep 100m
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
1169 call term_sendkeys(buf, 'o')
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
1170 call VerifyScreenDump(buf, 'Test_incsearch_substitute_01', {})
14528
58ca11610819 patch 8.1.0277: 'incsearch' highlighting wrong in a few cases
Christian Brabandt <cb@256bit.org>
parents: 14526
diff changeset
1171 call term_sendkeys(buf, "\<Esc>")
58ca11610819 patch 8.1.0277: 'incsearch' highlighting wrong in a few cases
Christian Brabandt <cb@256bit.org>
parents: 14526
diff changeset
1172
58ca11610819 patch 8.1.0277: 'incsearch' highlighting wrong in a few cases
Christian Brabandt <cb@256bit.org>
parents: 14526
diff changeset
1173 " Select three lines at the cursor using previous pattern.
58ca11610819 patch 8.1.0277: 'incsearch' highlighting wrong in a few cases
Christian Brabandt <cb@256bit.org>
parents: 14526
diff changeset
1174 call term_sendkeys(buf, "/foo\<CR>")
58ca11610819 patch 8.1.0277: 'incsearch' highlighting wrong in a few cases
Christian Brabandt <cb@256bit.org>
parents: 14526
diff changeset
1175 sleep 100m
58ca11610819 patch 8.1.0277: 'incsearch' highlighting wrong in a few cases
Christian Brabandt <cb@256bit.org>
parents: 14526
diff changeset
1176 call term_sendkeys(buf, ':.,.+2s//')
58ca11610819 patch 8.1.0277: 'incsearch' highlighting wrong in a few cases
Christian Brabandt <cb@256bit.org>
parents: 14526
diff changeset
1177 call VerifyScreenDump(buf, 'Test_incsearch_substitute_02', {})
58ca11610819 patch 8.1.0277: 'incsearch' highlighting wrong in a few cases
Christian Brabandt <cb@256bit.org>
parents: 14526
diff changeset
1178
58ca11610819 patch 8.1.0277: 'incsearch' highlighting wrong in a few cases
Christian Brabandt <cb@256bit.org>
parents: 14526
diff changeset
1179 " Deleting last slash should remove the match.
58ca11610819 patch 8.1.0277: 'incsearch' highlighting wrong in a few cases
Christian Brabandt <cb@256bit.org>
parents: 14526
diff changeset
1180 call term_sendkeys(buf, "\<BS>")
58ca11610819 patch 8.1.0277: 'incsearch' highlighting wrong in a few cases
Christian Brabandt <cb@256bit.org>
parents: 14526
diff changeset
1181 call VerifyScreenDump(buf, 'Test_incsearch_substitute_03', {})
14530
60e0022e6e5d patch 8.1.0278: 'incsearch' highlighting does not accept reverse range
Christian Brabandt <cb@256bit.org>
parents: 14528
diff changeset
1182 call term_sendkeys(buf, "\<Esc>")
60e0022e6e5d patch 8.1.0278: 'incsearch' highlighting does not accept reverse range
Christian Brabandt <cb@256bit.org>
parents: 14528
diff changeset
1183
60e0022e6e5d patch 8.1.0278: 'incsearch' highlighting does not accept reverse range
Christian Brabandt <cb@256bit.org>
parents: 14528
diff changeset
1184 " Reverse range is accepted
60e0022e6e5d patch 8.1.0278: 'incsearch' highlighting does not accept reverse range
Christian Brabandt <cb@256bit.org>
parents: 14528
diff changeset
1185 call term_sendkeys(buf, ':5,2s/foo')
60e0022e6e5d patch 8.1.0278: 'incsearch' highlighting does not accept reverse range
Christian Brabandt <cb@256bit.org>
parents: 14528
diff changeset
1186 call VerifyScreenDump(buf, 'Test_incsearch_substitute_04', {})
14532
58cc47fae12e patch 8.1.0279: 'incsearch' highlighting does not skip white space
Christian Brabandt <cb@256bit.org>
parents: 14530
diff changeset
1187 call term_sendkeys(buf, "\<Esc>")
14526
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
1188
14532
58cc47fae12e patch 8.1.0279: 'incsearch' highlighting does not skip white space
Christian Brabandt <cb@256bit.org>
parents: 14530
diff changeset
1189 " White space after the command is skipped
58cc47fae12e patch 8.1.0279: 'incsearch' highlighting does not skip white space
Christian Brabandt <cb@256bit.org>
parents: 14530
diff changeset
1190 call term_sendkeys(buf, ':2,3sub /fo')
58cc47fae12e patch 8.1.0279: 'incsearch' highlighting does not skip white space
Christian Brabandt <cb@256bit.org>
parents: 14530
diff changeset
1191 call VerifyScreenDump(buf, 'Test_incsearch_substitute_05', {})
14526
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
1192 call term_sendkeys(buf, "\<Esc>")
14532
58cc47fae12e patch 8.1.0279: 'incsearch' highlighting does not skip white space
Christian Brabandt <cb@256bit.org>
parents: 14530
diff changeset
1193
14538
213f1a519378 patch 8.1.0282: 'incsearch' does not work with command modifiers
Christian Brabandt <cb@256bit.org>
parents: 14534
diff changeset
1194 " Command modifiers are skipped
213f1a519378 patch 8.1.0282: 'incsearch' does not work with command modifiers
Christian Brabandt <cb@256bit.org>
parents: 14534
diff changeset
1195 call term_sendkeys(buf, ':above below browse botr confirm keepmar keepalt keeppat keepjum filter xxx hide lockm leftabove noau noswap rightbel sandbox silent silent! $tab top unsil vert verbose 4,5s/fo.')
213f1a519378 patch 8.1.0282: 'incsearch' does not work with command modifiers
Christian Brabandt <cb@256bit.org>
parents: 14534
diff changeset
1196 call VerifyScreenDump(buf, 'Test_incsearch_substitute_06', {})
213f1a519378 patch 8.1.0282: 'incsearch' does not work with command modifiers
Christian Brabandt <cb@256bit.org>
parents: 14534
diff changeset
1197 call term_sendkeys(buf, "\<Esc>")
213f1a519378 patch 8.1.0282: 'incsearch' does not work with command modifiers
Christian Brabandt <cb@256bit.org>
parents: 14534
diff changeset
1198
14542
116a01c73fd8 patch 8.1.0284: 'cursorline' highlighting wrong with 'incsearch'
Christian Brabandt <cb@256bit.org>
parents: 14538
diff changeset
1199 " Cursorline highlighting at match
116a01c73fd8 patch 8.1.0284: 'cursorline' highlighting wrong with 'incsearch'
Christian Brabandt <cb@256bit.org>
parents: 14538
diff changeset
1200 call term_sendkeys(buf, ":set cursorline\<CR>")
116a01c73fd8 patch 8.1.0284: 'cursorline' highlighting wrong with 'incsearch'
Christian Brabandt <cb@256bit.org>
parents: 14538
diff changeset
1201 call term_sendkeys(buf, 'G9G')
116a01c73fd8 patch 8.1.0284: 'cursorline' highlighting wrong with 'incsearch'
Christian Brabandt <cb@256bit.org>
parents: 14538
diff changeset
1202 call term_sendkeys(buf, ':9,11s/bar')
116a01c73fd8 patch 8.1.0284: 'cursorline' highlighting wrong with 'incsearch'
Christian Brabandt <cb@256bit.org>
parents: 14538
diff changeset
1203 call VerifyScreenDump(buf, 'Test_incsearch_substitute_07', {})
116a01c73fd8 patch 8.1.0284: 'cursorline' highlighting wrong with 'incsearch'
Christian Brabandt <cb@256bit.org>
parents: 14538
diff changeset
1204 call term_sendkeys(buf, "\<Esc>")
116a01c73fd8 patch 8.1.0284: 'cursorline' highlighting wrong with 'incsearch'
Christian Brabandt <cb@256bit.org>
parents: 14538
diff changeset
1205
116a01c73fd8 patch 8.1.0284: 'cursorline' highlighting wrong with 'incsearch'
Christian Brabandt <cb@256bit.org>
parents: 14538
diff changeset
1206 " Cursorline highlighting at cursor when no match
116a01c73fd8 patch 8.1.0284: 'cursorline' highlighting wrong with 'incsearch'
Christian Brabandt <cb@256bit.org>
parents: 14538
diff changeset
1207 call term_sendkeys(buf, ':9,10s/bar')
116a01c73fd8 patch 8.1.0284: 'cursorline' highlighting wrong with 'incsearch'
Christian Brabandt <cb@256bit.org>
parents: 14538
diff changeset
1208 call VerifyScreenDump(buf, 'Test_incsearch_substitute_08', {})
116a01c73fd8 patch 8.1.0284: 'cursorline' highlighting wrong with 'incsearch'
Christian Brabandt <cb@256bit.org>
parents: 14538
diff changeset
1209 call term_sendkeys(buf, "\<Esc>")
116a01c73fd8 patch 8.1.0284: 'cursorline' highlighting wrong with 'incsearch'
Christian Brabandt <cb@256bit.org>
parents: 14538
diff changeset
1210
14613
3f9b73cc8adb patch 8.1.0320: too much 'incsearch' highlight for pat matching everything
Christian Brabandt <cb@256bit.org>
parents: 14563
diff changeset
1211 " Only \v handled as empty pattern, does not move cursor
3f9b73cc8adb patch 8.1.0320: too much 'incsearch' highlight for pat matching everything
Christian Brabandt <cb@256bit.org>
parents: 14563
diff changeset
1212 call term_sendkeys(buf, '3G4G')
3f9b73cc8adb patch 8.1.0320: too much 'incsearch' highlight for pat matching everything
Christian Brabandt <cb@256bit.org>
parents: 14563
diff changeset
1213 call term_sendkeys(buf, ":nohlsearch\<CR>")
3f9b73cc8adb patch 8.1.0320: too much 'incsearch' highlight for pat matching everything
Christian Brabandt <cb@256bit.org>
parents: 14563
diff changeset
1214 call term_sendkeys(buf, ':6,7s/\v')
3f9b73cc8adb patch 8.1.0320: too much 'incsearch' highlight for pat matching everything
Christian Brabandt <cb@256bit.org>
parents: 14563
diff changeset
1215 call VerifyScreenDump(buf, 'Test_incsearch_substitute_09', {})
3f9b73cc8adb patch 8.1.0320: too much 'incsearch' highlight for pat matching everything
Christian Brabandt <cb@256bit.org>
parents: 14563
diff changeset
1216 call term_sendkeys(buf, "\<Esc>")
3f9b73cc8adb patch 8.1.0320: too much 'incsearch' highlight for pat matching everything
Christian Brabandt <cb@256bit.org>
parents: 14563
diff changeset
1217
14652
f3b183c3d3e2 patch 8.1.0339: wrong highlight when 'incsearch' set and cancelling :s
Christian Brabandt <cb@256bit.org>
parents: 14615
diff changeset
1218 call term_sendkeys(buf, ":set nocursorline\<CR>")
f3b183c3d3e2 patch 8.1.0339: wrong highlight when 'incsearch' set and cancelling :s
Christian Brabandt <cb@256bit.org>
parents: 14615
diff changeset
1219
f3b183c3d3e2 patch 8.1.0339: wrong highlight when 'incsearch' set and cancelling :s
Christian Brabandt <cb@256bit.org>
parents: 14615
diff changeset
1220 " All matches are highlighted for 'hlsearch' after the incsearch canceled
f3b183c3d3e2 patch 8.1.0339: wrong highlight when 'incsearch' set and cancelling :s
Christian Brabandt <cb@256bit.org>
parents: 14615
diff changeset
1221 call term_sendkeys(buf, "1G*")
f3b183c3d3e2 patch 8.1.0339: wrong highlight when 'incsearch' set and cancelling :s
Christian Brabandt <cb@256bit.org>
parents: 14615
diff changeset
1222 call term_sendkeys(buf, ":2,5s/foo")
f3b183c3d3e2 patch 8.1.0339: wrong highlight when 'incsearch' set and cancelling :s
Christian Brabandt <cb@256bit.org>
parents: 14615
diff changeset
1223 sleep 100m
f3b183c3d3e2 patch 8.1.0339: wrong highlight when 'incsearch' set and cancelling :s
Christian Brabandt <cb@256bit.org>
parents: 14615
diff changeset
1224 call term_sendkeys(buf, "\<Esc>")
f3b183c3d3e2 patch 8.1.0339: wrong highlight when 'incsearch' set and cancelling :s
Christian Brabandt <cb@256bit.org>
parents: 14615
diff changeset
1225 call VerifyScreenDump(buf, 'Test_incsearch_substitute_10', {})
f3b183c3d3e2 patch 8.1.0339: wrong highlight when 'incsearch' set and cancelling :s
Christian Brabandt <cb@256bit.org>
parents: 14615
diff changeset
1226
14774
5e5f2d824189 patch 8.1.0399: 'hlsearch' highlight remains in other window
Christian Brabandt <cb@256bit.org>
parents: 14760
diff changeset
1227 call term_sendkeys(buf, ":split\<CR>")
5e5f2d824189 patch 8.1.0399: 'hlsearch' highlight remains in other window
Christian Brabandt <cb@256bit.org>
parents: 14760
diff changeset
1228 call term_sendkeys(buf, ":let @/ = 'xyz'\<CR>")
5e5f2d824189 patch 8.1.0399: 'hlsearch' highlight remains in other window
Christian Brabandt <cb@256bit.org>
parents: 14760
diff changeset
1229 call term_sendkeys(buf, ":%s/.")
5e5f2d824189 patch 8.1.0399: 'hlsearch' highlight remains in other window
Christian Brabandt <cb@256bit.org>
parents: 14760
diff changeset
1230 call VerifyScreenDump(buf, 'Test_incsearch_substitute_11', {})
5e5f2d824189 patch 8.1.0399: 'hlsearch' highlight remains in other window
Christian Brabandt <cb@256bit.org>
parents: 14760
diff changeset
1231 call term_sendkeys(buf, "\<BS>")
5e5f2d824189 patch 8.1.0399: 'hlsearch' highlight remains in other window
Christian Brabandt <cb@256bit.org>
parents: 14760
diff changeset
1232 call VerifyScreenDump(buf, 'Test_incsearch_substitute_12', {})
5e5f2d824189 patch 8.1.0399: 'hlsearch' highlight remains in other window
Christian Brabandt <cb@256bit.org>
parents: 14760
diff changeset
1233 call term_sendkeys(buf, "\<Esc>")
5e5f2d824189 patch 8.1.0399: 'hlsearch' highlight remains in other window
Christian Brabandt <cb@256bit.org>
parents: 14760
diff changeset
1234 call VerifyScreenDump(buf, 'Test_incsearch_substitute_13', {})
18693
d7c47e45bcc3 patch 8.1.2338: using Visual mark sith :s gives E20 if not set
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1235 call term_sendkeys(buf, ":%bwipe!\<CR>")
d7c47e45bcc3 patch 8.1.2338: using Visual mark sith :s gives E20 if not set
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1236 call term_sendkeys(buf, ":only!\<CR>")
d7c47e45bcc3 patch 8.1.2338: using Visual mark sith :s gives E20 if not set
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1237
d7c47e45bcc3 patch 8.1.2338: using Visual mark sith :s gives E20 if not set
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1238 " get :'<,'>s command in history
d7c47e45bcc3 patch 8.1.2338: using Visual mark sith :s gives E20 if not set
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1239 call term_sendkeys(buf, ":set cmdheight=2\<CR>")
d7c47e45bcc3 patch 8.1.2338: using Visual mark sith :s gives E20 if not set
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1240 call term_sendkeys(buf, "aasdfasdf\<Esc>")
d7c47e45bcc3 patch 8.1.2338: using Visual mark sith :s gives E20 if not set
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1241 call term_sendkeys(buf, "V:s/a/b/g\<CR>")
d7c47e45bcc3 patch 8.1.2338: using Visual mark sith :s gives E20 if not set
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1242 " Using '<,'> does not give E20
d7c47e45bcc3 patch 8.1.2338: using Visual mark sith :s gives E20 if not set
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1243 call term_sendkeys(buf, ":new\<CR>")
d7c47e45bcc3 patch 8.1.2338: using Visual mark sith :s gives E20 if not set
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1244 call term_sendkeys(buf, "aasdfasdf\<Esc>")
d7c47e45bcc3 patch 8.1.2338: using Visual mark sith :s gives E20 if not set
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1245 call term_sendkeys(buf, ":\<Up>\<Up>")
d7c47e45bcc3 patch 8.1.2338: using Visual mark sith :s gives E20 if not set
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1246 call VerifyScreenDump(buf, 'Test_incsearch_substitute_14', {})
d7c47e45bcc3 patch 8.1.2338: using Visual mark sith :s gives E20 if not set
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1247 call term_sendkeys(buf, "<Esc>")
14774
5e5f2d824189 patch 8.1.0399: 'hlsearch' highlight remains in other window
Christian Brabandt <cb@256bit.org>
parents: 14760
diff changeset
1248
14526
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
1249 call StopVimInTerminal(buf)
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
1250 endfunc
66b9514b5a99 patch 8.1.0276: no test for 'incsearch' highlighting with :s
Christian Brabandt <cb@256bit.org>
parents: 14524
diff changeset
1251
19475
5512aa74cb62 patch 8.2.0295: highlighting for :s wrong when using different separator
Bram Moolenaar <Bram@vim.org>
parents: 19435
diff changeset
1252 func Test_incsearch_highlighting()
19705
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
1253 CheckOption incsearch
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
1254 CheckScreendump
19475
5512aa74cb62 patch 8.2.0295: highlighting for :s wrong when using different separator
Bram Moolenaar <Bram@vim.org>
parents: 19435
diff changeset
1255
5512aa74cb62 patch 8.2.0295: highlighting for :s wrong when using different separator
Bram Moolenaar <Bram@vim.org>
parents: 19435
diff changeset
1256 call writefile([
5512aa74cb62 patch 8.2.0295: highlighting for :s wrong when using different separator
Bram Moolenaar <Bram@vim.org>
parents: 19435
diff changeset
1257 \ 'set incsearch hlsearch',
5512aa74cb62 patch 8.2.0295: highlighting for :s wrong when using different separator
Bram Moolenaar <Bram@vim.org>
parents: 19435
diff changeset
1258 \ 'call setline(1, "hello/there")',
30769
ae10b91ac6b3 patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 29277
diff changeset
1259 \ ], 'Xis_subst_hl_script', 'D')
19475
5512aa74cb62 patch 8.2.0295: highlighting for :s wrong when using different separator
Bram Moolenaar <Bram@vim.org>
parents: 19435
diff changeset
1260 let buf = RunVimInTerminal('-S Xis_subst_hl_script', {'rows': 4, 'cols': 20})
5512aa74cb62 patch 8.2.0295: highlighting for :s wrong when using different separator
Bram Moolenaar <Bram@vim.org>
parents: 19435
diff changeset
1261 " Give Vim a chance to redraw to get rid of the spaces in line 2 caused by
5512aa74cb62 patch 8.2.0295: highlighting for :s wrong when using different separator
Bram Moolenaar <Bram@vim.org>
parents: 19435
diff changeset
1262 " the 'ambiwidth' check.
5512aa74cb62 patch 8.2.0295: highlighting for :s wrong when using different separator
Bram Moolenaar <Bram@vim.org>
parents: 19435
diff changeset
1263 sleep 300m
5512aa74cb62 patch 8.2.0295: highlighting for :s wrong when using different separator
Bram Moolenaar <Bram@vim.org>
parents: 19435
diff changeset
1264
5512aa74cb62 patch 8.2.0295: highlighting for :s wrong when using different separator
Bram Moolenaar <Bram@vim.org>
parents: 19435
diff changeset
1265 " Using a different search delimiter should still highlight matches
5512aa74cb62 patch 8.2.0295: highlighting for :s wrong when using different separator
Bram Moolenaar <Bram@vim.org>
parents: 19435
diff changeset
1266 " that contain a '/'.
5512aa74cb62 patch 8.2.0295: highlighting for :s wrong when using different separator
Bram Moolenaar <Bram@vim.org>
parents: 19435
diff changeset
1267 call term_sendkeys(buf, ":%s;ello/the")
5512aa74cb62 patch 8.2.0295: highlighting for :s wrong when using different separator
Bram Moolenaar <Bram@vim.org>
parents: 19435
diff changeset
1268 call VerifyScreenDump(buf, 'Test_incsearch_substitute_15', {})
5512aa74cb62 patch 8.2.0295: highlighting for :s wrong when using different separator
Bram Moolenaar <Bram@vim.org>
parents: 19435
diff changeset
1269 call term_sendkeys(buf, "<Esc>")
19705
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
1270
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
1271 call StopVimInTerminal(buf)
19475
5512aa74cb62 patch 8.2.0295: highlighting for :s wrong when using different separator
Bram Moolenaar <Bram@vim.org>
parents: 19435
diff changeset
1272 endfunc
5512aa74cb62 patch 8.2.0295: highlighting for :s wrong when using different separator
Bram Moolenaar <Bram@vim.org>
parents: 19435
diff changeset
1273
15914
c94b46f98b1a patch 8.1.0963: illegal memory access when using 'incsearch'
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
1274 func Test_incsearch_with_change()
19705
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
1275 CheckFeature timers
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
1276 CheckOption incsearch
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
1277 CheckScreendump
15914
c94b46f98b1a patch 8.1.0963: illegal memory access when using 'incsearch'
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
1278
c94b46f98b1a patch 8.1.0963: illegal memory access when using 'incsearch'
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
1279 call writefile([
c94b46f98b1a patch 8.1.0963: illegal memory access when using 'incsearch'
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
1280 \ 'set incsearch hlsearch scrolloff=0',
c94b46f98b1a patch 8.1.0963: illegal memory access when using 'incsearch'
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
1281 \ 'call setline(1, ["one", "two ------ X", "three"])',
c94b46f98b1a patch 8.1.0963: illegal memory access when using 'incsearch'
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
1282 \ 'call timer_start(200, { _ -> setline(2, "x")})',
30769
ae10b91ac6b3 patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 29277
diff changeset
1283 \ ], 'Xis_change_script', 'D')
15914
c94b46f98b1a patch 8.1.0963: illegal memory access when using 'incsearch'
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
1284 let buf = RunVimInTerminal('-S Xis_change_script', {'rows': 9, 'cols': 70})
c94b46f98b1a patch 8.1.0963: illegal memory access when using 'incsearch'
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
1285 " Give Vim a chance to redraw to get rid of the spaces in line 2 caused by
c94b46f98b1a patch 8.1.0963: illegal memory access when using 'incsearch'
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
1286 " the 'ambiwidth' check.
15918
22b51b13634d patch 8.1.0965: search test fails
Bram Moolenaar <Bram@vim.org>
parents: 15914
diff changeset
1287 sleep 300m
15914
c94b46f98b1a patch 8.1.0963: illegal memory access when using 'incsearch'
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
1288
c94b46f98b1a patch 8.1.0963: illegal memory access when using 'incsearch'
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
1289 " Highlight X, it will be deleted by the timer callback.
c94b46f98b1a patch 8.1.0963: illegal memory access when using 'incsearch'
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
1290 call term_sendkeys(buf, ':%s/X')
c94b46f98b1a patch 8.1.0963: illegal memory access when using 'incsearch'
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
1291 call VerifyScreenDump(buf, 'Test_incsearch_change_01', {})
c94b46f98b1a patch 8.1.0963: illegal memory access when using 'incsearch'
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
1292 call term_sendkeys(buf, "\<Esc>")
c94b46f98b1a patch 8.1.0963: illegal memory access when using 'incsearch'
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
1293
c94b46f98b1a patch 8.1.0963: illegal memory access when using 'incsearch'
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
1294 call StopVimInTerminal(buf)
c94b46f98b1a patch 8.1.0963: illegal memory access when using 'incsearch'
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
1295 endfunc
c94b46f98b1a patch 8.1.0963: illegal memory access when using 'incsearch'
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
1296
14556
2bee637a8edc patch 8.1.0291: 'incsearch' highlighting not used for :sort
Christian Brabandt <cb@256bit.org>
parents: 14546
diff changeset
1297 " Similar to Test_incsearch_substitute_dump() for :sort
14615
c6b41d47bac1 patch 8.1.0321: 'incsearch' regression: / highlights everything
Christian Brabandt <cb@256bit.org>
parents: 14613
diff changeset
1298 func Test_incsearch_sort_dump()
19705
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
1299 CheckOption incsearch
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
1300 CheckScreendump
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
1301
14556
2bee637a8edc patch 8.1.0291: 'incsearch' highlighting not used for :sort
Christian Brabandt <cb@256bit.org>
parents: 14546
diff changeset
1302 call writefile([
2bee637a8edc patch 8.1.0291: 'incsearch' highlighting not used for :sort
Christian Brabandt <cb@256bit.org>
parents: 14546
diff changeset
1303 \ 'set incsearch hlsearch scrolloff=0',
2bee637a8edc patch 8.1.0291: 'incsearch' highlighting not used for :sort
Christian Brabandt <cb@256bit.org>
parents: 14546
diff changeset
1304 \ 'call setline(1, ["another one 2", "that one 3", "the one 1"])',
30769
ae10b91ac6b3 patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 29277
diff changeset
1305 \ ], 'Xis_sort_script', 'D')
14556
2bee637a8edc patch 8.1.0291: 'incsearch' highlighting not used for :sort
Christian Brabandt <cb@256bit.org>
parents: 14546
diff changeset
1306 let buf = RunVimInTerminal('-S Xis_sort_script', {'rows': 9, 'cols': 70})
2bee637a8edc patch 8.1.0291: 'incsearch' highlighting not used for :sort
Christian Brabandt <cb@256bit.org>
parents: 14546
diff changeset
1307 " Give Vim a chance to redraw to get rid of the spaces in line 2 caused by
2bee637a8edc patch 8.1.0291: 'incsearch' highlighting not used for :sort
Christian Brabandt <cb@256bit.org>
parents: 14546
diff changeset
1308 " the 'ambiwidth' check.
2bee637a8edc patch 8.1.0291: 'incsearch' highlighting not used for :sort
Christian Brabandt <cb@256bit.org>
parents: 14546
diff changeset
1309 sleep 100m
2bee637a8edc patch 8.1.0291: 'incsearch' highlighting not used for :sort
Christian Brabandt <cb@256bit.org>
parents: 14546
diff changeset
1310
2bee637a8edc patch 8.1.0291: 'incsearch' highlighting not used for :sort
Christian Brabandt <cb@256bit.org>
parents: 14546
diff changeset
1311 call term_sendkeys(buf, ':sort ni u /on')
2bee637a8edc patch 8.1.0291: 'incsearch' highlighting not used for :sort
Christian Brabandt <cb@256bit.org>
parents: 14546
diff changeset
1312 call VerifyScreenDump(buf, 'Test_incsearch_sort_01', {})
2bee637a8edc patch 8.1.0291: 'incsearch' highlighting not used for :sort
Christian Brabandt <cb@256bit.org>
parents: 14546
diff changeset
1313 call term_sendkeys(buf, "\<Esc>")
2bee637a8edc patch 8.1.0291: 'incsearch' highlighting not used for :sort
Christian Brabandt <cb@256bit.org>
parents: 14546
diff changeset
1314
20164
2dd1ac2c48f4 patch 8.2.0637: incsearch highlighting does not work for ":sort!"
Bram Moolenaar <Bram@vim.org>
parents: 20128
diff changeset
1315 call term_sendkeys(buf, ':sort! /on')
2dd1ac2c48f4 patch 8.2.0637: incsearch highlighting does not work for ":sort!"
Bram Moolenaar <Bram@vim.org>
parents: 20128
diff changeset
1316 call VerifyScreenDump(buf, 'Test_incsearch_sort_02', {})
2dd1ac2c48f4 patch 8.2.0637: incsearch highlighting does not work for ":sort!"
Bram Moolenaar <Bram@vim.org>
parents: 20128
diff changeset
1317 call term_sendkeys(buf, "\<Esc>")
2dd1ac2c48f4 patch 8.2.0637: incsearch highlighting does not work for ":sort!"
Bram Moolenaar <Bram@vim.org>
parents: 20128
diff changeset
1318
14556
2bee637a8edc patch 8.1.0291: 'incsearch' highlighting not used for :sort
Christian Brabandt <cb@256bit.org>
parents: 14546
diff changeset
1319 call StopVimInTerminal(buf)
2bee637a8edc patch 8.1.0291: 'incsearch' highlighting not used for :sort
Christian Brabandt <cb@256bit.org>
parents: 14546
diff changeset
1320 endfunc
2bee637a8edc patch 8.1.0291: 'incsearch' highlighting not used for :sort
Christian Brabandt <cb@256bit.org>
parents: 14546
diff changeset
1321
14563
d84e67a12671 patch 8.1.0295: no 'incsearch' highlighting for :vimgrep and similar
Christian Brabandt <cb@256bit.org>
parents: 14556
diff changeset
1322 " Similar to Test_incsearch_substitute_dump() for :vimgrep famiry
d84e67a12671 patch 8.1.0295: no 'incsearch' highlighting for :vimgrep and similar
Christian Brabandt <cb@256bit.org>
parents: 14556
diff changeset
1323 func Test_incsearch_vimgrep_dump()
19705
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
1324 CheckOption incsearch
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
1325 CheckScreendump
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
1326
14563
d84e67a12671 patch 8.1.0295: no 'incsearch' highlighting for :vimgrep and similar
Christian Brabandt <cb@256bit.org>
parents: 14556
diff changeset
1327 call writefile([
d84e67a12671 patch 8.1.0295: no 'incsearch' highlighting for :vimgrep and similar
Christian Brabandt <cb@256bit.org>
parents: 14556
diff changeset
1328 \ 'set incsearch hlsearch scrolloff=0',
d84e67a12671 patch 8.1.0295: no 'incsearch' highlighting for :vimgrep and similar
Christian Brabandt <cb@256bit.org>
parents: 14556
diff changeset
1329 \ 'call setline(1, ["another one 2", "that one 3", "the one 1"])',
30769
ae10b91ac6b3 patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 29277
diff changeset
1330 \ ], 'Xis_vimgrep_script', 'D')
14563
d84e67a12671 patch 8.1.0295: no 'incsearch' highlighting for :vimgrep and similar
Christian Brabandt <cb@256bit.org>
parents: 14556
diff changeset
1331 let buf = RunVimInTerminal('-S Xis_vimgrep_script', {'rows': 9, 'cols': 70})
d84e67a12671 patch 8.1.0295: no 'incsearch' highlighting for :vimgrep and similar
Christian Brabandt <cb@256bit.org>
parents: 14556
diff changeset
1332 " Give Vim a chance to redraw to get rid of the spaces in line 2 caused by
d84e67a12671 patch 8.1.0295: no 'incsearch' highlighting for :vimgrep and similar
Christian Brabandt <cb@256bit.org>
parents: 14556
diff changeset
1333 " the 'ambiwidth' check.
d84e67a12671 patch 8.1.0295: no 'incsearch' highlighting for :vimgrep and similar
Christian Brabandt <cb@256bit.org>
parents: 14556
diff changeset
1334 sleep 100m
d84e67a12671 patch 8.1.0295: no 'incsearch' highlighting for :vimgrep and similar
Christian Brabandt <cb@256bit.org>
parents: 14556
diff changeset
1335
d84e67a12671 patch 8.1.0295: no 'incsearch' highlighting for :vimgrep and similar
Christian Brabandt <cb@256bit.org>
parents: 14556
diff changeset
1336 " Need to send one key at a time to force a redraw.
d84e67a12671 patch 8.1.0295: no 'incsearch' highlighting for :vimgrep and similar
Christian Brabandt <cb@256bit.org>
parents: 14556
diff changeset
1337 call term_sendkeys(buf, ':vimgrep on')
d84e67a12671 patch 8.1.0295: no 'incsearch' highlighting for :vimgrep and similar
Christian Brabandt <cb@256bit.org>
parents: 14556
diff changeset
1338 call VerifyScreenDump(buf, 'Test_incsearch_vimgrep_01', {})
d84e67a12671 patch 8.1.0295: no 'incsearch' highlighting for :vimgrep and similar
Christian Brabandt <cb@256bit.org>
parents: 14556
diff changeset
1339 call term_sendkeys(buf, "\<Esc>")
d84e67a12671 patch 8.1.0295: no 'incsearch' highlighting for :vimgrep and similar
Christian Brabandt <cb@256bit.org>
parents: 14556
diff changeset
1340
d84e67a12671 patch 8.1.0295: no 'incsearch' highlighting for :vimgrep and similar
Christian Brabandt <cb@256bit.org>
parents: 14556
diff changeset
1341 call term_sendkeys(buf, ':vimg /on/ *.txt')
d84e67a12671 patch 8.1.0295: no 'incsearch' highlighting for :vimgrep and similar
Christian Brabandt <cb@256bit.org>
parents: 14556
diff changeset
1342 call VerifyScreenDump(buf, 'Test_incsearch_vimgrep_02', {})
d84e67a12671 patch 8.1.0295: no 'incsearch' highlighting for :vimgrep and similar
Christian Brabandt <cb@256bit.org>
parents: 14556
diff changeset
1343 call term_sendkeys(buf, "\<Esc>")
d84e67a12671 patch 8.1.0295: no 'incsearch' highlighting for :vimgrep and similar
Christian Brabandt <cb@256bit.org>
parents: 14556
diff changeset
1344
d84e67a12671 patch 8.1.0295: no 'incsearch' highlighting for :vimgrep and similar
Christian Brabandt <cb@256bit.org>
parents: 14556
diff changeset
1345 call term_sendkeys(buf, ':vimgrepadd "\<on')
d84e67a12671 patch 8.1.0295: no 'incsearch' highlighting for :vimgrep and similar
Christian Brabandt <cb@256bit.org>
parents: 14556
diff changeset
1346 call VerifyScreenDump(buf, 'Test_incsearch_vimgrep_03', {})
d84e67a12671 patch 8.1.0295: no 'incsearch' highlighting for :vimgrep and similar
Christian Brabandt <cb@256bit.org>
parents: 14556
diff changeset
1347 call term_sendkeys(buf, "\<Esc>")
d84e67a12671 patch 8.1.0295: no 'incsearch' highlighting for :vimgrep and similar
Christian Brabandt <cb@256bit.org>
parents: 14556
diff changeset
1348
d84e67a12671 patch 8.1.0295: no 'incsearch' highlighting for :vimgrep and similar
Christian Brabandt <cb@256bit.org>
parents: 14556
diff changeset
1349 call term_sendkeys(buf, ':lv "tha')
d84e67a12671 patch 8.1.0295: no 'incsearch' highlighting for :vimgrep and similar
Christian Brabandt <cb@256bit.org>
parents: 14556
diff changeset
1350 call VerifyScreenDump(buf, 'Test_incsearch_vimgrep_04', {})
d84e67a12671 patch 8.1.0295: no 'incsearch' highlighting for :vimgrep and similar
Christian Brabandt <cb@256bit.org>
parents: 14556
diff changeset
1351 call term_sendkeys(buf, "\<Esc>")
d84e67a12671 patch 8.1.0295: no 'incsearch' highlighting for :vimgrep and similar
Christian Brabandt <cb@256bit.org>
parents: 14556
diff changeset
1352
d84e67a12671 patch 8.1.0295: no 'incsearch' highlighting for :vimgrep and similar
Christian Brabandt <cb@256bit.org>
parents: 14556
diff changeset
1353 call term_sendkeys(buf, ':lvimgrepa "the" **/*.txt')
d84e67a12671 patch 8.1.0295: no 'incsearch' highlighting for :vimgrep and similar
Christian Brabandt <cb@256bit.org>
parents: 14556
diff changeset
1354 call VerifyScreenDump(buf, 'Test_incsearch_vimgrep_05', {})
d84e67a12671 patch 8.1.0295: no 'incsearch' highlighting for :vimgrep and similar
Christian Brabandt <cb@256bit.org>
parents: 14556
diff changeset
1355 call term_sendkeys(buf, "\<Esc>")
d84e67a12671 patch 8.1.0295: no 'incsearch' highlighting for :vimgrep and similar
Christian Brabandt <cb@256bit.org>
parents: 14556
diff changeset
1356
d84e67a12671 patch 8.1.0295: no 'incsearch' highlighting for :vimgrep and similar
Christian Brabandt <cb@256bit.org>
parents: 14556
diff changeset
1357 call StopVimInTerminal(buf)
d84e67a12671 patch 8.1.0295: no 'incsearch' highlighting for :vimgrep and similar
Christian Brabandt <cb@256bit.org>
parents: 14556
diff changeset
1358 endfunc
d84e67a12671 patch 8.1.0295: no 'incsearch' highlighting for :vimgrep and similar
Christian Brabandt <cb@256bit.org>
parents: 14556
diff changeset
1359
14677
7771a1ff8b99 patch 8.1.0351: 'incsearch' for :/foo/s//<Esc> changes last search pattern
Christian Brabandt <cb@256bit.org>
parents: 14652
diff changeset
1360 func Test_keep_last_search_pattern()
19705
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
1361 CheckOption incsearch
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
1362
14677
7771a1ff8b99 patch 8.1.0351: 'incsearch' for :/foo/s//<Esc> changes last search pattern
Christian Brabandt <cb@256bit.org>
parents: 14652
diff changeset
1363 new
7771a1ff8b99 patch 8.1.0351: 'incsearch' for :/foo/s//<Esc> changes last search pattern
Christian Brabandt <cb@256bit.org>
parents: 14652
diff changeset
1364 call setline(1, ['foo', 'foo', 'foo'])
7771a1ff8b99 patch 8.1.0351: 'incsearch' for :/foo/s//<Esc> changes last search pattern
Christian Brabandt <cb@256bit.org>
parents: 14652
diff changeset
1365 set incsearch
7771a1ff8b99 patch 8.1.0351: 'incsearch' for :/foo/s//<Esc> changes last search pattern
Christian Brabandt <cb@256bit.org>
parents: 14652
diff changeset
1366 call test_override("char_avail", 1)
7771a1ff8b99 patch 8.1.0351: 'incsearch' for :/foo/s//<Esc> changes last search pattern
Christian Brabandt <cb@256bit.org>
parents: 14652
diff changeset
1367 let @/ = 'bar'
7771a1ff8b99 patch 8.1.0351: 'incsearch' for :/foo/s//<Esc> changes last search pattern
Christian Brabandt <cb@256bit.org>
parents: 14652
diff changeset
1368 call feedkeys(":/foo/s//\<Esc>", 'ntx')
7771a1ff8b99 patch 8.1.0351: 'incsearch' for :/foo/s//<Esc> changes last search pattern
Christian Brabandt <cb@256bit.org>
parents: 14652
diff changeset
1369 call assert_equal('bar', @/)
7771a1ff8b99 patch 8.1.0351: 'incsearch' for :/foo/s//<Esc> changes last search pattern
Christian Brabandt <cb@256bit.org>
parents: 14652
diff changeset
1370
14760
fd69edd2c67e patch 8.1.0392: error while typing :/foo/s// with 'incsearch' enabled
Christian Brabandt <cb@256bit.org>
parents: 14687
diff changeset
1371 " no error message if pattern not found
fd69edd2c67e patch 8.1.0392: error while typing :/foo/s// with 'incsearch' enabled
Christian Brabandt <cb@256bit.org>
parents: 14687
diff changeset
1372 call feedkeys(":/xyz/s//\<Esc>", 'ntx')
fd69edd2c67e patch 8.1.0392: error while typing :/foo/s// with 'incsearch' enabled
Christian Brabandt <cb@256bit.org>
parents: 14687
diff changeset
1373 call assert_equal('bar', @/)
fd69edd2c67e patch 8.1.0392: error while typing :/foo/s// with 'incsearch' enabled
Christian Brabandt <cb@256bit.org>
parents: 14687
diff changeset
1374
14677
7771a1ff8b99 patch 8.1.0351: 'incsearch' for :/foo/s//<Esc> changes last search pattern
Christian Brabandt <cb@256bit.org>
parents: 14652
diff changeset
1375 bwipe!
7771a1ff8b99 patch 8.1.0351: 'incsearch' for :/foo/s//<Esc> changes last search pattern
Christian Brabandt <cb@256bit.org>
parents: 14652
diff changeset
1376 call test_override("ALL", 0)
7771a1ff8b99 patch 8.1.0351: 'incsearch' for :/foo/s//<Esc> changes last search pattern
Christian Brabandt <cb@256bit.org>
parents: 14652
diff changeset
1377 set noincsearch
7771a1ff8b99 patch 8.1.0351: 'incsearch' for :/foo/s//<Esc> changes last search pattern
Christian Brabandt <cb@256bit.org>
parents: 14652
diff changeset
1378 endfunc
7771a1ff8b99 patch 8.1.0351: 'incsearch' for :/foo/s//<Esc> changes last search pattern
Christian Brabandt <cb@256bit.org>
parents: 14652
diff changeset
1379
14687
2982a54aa304 patch 8.1.0356: using :s with 'incsearch' prevents CTRL-R CTRL-W
Christian Brabandt <cb@256bit.org>
parents: 14677
diff changeset
1380 func Test_word_under_cursor_after_match()
19705
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
1381 CheckOption incsearch
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
1382
14687
2982a54aa304 patch 8.1.0356: using :s with 'incsearch' prevents CTRL-R CTRL-W
Christian Brabandt <cb@256bit.org>
parents: 14677
diff changeset
1383 new
2982a54aa304 patch 8.1.0356: using :s with 'incsearch' prevents CTRL-R CTRL-W
Christian Brabandt <cb@256bit.org>
parents: 14677
diff changeset
1384 call setline(1, 'foo bar')
2982a54aa304 patch 8.1.0356: using :s with 'incsearch' prevents CTRL-R CTRL-W
Christian Brabandt <cb@256bit.org>
parents: 14677
diff changeset
1385 set incsearch
2982a54aa304 patch 8.1.0356: using :s with 'incsearch' prevents CTRL-R CTRL-W
Christian Brabandt <cb@256bit.org>
parents: 14677
diff changeset
1386 call test_override("char_avail", 1)
2982a54aa304 patch 8.1.0356: using :s with 'incsearch' prevents CTRL-R CTRL-W
Christian Brabandt <cb@256bit.org>
parents: 14677
diff changeset
1387 try
2982a54aa304 patch 8.1.0356: using :s with 'incsearch' prevents CTRL-R CTRL-W
Christian Brabandt <cb@256bit.org>
parents: 14677
diff changeset
1388 call feedkeys("/foo\<C-R>\<C-W>\<CR>", 'ntx')
2982a54aa304 patch 8.1.0356: using :s with 'incsearch' prevents CTRL-R CTRL-W
Christian Brabandt <cb@256bit.org>
parents: 14677
diff changeset
1389 catch /E486:/
2982a54aa304 patch 8.1.0356: using :s with 'incsearch' prevents CTRL-R CTRL-W
Christian Brabandt <cb@256bit.org>
parents: 14677
diff changeset
1390 endtry
2982a54aa304 patch 8.1.0356: using :s with 'incsearch' prevents CTRL-R CTRL-W
Christian Brabandt <cb@256bit.org>
parents: 14677
diff changeset
1391 call assert_equal('foobar', @/)
2982a54aa304 patch 8.1.0356: using :s with 'incsearch' prevents CTRL-R CTRL-W
Christian Brabandt <cb@256bit.org>
parents: 14677
diff changeset
1392
2982a54aa304 patch 8.1.0356: using :s with 'incsearch' prevents CTRL-R CTRL-W
Christian Brabandt <cb@256bit.org>
parents: 14677
diff changeset
1393 bwipe!
2982a54aa304 patch 8.1.0356: using :s with 'incsearch' prevents CTRL-R CTRL-W
Christian Brabandt <cb@256bit.org>
parents: 14677
diff changeset
1394 call test_override("ALL", 0)
2982a54aa304 patch 8.1.0356: using :s with 'incsearch' prevents CTRL-R CTRL-W
Christian Brabandt <cb@256bit.org>
parents: 14677
diff changeset
1395 set noincsearch
2982a54aa304 patch 8.1.0356: using :s with 'incsearch' prevents CTRL-R CTRL-W
Christian Brabandt <cb@256bit.org>
parents: 14677
diff changeset
1396 endfunc
2982a54aa304 patch 8.1.0356: using :s with 'incsearch' prevents CTRL-R CTRL-W
Christian Brabandt <cb@256bit.org>
parents: 14677
diff changeset
1397
2982a54aa304 patch 8.1.0356: using :s with 'incsearch' prevents CTRL-R CTRL-W
Christian Brabandt <cb@256bit.org>
parents: 14677
diff changeset
1398 func Test_subst_word_under_cursor()
19705
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
1399 CheckOption incsearch
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
1400
14687
2982a54aa304 patch 8.1.0356: using :s with 'incsearch' prevents CTRL-R CTRL-W
Christian Brabandt <cb@256bit.org>
parents: 14677
diff changeset
1401 new
2982a54aa304 patch 8.1.0356: using :s with 'incsearch' prevents CTRL-R CTRL-W
Christian Brabandt <cb@256bit.org>
parents: 14677
diff changeset
1402 call setline(1, ['int SomeLongName;', 'for (xxx = 1; xxx < len; ++xxx)'])
2982a54aa304 patch 8.1.0356: using :s with 'incsearch' prevents CTRL-R CTRL-W
Christian Brabandt <cb@256bit.org>
parents: 14677
diff changeset
1403 set incsearch
2982a54aa304 patch 8.1.0356: using :s with 'incsearch' prevents CTRL-R CTRL-W
Christian Brabandt <cb@256bit.org>
parents: 14677
diff changeset
1404 call test_override("char_avail", 1)
2982a54aa304 patch 8.1.0356: using :s with 'incsearch' prevents CTRL-R CTRL-W
Christian Brabandt <cb@256bit.org>
parents: 14677
diff changeset
1405 call feedkeys("/LongName\<CR>", 'ntx')
2982a54aa304 patch 8.1.0356: using :s with 'incsearch' prevents CTRL-R CTRL-W
Christian Brabandt <cb@256bit.org>
parents: 14677
diff changeset
1406 call feedkeys(":%s/xxx/\<C-R>\<C-W>/g\<CR>", 'ntx')
2982a54aa304 patch 8.1.0356: using :s with 'incsearch' prevents CTRL-R CTRL-W
Christian Brabandt <cb@256bit.org>
parents: 14677
diff changeset
1407 call assert_equal('for (SomeLongName = 1; SomeLongName < len; ++SomeLongName)', getline(2))
2982a54aa304 patch 8.1.0356: using :s with 'incsearch' prevents CTRL-R CTRL-W
Christian Brabandt <cb@256bit.org>
parents: 14677
diff changeset
1408
2982a54aa304 patch 8.1.0356: using :s with 'incsearch' prevents CTRL-R CTRL-W
Christian Brabandt <cb@256bit.org>
parents: 14677
diff changeset
1409 bwipe!
2982a54aa304 patch 8.1.0356: using :s with 'incsearch' prevents CTRL-R CTRL-W
Christian Brabandt <cb@256bit.org>
parents: 14677
diff changeset
1410 call test_override("ALL", 0)
2982a54aa304 patch 8.1.0356: using :s with 'incsearch' prevents CTRL-R CTRL-W
Christian Brabandt <cb@256bit.org>
parents: 14677
diff changeset
1411 set noincsearch
2982a54aa304 patch 8.1.0356: using :s with 'incsearch' prevents CTRL-R CTRL-W
Christian Brabandt <cb@256bit.org>
parents: 14677
diff changeset
1412 endfunc
2982a54aa304 patch 8.1.0356: using :s with 'incsearch' prevents CTRL-R CTRL-W
Christian Brabandt <cb@256bit.org>
parents: 14677
diff changeset
1413
31802
ddbc560ecc41 patch 9.0.1233: search() loops forever if "skip" is TRUE for all matches
Bram Moolenaar <Bram@vim.org>
parents: 31571
diff changeset
1414 func Test_search_skip_all_matches()
ddbc560ecc41 patch 9.0.1233: search() loops forever if "skip" is TRUE for all matches
Bram Moolenaar <Bram@vim.org>
parents: 31571
diff changeset
1415 enew
ddbc560ecc41 patch 9.0.1233: search() loops forever if "skip" is TRUE for all matches
Bram Moolenaar <Bram@vim.org>
parents: 31571
diff changeset
1416 call setline(1, ['no match here',
ddbc560ecc41 patch 9.0.1233: search() loops forever if "skip" is TRUE for all matches
Bram Moolenaar <Bram@vim.org>
parents: 31571
diff changeset
1417 \ 'match this line',
ddbc560ecc41 patch 9.0.1233: search() loops forever if "skip" is TRUE for all matches
Bram Moolenaar <Bram@vim.org>
parents: 31571
diff changeset
1418 \ 'nope',
ddbc560ecc41 patch 9.0.1233: search() loops forever if "skip" is TRUE for all matches
Bram Moolenaar <Bram@vim.org>
parents: 31571
diff changeset
1419 \ 'match in this line',
ddbc560ecc41 patch 9.0.1233: search() loops forever if "skip" is TRUE for all matches
Bram Moolenaar <Bram@vim.org>
parents: 31571
diff changeset
1420 \ 'last line',
ddbc560ecc41 patch 9.0.1233: search() loops forever if "skip" is TRUE for all matches
Bram Moolenaar <Bram@vim.org>
parents: 31571
diff changeset
1421 \ ])
ddbc560ecc41 patch 9.0.1233: search() loops forever if "skip" is TRUE for all matches
Bram Moolenaar <Bram@vim.org>
parents: 31571
diff changeset
1422 call cursor(1, 1)
ddbc560ecc41 patch 9.0.1233: search() loops forever if "skip" is TRUE for all matches
Bram Moolenaar <Bram@vim.org>
parents: 31571
diff changeset
1423 let lnum = search('this', '', 0, 0, 'getline(".") =~ "this line"')
ddbc560ecc41 patch 9.0.1233: search() loops forever if "skip" is TRUE for all matches
Bram Moolenaar <Bram@vim.org>
parents: 31571
diff changeset
1424 " Only check that no match is found. Previously it searched forever.
ddbc560ecc41 patch 9.0.1233: search() loops forever if "skip" is TRUE for all matches
Bram Moolenaar <Bram@vim.org>
parents: 31571
diff changeset
1425 call assert_equal(0, lnum)
ddbc560ecc41 patch 9.0.1233: search() loops forever if "skip" is TRUE for all matches
Bram Moolenaar <Bram@vim.org>
parents: 31571
diff changeset
1426
ddbc560ecc41 patch 9.0.1233: search() loops forever if "skip" is TRUE for all matches
Bram Moolenaar <Bram@vim.org>
parents: 31571
diff changeset
1427 bwipe!
ddbc560ecc41 patch 9.0.1233: search() loops forever if "skip" is TRUE for all matches
Bram Moolenaar <Bram@vim.org>
parents: 31571
diff changeset
1428 endfunc
ddbc560ecc41 patch 9.0.1233: search() loops forever if "skip" is TRUE for all matches
Bram Moolenaar <Bram@vim.org>
parents: 31571
diff changeset
1429
12730
6fa9f6b4d159 patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents: 12722
diff changeset
1430 func Test_search_undefined_behaviour()
19705
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
1431 CheckFeature terminal
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
1432
12730
6fa9f6b4d159 patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents: 12722
diff changeset
1433 let h = winheight(0)
6fa9f6b4d159 patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents: 12722
diff changeset
1434 if h < 3
6fa9f6b4d159 patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents: 12722
diff changeset
1435 return
6fa9f6b4d159 patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents: 12722
diff changeset
1436 endif
6fa9f6b4d159 patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents: 12722
diff changeset
1437 " did cause an undefined left shift
6fa9f6b4d159 patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents: 12722
diff changeset
1438 let g:buf = term_start([GetVimProg(), '--clean', '-e', '-s', '-c', 'call search(getline("."))', 'samples/test000'], {'term_rows': 3})
6fa9f6b4d159 patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents: 12722
diff changeset
1439 call assert_equal([''], getline(1, '$'))
6fa9f6b4d159 patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents: 12722
diff changeset
1440 call term_sendkeys(g:buf, ":qa!\<cr>")
6fa9f6b4d159 patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents: 12722
diff changeset
1441 bwipe!
6fa9f6b4d159 patch 8.0.1243: no test for what 8.0.1227 fixes
Christian Brabandt <cb@256bit.org>
parents: 12722
diff changeset
1442 endfunc
12759
528b227051f8 patch 8.0.1257: no test for fix of undefined behavior
Christian Brabandt <cb@256bit.org>
parents: 12744
diff changeset
1443
528b227051f8 patch 8.0.1257: no test for fix of undefined behavior
Christian Brabandt <cb@256bit.org>
parents: 12744
diff changeset
1444 func Test_search_undefined_behaviour2()
528b227051f8 patch 8.0.1257: no test for fix of undefined behavior
Christian Brabandt <cb@256bit.org>
parents: 12744
diff changeset
1445 call search("\%UC0000000")
528b227051f8 patch 8.0.1257: no test for fix of undefined behavior
Christian Brabandt <cb@256bit.org>
parents: 12744
diff changeset
1446 endfunc
12788
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
1447
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
1448 " Test for search('multi-byte char', 'bce')
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
1449 func Test_search_multibyte()
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
1450 let save_enc = &encoding
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
1451 set encoding=utf8
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
1452 enew!
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
1453 call append('$', 'A')
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
1454 call cursor(2, 1)
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
1455 call assert_equal(2, search('A', 'bce', line('.')))
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
1456 enew!
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
1457 let &encoding = save_enc
cb9b2774f21f patch 8.0.1271: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12763
diff changeset
1458 endfunc
13043
307f2622826f patch 8.0.1397: pattern with & following nothing gives an error
Christian Brabandt <cb@256bit.org>
parents: 12855
diff changeset
1459
307f2622826f patch 8.0.1397: pattern with & following nothing gives an error
Christian Brabandt <cb@256bit.org>
parents: 12855
diff changeset
1460 " This was causing E874. Also causes an invalid read?
307f2622826f patch 8.0.1397: pattern with & following nothing gives an error
Christian Brabandt <cb@256bit.org>
parents: 12855
diff changeset
1461 func Test_look_behind()
307f2622826f patch 8.0.1397: pattern with & following nothing gives an error
Christian Brabandt <cb@256bit.org>
parents: 12855
diff changeset
1462 new
18935
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
1463 call setline(1, '0\|\&\n\@<=')
13043
307f2622826f patch 8.0.1397: pattern with & following nothing gives an error
Christian Brabandt <cb@256bit.org>
parents: 12855
diff changeset
1464 call search(getline("."))
307f2622826f patch 8.0.1397: pattern with & following nothing gives an error
Christian Brabandt <cb@256bit.org>
parents: 12855
diff changeset
1465 bwipe!
307f2622826f patch 8.0.1397: pattern with & following nothing gives an error
Christian Brabandt <cb@256bit.org>
parents: 12855
diff changeset
1466 endfunc
13082
a80082fd1a1d patch 8.0.1416: crash when searching for a sentence
Christian Brabandt <cb@256bit.org>
parents: 13043
diff changeset
1467
24693
97789fcef0cf patch 8.2.2885: searching for %'> does not match linewise end of line
Bram Moolenaar <Bram@vim.org>
parents: 24514
diff changeset
1468 func Test_search_visual_area_linewise()
97789fcef0cf patch 8.2.2885: searching for %'> does not match linewise end of line
Bram Moolenaar <Bram@vim.org>
parents: 24514
diff changeset
1469 new
97789fcef0cf patch 8.2.2885: searching for %'> does not match linewise end of line
Bram Moolenaar <Bram@vim.org>
parents: 24514
diff changeset
1470 call setline(1, ['aa', 'bb', 'cc'])
97789fcef0cf patch 8.2.2885: searching for %'> does not match linewise end of line
Bram Moolenaar <Bram@vim.org>
parents: 24514
diff changeset
1471 exe "normal 2GV\<Esc>"
97789fcef0cf patch 8.2.2885: searching for %'> does not match linewise end of line
Bram Moolenaar <Bram@vim.org>
parents: 24514
diff changeset
1472 for engine in [1, 2]
97789fcef0cf patch 8.2.2885: searching for %'> does not match linewise end of line
Bram Moolenaar <Bram@vim.org>
parents: 24514
diff changeset
1473 exe 'set regexpengine=' .. engine
97789fcef0cf patch 8.2.2885: searching for %'> does not match linewise end of line
Bram Moolenaar <Bram@vim.org>
parents: 24514
diff changeset
1474 exe "normal gg/\\%'<\<CR>>"
97789fcef0cf patch 8.2.2885: searching for %'> does not match linewise end of line
Bram Moolenaar <Bram@vim.org>
parents: 24514
diff changeset
1475 call assert_equal([0, 2, 1, 0, 1], getcurpos(), 'engine ' .. engine)
97789fcef0cf patch 8.2.2885: searching for %'> does not match linewise end of line
Bram Moolenaar <Bram@vim.org>
parents: 24514
diff changeset
1476 exe "normal gg/\\%'>\<CR>"
97789fcef0cf patch 8.2.2885: searching for %'> does not match linewise end of line
Bram Moolenaar <Bram@vim.org>
parents: 24514
diff changeset
1477 call assert_equal([0, 2, 2, 0, 2], getcurpos(), 'engine ' .. engine)
97789fcef0cf patch 8.2.2885: searching for %'> does not match linewise end of line
Bram Moolenaar <Bram@vim.org>
parents: 24514
diff changeset
1478 endfor
97789fcef0cf patch 8.2.2885: searching for %'> does not match linewise end of line
Bram Moolenaar <Bram@vim.org>
parents: 24514
diff changeset
1479
97789fcef0cf patch 8.2.2885: searching for %'> does not match linewise end of line
Bram Moolenaar <Bram@vim.org>
parents: 24514
diff changeset
1480 bwipe!
97789fcef0cf patch 8.2.2885: searching for %'> does not match linewise end of line
Bram Moolenaar <Bram@vim.org>
parents: 24514
diff changeset
1481 set regexpengine&
97789fcef0cf patch 8.2.2885: searching for %'> does not match linewise end of line
Bram Moolenaar <Bram@vim.org>
parents: 24514
diff changeset
1482 endfunc
97789fcef0cf patch 8.2.2885: searching for %'> does not match linewise end of line
Bram Moolenaar <Bram@vim.org>
parents: 24514
diff changeset
1483
13082
a80082fd1a1d patch 8.0.1416: crash when searching for a sentence
Christian Brabandt <cb@256bit.org>
parents: 13043
diff changeset
1484 func Test_search_sentence()
a80082fd1a1d patch 8.0.1416: crash when searching for a sentence
Christian Brabandt <cb@256bit.org>
parents: 13043
diff changeset
1485 new
a80082fd1a1d patch 8.0.1416: crash when searching for a sentence
Christian Brabandt <cb@256bit.org>
parents: 13043
diff changeset
1486 " this used to cause a crash
13084
25ab78f14c8b patch 8.0.1417: test doesn't search for a sentence
Christian Brabandt <cb@256bit.org>
parents: 13082
diff changeset
1487 /\%'(
25ab78f14c8b patch 8.0.1417: test doesn't search for a sentence
Christian Brabandt <cb@256bit.org>
parents: 13082
diff changeset
1488 /
24693
97789fcef0cf patch 8.2.2885: searching for %'> does not match linewise end of line
Bram Moolenaar <Bram@vim.org>
parents: 24514
diff changeset
1489 bwipe
13082
a80082fd1a1d patch 8.0.1416: crash when searching for a sentence
Christian Brabandt <cb@256bit.org>
parents: 13043
diff changeset
1490 endfunc
15089
e428882d6ffb patch 8.1.0555: crash when last search pat is set but not last substitute pat
Bram Moolenaar <Bram@vim.org>
parents: 14774
diff changeset
1491
e428882d6ffb patch 8.1.0555: crash when last search pat is set but not last substitute pat
Bram Moolenaar <Bram@vim.org>
parents: 14774
diff changeset
1492 " Test that there is no crash when there is a last search pattern but no last
e428882d6ffb patch 8.1.0555: crash when last search pat is set but not last substitute pat
Bram Moolenaar <Bram@vim.org>
parents: 14774
diff changeset
1493 " substitute pattern.
e428882d6ffb patch 8.1.0555: crash when last search pat is set but not last substitute pat
Bram Moolenaar <Bram@vim.org>
parents: 14774
diff changeset
1494 func Test_no_last_substitute_pat()
e428882d6ffb patch 8.1.0555: crash when last search pat is set but not last substitute pat
Bram Moolenaar <Bram@vim.org>
parents: 14774
diff changeset
1495 " Use viminfo to set the last search pattern to a string and make the last
e428882d6ffb patch 8.1.0555: crash when last search pat is set but not last substitute pat
Bram Moolenaar <Bram@vim.org>
parents: 14774
diff changeset
1496 " substitute pattern the most recent used and make it empty (NULL).
30769
ae10b91ac6b3 patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 29277
diff changeset
1497 call writefile(['~MSle0/bar', '~MSle0~&'], 'Xviminfo', 'D')
15089
e428882d6ffb patch 8.1.0555: crash when last search pat is set but not last substitute pat
Bram Moolenaar <Bram@vim.org>
parents: 14774
diff changeset
1498 rviminfo! Xviminfo
e428882d6ffb patch 8.1.0555: crash when last search pat is set but not last substitute pat
Bram Moolenaar <Bram@vim.org>
parents: 14774
diff changeset
1499 call assert_fails('normal n', 'E35:')
e428882d6ffb patch 8.1.0555: crash when last search pat is set but not last substitute pat
Bram Moolenaar <Bram@vim.org>
parents: 14774
diff changeset
1500 endfunc
15148
27ba8d007a86 patch 8.1.0584: with search CTRL-L does not pick up composing characters
Bram Moolenaar <Bram@vim.org>
parents: 15089
diff changeset
1501
27ba8d007a86 patch 8.1.0584: with search CTRL-L does not pick up composing characters
Bram Moolenaar <Bram@vim.org>
parents: 15089
diff changeset
1502 func Test_search_Ctrl_L_combining()
27ba8d007a86 patch 8.1.0584: with search CTRL-L does not pick up composing characters
Bram Moolenaar <Bram@vim.org>
parents: 15089
diff changeset
1503 " Make sure, that Ctrl-L works correctly with combining characters.
27ba8d007a86 patch 8.1.0584: with search CTRL-L does not pick up composing characters
Bram Moolenaar <Bram@vim.org>
parents: 15089
diff changeset
1504 " It uses an artificial example of an 'a' with 4 combining chars:
18935
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
1505 " 'a' U+0061 Dec:97 LATIN SMALL LETTER A &#x61; /\%u61\Z "\u0061"
15148
27ba8d007a86 patch 8.1.0584: with search CTRL-L does not pick up composing characters
Bram Moolenaar <Bram@vim.org>
parents: 15089
diff changeset
1506 " ' ̀' U+0300 Dec:768 COMBINING GRAVE ACCENT &#x300; /\%u300\Z "\u0300"
27ba8d007a86 patch 8.1.0584: with search CTRL-L does not pick up composing characters
Bram Moolenaar <Bram@vim.org>
parents: 15089
diff changeset
1507 " ' ́' U+0301 Dec:769 COMBINING ACUTE ACCENT &#x301; /\%u301\Z "\u0301"
27ba8d007a86 patch 8.1.0584: with search CTRL-L does not pick up composing characters
Bram Moolenaar <Bram@vim.org>
parents: 15089
diff changeset
1508 " ' ̇' U+0307 Dec:775 COMBINING DOT ABOVE &#x307; /\%u307\Z "\u0307"
18935
ed246d4c46ba patch 8.2.0028: searchpairpos() is not tested
Bram Moolenaar <Bram@vim.org>
parents: 18693
diff changeset
1509 " ' ̣' U+0323 Dec:803 COMBINING DOT BELOW &#x323; /\%u323 "\u0323"
15148
27ba8d007a86 patch 8.1.0584: with search CTRL-L does not pick up composing characters
Bram Moolenaar <Bram@vim.org>
parents: 15089
diff changeset
1510 " Those should also appear on the commandline
19705
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
1511 CheckOption incsearch
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
1512
15148
27ba8d007a86 patch 8.1.0584: with search CTRL-L does not pick up composing characters
Bram Moolenaar <Bram@vim.org>
parents: 15089
diff changeset
1513 call Cmdline3_prep()
27ba8d007a86 patch 8.1.0584: with search CTRL-L does not pick up composing characters
Bram Moolenaar <Bram@vim.org>
parents: 15089
diff changeset
1514 1
27ba8d007a86 patch 8.1.0584: with search CTRL-L does not pick up composing characters
Bram Moolenaar <Bram@vim.org>
parents: 15089
diff changeset
1515 let bufcontent = ['', 'Miạ̀́̇m']
27ba8d007a86 patch 8.1.0584: with search CTRL-L does not pick up composing characters
Bram Moolenaar <Bram@vim.org>
parents: 15089
diff changeset
1516 call append('$', bufcontent)
27ba8d007a86 patch 8.1.0584: with search CTRL-L does not pick up composing characters
Bram Moolenaar <Bram@vim.org>
parents: 15089
diff changeset
1517 call feedkeys("/Mi\<c-l>\<c-l>\<cr>", 'tx')
27ba8d007a86 patch 8.1.0584: with search CTRL-L does not pick up composing characters
Bram Moolenaar <Bram@vim.org>
parents: 15089
diff changeset
1518 call assert_equal(5, line('.'))
27ba8d007a86 patch 8.1.0584: with search CTRL-L does not pick up composing characters
Bram Moolenaar <Bram@vim.org>
parents: 15089
diff changeset
1519 call assert_equal(bufcontent[1], @/)
27ba8d007a86 patch 8.1.0584: with search CTRL-L does not pick up composing characters
Bram Moolenaar <Bram@vim.org>
parents: 15089
diff changeset
1520 call Incsearch_cleanup()
27ba8d007a86 patch 8.1.0584: with search CTRL-L does not pick up composing characters
Bram Moolenaar <Bram@vim.org>
parents: 15089
diff changeset
1521 endfunc
15924
98d315176d48 patch 8.1.0968: crash when using search pattern %Ufffffc23
Bram Moolenaar <Bram@vim.org>
parents: 15918
diff changeset
1522
15959
4feaa025491b patch 8.1.0985: crash with large number in regexp
Bram Moolenaar <Bram@vim.org>
parents: 15935
diff changeset
1523 func Test_large_hex_chars1()
15924
98d315176d48 patch 8.1.0968: crash when using search pattern %Ufffffc23
Bram Moolenaar <Bram@vim.org>
parents: 15918
diff changeset
1524 " This used to cause a crash, the character becomes an NFA state.
98d315176d48 patch 8.1.0968: crash when using search pattern %Ufffffc23
Bram Moolenaar <Bram@vim.org>
parents: 15918
diff changeset
1525 try
98d315176d48 patch 8.1.0968: crash when using search pattern %Ufffffc23
Bram Moolenaar <Bram@vim.org>
parents: 15918
diff changeset
1526 /\%Ufffffc23
98d315176d48 patch 8.1.0968: crash when using search pattern %Ufffffc23
Bram Moolenaar <Bram@vim.org>
parents: 15918
diff changeset
1527 catch
98d315176d48 patch 8.1.0968: crash when using search pattern %Ufffffc23
Bram Moolenaar <Bram@vim.org>
parents: 15918
diff changeset
1528 call assert_match('E678:', v:exception)
98d315176d48 patch 8.1.0968: crash when using search pattern %Ufffffc23
Bram Moolenaar <Bram@vim.org>
parents: 15918
diff changeset
1529 endtry
15959
4feaa025491b patch 8.1.0985: crash with large number in regexp
Bram Moolenaar <Bram@vim.org>
parents: 15935
diff changeset
1530 try
4feaa025491b patch 8.1.0985: crash with large number in regexp
Bram Moolenaar <Bram@vim.org>
parents: 15935
diff changeset
1531 set re=1
4feaa025491b patch 8.1.0985: crash with large number in regexp
Bram Moolenaar <Bram@vim.org>
parents: 15935
diff changeset
1532 /\%Ufffffc23
4feaa025491b patch 8.1.0985: crash with large number in regexp
Bram Moolenaar <Bram@vim.org>
parents: 15935
diff changeset
1533 catch
4feaa025491b patch 8.1.0985: crash with large number in regexp
Bram Moolenaar <Bram@vim.org>
parents: 15935
diff changeset
1534 call assert_match('E678:', v:exception)
4feaa025491b patch 8.1.0985: crash with large number in regexp
Bram Moolenaar <Bram@vim.org>
parents: 15935
diff changeset
1535 endtry
4feaa025491b patch 8.1.0985: crash with large number in regexp
Bram Moolenaar <Bram@vim.org>
parents: 15935
diff changeset
1536 set re&
4feaa025491b patch 8.1.0985: crash with large number in regexp
Bram Moolenaar <Bram@vim.org>
parents: 15935
diff changeset
1537 endfunc
4feaa025491b patch 8.1.0985: crash with large number in regexp
Bram Moolenaar <Bram@vim.org>
parents: 15935
diff changeset
1538
4feaa025491b patch 8.1.0985: crash with large number in regexp
Bram Moolenaar <Bram@vim.org>
parents: 15935
diff changeset
1539 func Test_large_hex_chars2()
4feaa025491b patch 8.1.0985: crash with large number in regexp
Bram Moolenaar <Bram@vim.org>
parents: 15935
diff changeset
1540 " This used to cause a crash, the character becomes an NFA state.
4feaa025491b patch 8.1.0985: crash with large number in regexp
Bram Moolenaar <Bram@vim.org>
parents: 15935
diff changeset
1541 try
4feaa025491b patch 8.1.0985: crash with large number in regexp
Bram Moolenaar <Bram@vim.org>
parents: 15935
diff changeset
1542 /[\Ufffffc1f]
4feaa025491b patch 8.1.0985: crash with large number in regexp
Bram Moolenaar <Bram@vim.org>
parents: 15935
diff changeset
1543 catch
4feaa025491b patch 8.1.0985: crash with large number in regexp
Bram Moolenaar <Bram@vim.org>
parents: 15935
diff changeset
1544 call assert_match('E486:', v:exception)
4feaa025491b patch 8.1.0985: crash with large number in regexp
Bram Moolenaar <Bram@vim.org>
parents: 15935
diff changeset
1545 endtry
4feaa025491b patch 8.1.0985: crash with large number in regexp
Bram Moolenaar <Bram@vim.org>
parents: 15935
diff changeset
1546 try
4feaa025491b patch 8.1.0985: crash with large number in regexp
Bram Moolenaar <Bram@vim.org>
parents: 15935
diff changeset
1547 set re=1
4feaa025491b patch 8.1.0985: crash with large number in regexp
Bram Moolenaar <Bram@vim.org>
parents: 15935
diff changeset
1548 /[\Ufffffc1f]
4feaa025491b patch 8.1.0985: crash with large number in regexp
Bram Moolenaar <Bram@vim.org>
parents: 15935
diff changeset
1549 catch
4feaa025491b patch 8.1.0985: crash with large number in regexp
Bram Moolenaar <Bram@vim.org>
parents: 15935
diff changeset
1550 call assert_match('E486:', v:exception)
4feaa025491b patch 8.1.0985: crash with large number in regexp
Bram Moolenaar <Bram@vim.org>
parents: 15935
diff changeset
1551 endtry
4feaa025491b patch 8.1.0985: crash with large number in regexp
Bram Moolenaar <Bram@vim.org>
parents: 15935
diff changeset
1552 set re&
15924
98d315176d48 patch 8.1.0968: crash when using search pattern %Ufffffc23
Bram Moolenaar <Bram@vim.org>
parents: 15918
diff changeset
1553 endfunc
15935
ff00d207cc5e patch 8.1.0973: pattern with syntax error gives threee error messages
Bram Moolenaar <Bram@vim.org>
parents: 15924
diff changeset
1554
ff00d207cc5e patch 8.1.0973: pattern with syntax error gives threee error messages
Bram Moolenaar <Bram@vim.org>
parents: 15924
diff changeset
1555 func Test_one_error_msg()
19973
9f5758ee0b10 patch 8.2.0542: no test for E386
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
1556 " This was also giving an internal error
15935
ff00d207cc5e patch 8.1.0973: pattern with syntax error gives threee error messages
Bram Moolenaar <Bram@vim.org>
parents: 15924
diff changeset
1557 call assert_fails('call search(" \\((\\v[[=P=]]){185}+ ")', 'E871:')
ff00d207cc5e patch 8.1.0973: pattern with syntax error gives threee error messages
Bram Moolenaar <Bram@vim.org>
parents: 15924
diff changeset
1558 endfunc
16287
a6cffc232b9d patch 8.1.1148: CTRL-L with 'incsearch' does not pick up char under cursor
Bram Moolenaar <Bram@vim.org>
parents: 15959
diff changeset
1559
a6cffc232b9d patch 8.1.1148: CTRL-L with 'incsearch' does not pick up char under cursor
Bram Moolenaar <Bram@vim.org>
parents: 15959
diff changeset
1560 func Test_incsearch_add_char_under_cursor()
19705
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
1561 CheckOption incsearch
599793519c85 patch 8.2.0409: search test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 19475
diff changeset
1562
16287
a6cffc232b9d patch 8.1.1148: CTRL-L with 'incsearch' does not pick up char under cursor
Bram Moolenaar <Bram@vim.org>
parents: 15959
diff changeset
1563 set incsearch
a6cffc232b9d patch 8.1.1148: CTRL-L with 'incsearch' does not pick up char under cursor
Bram Moolenaar <Bram@vim.org>
parents: 15959
diff changeset
1564 new
a6cffc232b9d patch 8.1.1148: CTRL-L with 'incsearch' does not pick up char under cursor
Bram Moolenaar <Bram@vim.org>
parents: 15959
diff changeset
1565 call setline(1, ['find match', 'anything'])
a6cffc232b9d patch 8.1.1148: CTRL-L with 'incsearch' does not pick up char under cursor
Bram Moolenaar <Bram@vim.org>
parents: 15959
diff changeset
1566 1
a6cffc232b9d patch 8.1.1148: CTRL-L with 'incsearch' does not pick up char under cursor
Bram Moolenaar <Bram@vim.org>
parents: 15959
diff changeset
1567 call test_override('char_avail', 1)
a6cffc232b9d patch 8.1.1148: CTRL-L with 'incsearch' does not pick up char under cursor
Bram Moolenaar <Bram@vim.org>
parents: 15959
diff changeset
1568 call feedkeys("fc/m\<C-L>\<C-L>\<C-L>\<C-L>\<C-L>\<CR>", 'tx')
a6cffc232b9d patch 8.1.1148: CTRL-L with 'incsearch' does not pick up char under cursor
Bram Moolenaar <Bram@vim.org>
parents: 15959
diff changeset
1569 call assert_equal('match', @/)
a6cffc232b9d patch 8.1.1148: CTRL-L with 'incsearch' does not pick up char under cursor
Bram Moolenaar <Bram@vim.org>
parents: 15959
diff changeset
1570 call test_override('char_avail', 0)
a6cffc232b9d patch 8.1.1148: CTRL-L with 'incsearch' does not pick up char under cursor
Bram Moolenaar <Bram@vim.org>
parents: 15959
diff changeset
1571
a6cffc232b9d patch 8.1.1148: CTRL-L with 'incsearch' does not pick up char under cursor
Bram Moolenaar <Bram@vim.org>
parents: 15959
diff changeset
1572 set incsearch&
a6cffc232b9d patch 8.1.1148: CTRL-L with 'incsearch' does not pick up char under cursor
Bram Moolenaar <Bram@vim.org>
parents: 15959
diff changeset
1573 bwipe!
a6cffc232b9d patch 8.1.1148: CTRL-L with 'incsearch' does not pick up char under cursor
Bram Moolenaar <Bram@vim.org>
parents: 15959
diff changeset
1574 endfunc
16419
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 16287
diff changeset
1575
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 16287
diff changeset
1576 " Test for the search() function with match at the cursor position
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 16287
diff changeset
1577 func Test_search_match_at_curpos()
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 16287
diff changeset
1578 new
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 16287
diff changeset
1579 call append(0, ['foobar', '', 'one two', ''])
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 16287
diff changeset
1580
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 16287
diff changeset
1581 normal gg
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 16287
diff changeset
1582
17994
0dcc2ee838dd patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17918
diff changeset
1583 eval 'foobar'->search('c')
16419
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 16287
diff changeset
1584 call assert_equal([1, 1], [line('.'), col('.')])
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 16287
diff changeset
1585
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 16287
diff changeset
1586 normal j
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 16287
diff changeset
1587 call search('^$', 'c')
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 16287
diff changeset
1588 call assert_equal([2, 1], [line('.'), col('.')])
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 16287
diff changeset
1589
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 16287
diff changeset
1590 call search('^$', 'bc')
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 16287
diff changeset
1591 call assert_equal([2, 1], [line('.'), col('.')])
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 16287
diff changeset
1592
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 16287
diff changeset
1593 exe "normal /two\<CR>"
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 16287
diff changeset
1594 call search('.', 'c')
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 16287
diff changeset
1595 call assert_equal([3, 5], [line('.'), col('.')])
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 16287
diff changeset
1596
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 16287
diff changeset
1597 close!
aebcd20a8a3f patch 8.1.1214: old style tests
Bram Moolenaar <Bram@vim.org>
parents: 16287
diff changeset
1598 endfunc
16949
a32169a40566 patch 8.1.1475: search string not displayed when 'rightleft' is set
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
1599
19783
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19705
diff changeset
1600 " Test for error cases with the search() function
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19705
diff changeset
1601 func Test_search_errors()
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19705
diff changeset
1602 call assert_fails("call search('pat', [])", 'E730:')
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19705
diff changeset
1603 call assert_fails("call search('pat', 'b', {})", 'E728:')
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19705
diff changeset
1604 call assert_fails("call search('pat', 'b', 1, [])", 'E745:')
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19705
diff changeset
1605 call assert_fails("call search('pat', 'ns')", 'E475:')
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19705
diff changeset
1606 call assert_fails("call search('pat', 'mr')", 'E475:')
19973
9f5758ee0b10 patch 8.2.0542: no test for E386
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
1607
9f5758ee0b10 patch 8.2.0542: no test for E386
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
1608 new
9f5758ee0b10 patch 8.2.0542: no test for E386
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
1609 call setline(1, ['foo', 'bar'])
9f5758ee0b10 patch 8.2.0542: no test for E386
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
1610 call assert_fails('call feedkeys("/foo/;/bar/;\<CR>", "tx")', 'E386:')
9f5758ee0b10 patch 8.2.0542: no test for E386
Bram Moolenaar <Bram@vim.org>
parents: 19969
diff changeset
1611 bwipe!
19783
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19705
diff changeset
1612 endfunc
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19705
diff changeset
1613
29071
b90bca860b5a patch 8.2.5057: using gettimeofday() for timeout is very inefficient
Bram Moolenaar <Bram@vim.org>
parents: 29050
diff changeset
1614 func Test_search_timeout()
29243
cdb22dde06b9 patch 8.2.5140: seachpair timeout test is flaky
Bram Moolenaar <Bram@vim.org>
parents: 29234
diff changeset
1615 let g:test_is_flaky = 1
29071
b90bca860b5a patch 8.2.5057: using gettimeofday() for timeout is very inefficient
Bram Moolenaar <Bram@vim.org>
parents: 29050
diff changeset
1616 new
29191
0af5fe160e4e patch 8.2.5115: search timeout is overrun with some patterns
Bram Moolenaar <Bram@vim.org>
parents: 29189
diff changeset
1617 " use a complicated pattern that should be slow with the BT engine
29071
b90bca860b5a patch 8.2.5057: using gettimeofday() for timeout is very inefficient
Bram Moolenaar <Bram@vim.org>
parents: 29050
diff changeset
1618 let pattern = '\%#=1a*.*X\@<=b*'
29191
0af5fe160e4e patch 8.2.5115: search timeout is overrun with some patterns
Bram Moolenaar <Bram@vim.org>
parents: 29189
diff changeset
1619
0af5fe160e4e patch 8.2.5115: search timeout is overrun with some patterns
Bram Moolenaar <Bram@vim.org>
parents: 29189
diff changeset
1620 " use a timeout of 50 msec
0af5fe160e4e patch 8.2.5115: search timeout is overrun with some patterns
Bram Moolenaar <Bram@vim.org>
parents: 29189
diff changeset
1621 let search_timeout = 0.05
0af5fe160e4e patch 8.2.5115: search timeout is overrun with some patterns
Bram Moolenaar <Bram@vim.org>
parents: 29189
diff changeset
1622
0af5fe160e4e patch 8.2.5115: search timeout is overrun with some patterns
Bram Moolenaar <Bram@vim.org>
parents: 29189
diff changeset
1623 " fill the buffer so that it takes 15 times the timeout to search
29071
b90bca860b5a patch 8.2.5057: using gettimeofday() for timeout is very inefficient
Bram Moolenaar <Bram@vim.org>
parents: 29050
diff changeset
1624 let slow_target_timeout = search_timeout * 15.0
b90bca860b5a patch 8.2.5057: using gettimeofday() for timeout is very inefficient
Bram Moolenaar <Bram@vim.org>
parents: 29050
diff changeset
1625
29191
0af5fe160e4e patch 8.2.5115: search timeout is overrun with some patterns
Bram Moolenaar <Bram@vim.org>
parents: 29189
diff changeset
1626 " Fill the buffer with more and more text until searching takes more time
0af5fe160e4e patch 8.2.5115: search timeout is overrun with some patterns
Bram Moolenaar <Bram@vim.org>
parents: 29189
diff changeset
1627 " than slow_target_timeout.
29071
b90bca860b5a patch 8.2.5057: using gettimeofday() for timeout is very inefficient
Bram Moolenaar <Bram@vim.org>
parents: 29050
diff changeset
1628 for n in range(40, 400, 30)
b90bca860b5a patch 8.2.5057: using gettimeofday() for timeout is very inefficient
Bram Moolenaar <Bram@vim.org>
parents: 29050
diff changeset
1629 call setline(1, ['aaa', repeat('abc ', n), 'ccc'])
b90bca860b5a patch 8.2.5057: using gettimeofday() for timeout is very inefficient
Bram Moolenaar <Bram@vim.org>
parents: 29050
diff changeset
1630 let start = reltime()
b90bca860b5a patch 8.2.5057: using gettimeofday() for timeout is very inefficient
Bram Moolenaar <Bram@vim.org>
parents: 29050
diff changeset
1631 call search(pattern, '', 0)
b90bca860b5a patch 8.2.5057: using gettimeofday() for timeout is very inefficient
Bram Moolenaar <Bram@vim.org>
parents: 29050
diff changeset
1632 let elapsed = reltimefloat(reltime(start))
b90bca860b5a patch 8.2.5057: using gettimeofday() for timeout is very inefficient
Bram Moolenaar <Bram@vim.org>
parents: 29050
diff changeset
1633 if elapsed > slow_target_timeout
b90bca860b5a patch 8.2.5057: using gettimeofday() for timeout is very inefficient
Bram Moolenaar <Bram@vim.org>
parents: 29050
diff changeset
1634 break
b90bca860b5a patch 8.2.5057: using gettimeofday() for timeout is very inefficient
Bram Moolenaar <Bram@vim.org>
parents: 29050
diff changeset
1635 endif
b90bca860b5a patch 8.2.5057: using gettimeofday() for timeout is very inefficient
Bram Moolenaar <Bram@vim.org>
parents: 29050
diff changeset
1636 endfor
b90bca860b5a patch 8.2.5057: using gettimeofday() for timeout is very inefficient
Bram Moolenaar <Bram@vim.org>
parents: 29050
diff changeset
1637 call assert_true(elapsed > slow_target_timeout)
b90bca860b5a patch 8.2.5057: using gettimeofday() for timeout is very inefficient
Bram Moolenaar <Bram@vim.org>
parents: 29050
diff changeset
1638
29191
0af5fe160e4e patch 8.2.5115: search timeout is overrun with some patterns
Bram Moolenaar <Bram@vim.org>
parents: 29189
diff changeset
1639 " Check that the timeout kicks in, the time should be less than half of what
0af5fe160e4e patch 8.2.5115: search timeout is overrun with some patterns
Bram Moolenaar <Bram@vim.org>
parents: 29189
diff changeset
1640 " we measured without the timeout. This is permissive, because the timer is
0af5fe160e4e patch 8.2.5115: search timeout is overrun with some patterns
Bram Moolenaar <Bram@vim.org>
parents: 29189
diff changeset
1641 " known to overrun, especially when using valgrind.
29071
b90bca860b5a patch 8.2.5057: using gettimeofday() for timeout is very inefficient
Bram Moolenaar <Bram@vim.org>
parents: 29050
diff changeset
1642 let max_time = elapsed / 2.0
b90bca860b5a patch 8.2.5057: using gettimeofday() for timeout is very inefficient
Bram Moolenaar <Bram@vim.org>
parents: 29050
diff changeset
1643 let start = reltime()
b90bca860b5a patch 8.2.5057: using gettimeofday() for timeout is very inefficient
Bram Moolenaar <Bram@vim.org>
parents: 29050
diff changeset
1644 call search(pattern, '', 0, float2nr(search_timeout * 1000))
b90bca860b5a patch 8.2.5057: using gettimeofday() for timeout is very inefficient
Bram Moolenaar <Bram@vim.org>
parents: 29050
diff changeset
1645 let elapsed = reltimefloat(reltime(start))
29191
0af5fe160e4e patch 8.2.5115: search timeout is overrun with some patterns
Bram Moolenaar <Bram@vim.org>
parents: 29189
diff changeset
1646 call assert_inrange(search_timeout * 0.9, max_time, elapsed)
29071
b90bca860b5a patch 8.2.5057: using gettimeofday() for timeout is very inefficient
Bram Moolenaar <Bram@vim.org>
parents: 29050
diff changeset
1647
b90bca860b5a patch 8.2.5057: using gettimeofday() for timeout is very inefficient
Bram Moolenaar <Bram@vim.org>
parents: 29050
diff changeset
1648 bwipe!
b90bca860b5a patch 8.2.5057: using gettimeofday() for timeout is very inefficient
Bram Moolenaar <Bram@vim.org>
parents: 29050
diff changeset
1649 endfunc
b90bca860b5a patch 8.2.5057: using gettimeofday() for timeout is very inefficient
Bram Moolenaar <Bram@vim.org>
parents: 29050
diff changeset
1650
16949
a32169a40566 patch 8.1.1475: search string not displayed when 'rightleft' is set
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
1651 func Test_search_display_pattern()
a32169a40566 patch 8.1.1475: search string not displayed when 'rightleft' is set
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
1652 new
a32169a40566 patch 8.1.1475: search string not displayed when 'rightleft' is set
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
1653 call setline(1, ['foo', 'bar', 'foobar'])
a32169a40566 patch 8.1.1475: search string not displayed when 'rightleft' is set
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
1654
a32169a40566 patch 8.1.1475: search string not displayed when 'rightleft' is set
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
1655 call cursor(1, 1)
a32169a40566 patch 8.1.1475: search string not displayed when 'rightleft' is set
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
1656 let @/ = 'foo'
17849
73ddc462979d patch 8.1.1921: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
1657 let pat = @/->escape('()*?'. '\s\+')
16949
a32169a40566 patch 8.1.1475: search string not displayed when 'rightleft' is set
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
1658 let g:a = execute(':unsilent :norm! n')
a32169a40566 patch 8.1.1475: search string not displayed when 'rightleft' is set
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
1659 call assert_match(pat, g:a)
a32169a40566 patch 8.1.1475: search string not displayed when 'rightleft' is set
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
1660
a32169a40566 patch 8.1.1475: search string not displayed when 'rightleft' is set
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
1661 " right-left
a32169a40566 patch 8.1.1475: search string not displayed when 'rightleft' is set
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
1662 if exists("+rightleft")
a32169a40566 patch 8.1.1475: search string not displayed when 'rightleft' is set
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
1663 set rl
a32169a40566 patch 8.1.1475: search string not displayed when 'rightleft' is set
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
1664 call cursor(1, 1)
a32169a40566 patch 8.1.1475: search string not displayed when 'rightleft' is set
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
1665 let @/ = 'foo'
a32169a40566 patch 8.1.1475: search string not displayed when 'rightleft' is set
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
1666 let pat = 'oof/\s\+'
a32169a40566 patch 8.1.1475: search string not displayed when 'rightleft' is set
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
1667 let g:a = execute(':unsilent :norm! n')
a32169a40566 patch 8.1.1475: search string not displayed when 'rightleft' is set
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
1668 call assert_match(pat, g:a)
a32169a40566 patch 8.1.1475: search string not displayed when 'rightleft' is set
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
1669 set norl
a32169a40566 patch 8.1.1475: search string not displayed when 'rightleft' is set
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
1670 endif
a32169a40566 patch 8.1.1475: search string not displayed when 'rightleft' is set
Bram Moolenaar <Bram@vim.org>
parents: 16419
diff changeset
1671 endfunc
17994
0dcc2ee838dd patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17918
diff changeset
1672
0dcc2ee838dd patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17918
diff changeset
1673 func Test_searchdecl()
0dcc2ee838dd patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17918
diff changeset
1674 let lines =<< trim END
0dcc2ee838dd patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17918
diff changeset
1675 int global;
0dcc2ee838dd patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17918
diff changeset
1676
0dcc2ee838dd patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17918
diff changeset
1677 func()
0dcc2ee838dd patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17918
diff changeset
1678 {
0dcc2ee838dd patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17918
diff changeset
1679 int global;
0dcc2ee838dd patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17918
diff changeset
1680 if (cond) {
0dcc2ee838dd patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17918
diff changeset
1681 int local;
0dcc2ee838dd patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17918
diff changeset
1682 }
0dcc2ee838dd patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17918
diff changeset
1683 int local;
0dcc2ee838dd patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17918
diff changeset
1684 // comment
0dcc2ee838dd patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17918
diff changeset
1685 }
0dcc2ee838dd patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17918
diff changeset
1686 END
0dcc2ee838dd patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17918
diff changeset
1687 new
0dcc2ee838dd patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17918
diff changeset
1688 call setline(1, lines)
0dcc2ee838dd patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17918
diff changeset
1689 10
0dcc2ee838dd patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17918
diff changeset
1690 call assert_equal(0, searchdecl('local', 0, 0))
0dcc2ee838dd patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17918
diff changeset
1691 call assert_equal(7, getcurpos()[1])
0dcc2ee838dd patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17918
diff changeset
1692
0dcc2ee838dd patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17918
diff changeset
1693 10
0dcc2ee838dd patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17918
diff changeset
1694 call assert_equal(0, 'local'->searchdecl(0, 1))
0dcc2ee838dd patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17918
diff changeset
1695 call assert_equal(9, getcurpos()[1])
0dcc2ee838dd patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17918
diff changeset
1696
0dcc2ee838dd patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17918
diff changeset
1697 10
0dcc2ee838dd patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17918
diff changeset
1698 call assert_equal(0, searchdecl('global'))
0dcc2ee838dd patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17918
diff changeset
1699 call assert_equal(5, getcurpos()[1])
0dcc2ee838dd patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17918
diff changeset
1700
0dcc2ee838dd patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17918
diff changeset
1701 10
0dcc2ee838dd patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17918
diff changeset
1702 call assert_equal(0, searchdecl('global', 1))
0dcc2ee838dd patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17918
diff changeset
1703 call assert_equal(1, getcurpos()[1])
0dcc2ee838dd patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17918
diff changeset
1704
0dcc2ee838dd patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17918
diff changeset
1705 bwipe!
0dcc2ee838dd patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17918
diff changeset
1706 endfunc
19147
06ef1e438ac8 patch 8.2.0133: invalid memory access with search command
Bram Moolenaar <Bram@vim.org>
parents: 18935
diff changeset
1707
06ef1e438ac8 patch 8.2.0133: invalid memory access with search command
Bram Moolenaar <Bram@vim.org>
parents: 18935
diff changeset
1708 func Test_search_special()
19151
f12eda320c78 patch 8.2.0135: bracketed paste can still cause invalid memory access
Bram Moolenaar <Bram@vim.org>
parents: 19147
diff changeset
1709 " this was causing illegal memory access and an endless loop
f12eda320c78 patch 8.2.0135: bracketed paste can still cause invalid memory access
Bram Moolenaar <Bram@vim.org>
parents: 19147
diff changeset
1710 set t_PE=
19147
06ef1e438ac8 patch 8.2.0133: invalid memory access with search command
Bram Moolenaar <Bram@vim.org>
parents: 18935
diff changeset
1711 exe "norm /\x80PS"
06ef1e438ac8 patch 8.2.0133: invalid memory access with search command
Bram Moolenaar <Bram@vim.org>
parents: 18935
diff changeset
1712 endfunc
19308
6fd567c927c0 patch 8.2.0212: missing search/substitute pattern hardly tested
Bram Moolenaar <Bram@vim.org>
parents: 19151
diff changeset
1713
6fd567c927c0 patch 8.2.0212: missing search/substitute pattern hardly tested
Bram Moolenaar <Bram@vim.org>
parents: 19151
diff changeset
1714 " Test for command failures when the last search pattern is not set.
19370
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19308
diff changeset
1715 " Need to run this in a new vim instance where last search pattern is not set.
19308
6fd567c927c0 patch 8.2.0212: missing search/substitute pattern hardly tested
Bram Moolenaar <Bram@vim.org>
parents: 19151
diff changeset
1716 func Test_search_with_no_last_pat()
19370
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19308
diff changeset
1717 let lines =<< trim [SCRIPT]
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19308
diff changeset
1718 call assert_fails("normal i\<C-R>/\e", 'E35:')
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19308
diff changeset
1719 call assert_fails("exe '/'", 'E35:')
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19308
diff changeset
1720 call assert_fails("exe '?'", 'E35:')
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19308
diff changeset
1721 call assert_fails("/", 'E35:')
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19308
diff changeset
1722 call assert_fails("?", 'E35:')
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19308
diff changeset
1723 call assert_fails("normal n", 'E35:')
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19308
diff changeset
1724 call assert_fails("normal N", 'E35:')
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19308
diff changeset
1725 call assert_fails("normal gn", 'E35:')
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19308
diff changeset
1726 call assert_fails("normal gN", 'E35:')
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19308
diff changeset
1727 call assert_fails("normal cgn", 'E35:')
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19308
diff changeset
1728 call assert_fails("normal cgN", 'E35:')
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19308
diff changeset
1729 let p = []
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19308
diff changeset
1730 let p = @/
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19308
diff changeset
1731 call assert_equal('', p)
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19308
diff changeset
1732 call assert_fails("normal :\<C-R>/", 'E35:')
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19308
diff changeset
1733 call assert_fails("//p", 'E35:')
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19308
diff changeset
1734 call assert_fails(";//p", 'E35:')
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19308
diff changeset
1735 call assert_fails("??p", 'E35:')
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19308
diff changeset
1736 call assert_fails(";??p", 'E35:')
21265
6a4806e326dd patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents: 20739
diff changeset
1737 call assert_fails('g//p', ['E35:', 'E476:'])
6a4806e326dd patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents: 20739
diff changeset
1738 call assert_fails('v//p', ['E35:', 'E476:'])
19370
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19308
diff changeset
1739 call writefile(v:errors, 'Xresult')
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19308
diff changeset
1740 qall!
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19308
diff changeset
1741 [SCRIPT]
30769
ae10b91ac6b3 patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 29277
diff changeset
1742 call writefile(lines, 'Xscript', 'D')
19370
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19308
diff changeset
1743
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19308
diff changeset
1744 if RunVim([], [], '--clean -S Xscript')
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19308
diff changeset
1745 call assert_equal([], readfile('Xresult'))
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19308
diff changeset
1746 endif
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19308
diff changeset
1747 call delete('Xresult')
19308
6fd567c927c0 patch 8.2.0212: missing search/substitute pattern hardly tested
Bram Moolenaar <Bram@vim.org>
parents: 19151
diff changeset
1748 endfunc
6fd567c927c0 patch 8.2.0212: missing search/substitute pattern hardly tested
Bram Moolenaar <Bram@vim.org>
parents: 19151
diff changeset
1749
6fd567c927c0 patch 8.2.0212: missing search/substitute pattern hardly tested
Bram Moolenaar <Bram@vim.org>
parents: 19151
diff changeset
1750 " Test for using tilde (~) atom in search. This should use the last used
6fd567c927c0 patch 8.2.0212: missing search/substitute pattern hardly tested
Bram Moolenaar <Bram@vim.org>
parents: 19151
diff changeset
1751 " substitute pattern
6fd567c927c0 patch 8.2.0212: missing search/substitute pattern hardly tested
Bram Moolenaar <Bram@vim.org>
parents: 19151
diff changeset
1752 func Test_search_tilde_pat()
19370
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19308
diff changeset
1753 let lines =<< trim [SCRIPT]
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19308
diff changeset
1754 set regexpengine=1
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19308
diff changeset
1755 call assert_fails('exe "normal /~\<CR>"', 'E33:')
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19308
diff changeset
1756 call assert_fails('exe "normal ?~\<CR>"', 'E33:')
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19308
diff changeset
1757 set regexpengine=2
21265
6a4806e326dd patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents: 20739
diff changeset
1758 call assert_fails('exe "normal /~\<CR>"', ['E33:', 'E383:'])
6a4806e326dd patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents: 20739
diff changeset
1759 call assert_fails('exe "normal ?~\<CR>"', ['E33:', 'E383:'])
19370
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19308
diff changeset
1760 set regexpengine&
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19308
diff changeset
1761 call writefile(v:errors, 'Xresult')
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19308
diff changeset
1762 qall!
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19308
diff changeset
1763 [SCRIPT]
30769
ae10b91ac6b3 patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 29277
diff changeset
1764 call writefile(lines, 'Xscript', 'D')
19370
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19308
diff changeset
1765 if RunVim([], [], '--clean -S Xscript')
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19308
diff changeset
1766 call assert_equal([], readfile('Xresult'))
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19308
diff changeset
1767 endif
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19308
diff changeset
1768 call delete('Xresult')
19308
6fd567c927c0 patch 8.2.0212: missing search/substitute pattern hardly tested
Bram Moolenaar <Bram@vim.org>
parents: 19151
diff changeset
1769 endfunc
6fd567c927c0 patch 8.2.0212: missing search/substitute pattern hardly tested
Bram Moolenaar <Bram@vim.org>
parents: 19151
diff changeset
1770
19435
8f8a5a15d00a patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
1771 " Test for searching a pattern that is not present with 'nowrapscan'
8f8a5a15d00a patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
1772 func Test_search_pat_not_found()
8f8a5a15d00a patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
1773 new
8f8a5a15d00a patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
1774 set nowrapscan
8f8a5a15d00a patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
1775 let @/ = '1abcxyz2'
8f8a5a15d00a patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
1776 call assert_fails('normal n', 'E385:')
8f8a5a15d00a patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
1777 call assert_fails('normal N', 'E384:')
8f8a5a15d00a patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
1778 set wrapscan&
8f8a5a15d00a patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
1779 close
8f8a5a15d00a patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
1780 endfunc
8f8a5a15d00a patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
1781
8f8a5a15d00a patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
1782 " Test for v:searchforward variable
8f8a5a15d00a patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
1783 func Test_searchforward_var()
8f8a5a15d00a patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
1784 new
8f8a5a15d00a patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
1785 call setline(1, ['foo', '', 'foo'])
8f8a5a15d00a patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
1786 call cursor(2, 1)
8f8a5a15d00a patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
1787 let @/ = 'foo'
8f8a5a15d00a patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
1788 let v:searchforward = 0
8f8a5a15d00a patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
1789 normal N
8f8a5a15d00a patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
1790 call assert_equal(3, line('.'))
8f8a5a15d00a patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
1791 call cursor(2, 1)
8f8a5a15d00a patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
1792 let v:searchforward = 1
8f8a5a15d00a patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
1793 normal N
8f8a5a15d00a patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
1794 call assert_equal(1, line('.'))
8f8a5a15d00a patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
1795 close!
8f8a5a15d00a patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
1796 endfunc
8f8a5a15d00a patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
1797
19950
9cbe3a4f1492 patch 8.2.0531: various errors not tested
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
1798 " Test for invalid regular expressions
9cbe3a4f1492 patch 8.2.0531: various errors not tested
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
1799 func Test_invalid_regexp()
9cbe3a4f1492 patch 8.2.0531: various errors not tested
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
1800 set regexpengine=1
9cbe3a4f1492 patch 8.2.0531: various errors not tested
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
1801 call assert_fails("call search(repeat('\\(.\\)', 10))", 'E51:')
19958
0b42b5e50344 patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1802 call assert_fails("call search('\\%(')", 'E53:')
0b42b5e50344 patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1803 call assert_fails("call search('\\(')", 'E54:')
0b42b5e50344 patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1804 call assert_fails("call search('\\)')", 'E55:')
0b42b5e50344 patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1805 call assert_fails("call search('x\\@#')", 'E59:')
0b42b5e50344 patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1806 call assert_fails('call search(''\v%(%(%(%(%(%(%(%(%(%(%(a){1}){1}){1}){1}){1}){1}){1}){1}){1}){1}){1}'')', 'E60:')
19950
9cbe3a4f1492 patch 8.2.0531: various errors not tested
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
1807 call assert_fails("call search('a\\+*')", 'E61:')
9cbe3a4f1492 patch 8.2.0531: various errors not tested
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
1808 call assert_fails("call search('\\_m')", 'E63:')
9cbe3a4f1492 patch 8.2.0531: various errors not tested
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
1809 call assert_fails("call search('\\+')", 'E64:')
9cbe3a4f1492 patch 8.2.0531: various errors not tested
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
1810 call assert_fails("call search('\\1')", 'E65:')
9cbe3a4f1492 patch 8.2.0531: various errors not tested
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
1811 call assert_fails("call search('\\z\\(\\)')", 'E66:')
9cbe3a4f1492 patch 8.2.0531: various errors not tested
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
1812 call assert_fails("call search('\\z2')", 'E67:')
9cbe3a4f1492 patch 8.2.0531: various errors not tested
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
1813 call assert_fails("call search('\\zx')", 'E68:')
9cbe3a4f1492 patch 8.2.0531: various errors not tested
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
1814 call assert_fails("call search('\\%[ab')", 'E69:')
9cbe3a4f1492 patch 8.2.0531: various errors not tested
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
1815 call assert_fails("call search('\\%[]')", 'E70:')
9cbe3a4f1492 patch 8.2.0531: various errors not tested
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
1816 call assert_fails("call search('\\%a')", 'E71:')
9cbe3a4f1492 patch 8.2.0531: various errors not tested
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
1817 call assert_fails("call search('ab\\%[\\(cd\\)]')", 'E369:')
9cbe3a4f1492 patch 8.2.0531: various errors not tested
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
1818 call assert_fails("call search('ab\\%[\\%(cd\\)]')", 'E369:')
9cbe3a4f1492 patch 8.2.0531: various errors not tested
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
1819 set regexpengine=2
9cbe3a4f1492 patch 8.2.0531: various errors not tested
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
1820 call assert_fails("call search('\\_')", 'E865:')
9cbe3a4f1492 patch 8.2.0531: various errors not tested
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
1821 call assert_fails("call search('\\+')", 'E866:')
9cbe3a4f1492 patch 8.2.0531: various errors not tested
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
1822 call assert_fails("call search('\\zx')", 'E867:')
9cbe3a4f1492 patch 8.2.0531: various errors not tested
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
1823 call assert_fails("call search('\\%a')", 'E867:')
9cbe3a4f1492 patch 8.2.0531: various errors not tested
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
1824 call assert_fails("call search('x\\@#')", 'E869:')
9cbe3a4f1492 patch 8.2.0531: various errors not tested
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
1825 call assert_fails("call search(repeat('\\(.\\)', 10))", 'E872:')
9cbe3a4f1492 patch 8.2.0531: various errors not tested
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
1826 call assert_fails("call search('\\_m')", 'E877:')
9cbe3a4f1492 patch 8.2.0531: various errors not tested
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
1827 call assert_fails("call search('\\%(')", 'E53:')
9cbe3a4f1492 patch 8.2.0531: various errors not tested
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
1828 call assert_fails("call search('\\(')", 'E54:')
9cbe3a4f1492 patch 8.2.0531: various errors not tested
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
1829 call assert_fails("call search('\\)')", 'E55:')
9cbe3a4f1492 patch 8.2.0531: various errors not tested
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
1830 call assert_fails("call search('\\z\\(\\)')", 'E66:')
26907
6f43253463cc patch 8.2.3982: some lines of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 25911
diff changeset
1831 call assert_fails("call search('\\z2')", 'E67:')
6f43253463cc patch 8.2.3982: some lines of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 25911
diff changeset
1832 call assert_fails("call search('\\zx')", 'E867:')
19950
9cbe3a4f1492 patch 8.2.0531: various errors not tested
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
1833 call assert_fails("call search('\\%[ab')", 'E69:')
19958
0b42b5e50344 patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1834 call assert_fails("call search('\\%[]')", 'E70:')
19950
9cbe3a4f1492 patch 8.2.0531: various errors not tested
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
1835 call assert_fails("call search('\\%9999999999999999999999999999v')", 'E951:')
9cbe3a4f1492 patch 8.2.0531: various errors not tested
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
1836 set regexpengine&
9cbe3a4f1492 patch 8.2.0531: various errors not tested
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
1837 call assert_fails("call search('\\%#=3ab')", 'E864:')
9cbe3a4f1492 patch 8.2.0531: various errors not tested
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
1838 endfunc
9cbe3a4f1492 patch 8.2.0531: various errors not tested
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
1839
19969
b07672d13ff9 patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents: 19958
diff changeset
1840 " Test for searching a very complex pattern in a string. Should switch the
b07672d13ff9 patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents: 19958
diff changeset
1841 " regexp engine from NFA to the old engine.
b07672d13ff9 patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents: 19958
diff changeset
1842 func Test_regexp_switch_engine()
b07672d13ff9 patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents: 19958
diff changeset
1843 let l = readfile('samples/re.freeze.txt')
b07672d13ff9 patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents: 19958
diff changeset
1844 let v = substitute(l[4], '..\@<!', '', '')
b07672d13ff9 patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents: 19958
diff changeset
1845 call assert_equal(l[4], v)
b07672d13ff9 patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents: 19958
diff changeset
1846 endfunc
b07672d13ff9 patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents: 19958
diff changeset
1847
b07672d13ff9 patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents: 19958
diff changeset
1848 " Test for the \%V atom to search within visually selected text
b07672d13ff9 patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents: 19958
diff changeset
1849 func Test_search_in_visual_area()
b07672d13ff9 patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents: 19958
diff changeset
1850 new
b07672d13ff9 patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents: 19958
diff changeset
1851 call setline(1, ['foo bar1', 'foo bar2', 'foo bar3', 'foo bar4'])
b07672d13ff9 patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents: 19958
diff changeset
1852 exe "normal 2GVjo/\\%Vbar\<CR>\<Esc>"
b07672d13ff9 patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents: 19958
diff changeset
1853 call assert_equal([2, 5], [line('.'), col('.')])
b07672d13ff9 patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents: 19958
diff changeset
1854 exe "normal 2GVj$?\\%Vbar\<CR>\<Esc>"
b07672d13ff9 patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents: 19958
diff changeset
1855 call assert_equal([3, 5], [line('.'), col('.')])
b07672d13ff9 patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents: 19958
diff changeset
1856 close!
b07672d13ff9 patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents: 19958
diff changeset
1857 endfunc
b07672d13ff9 patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents: 19958
diff changeset
1858
20128
0b35a7ffceb2 patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents: 19973
diff changeset
1859 " Test for searching with 'smartcase' and 'ignorecase'
0b35a7ffceb2 patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents: 19973
diff changeset
1860 func Test_search_smartcase()
0b35a7ffceb2 patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents: 19973
diff changeset
1861 new
0b35a7ffceb2 patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents: 19973
diff changeset
1862 call setline(1, ['', 'Hello'])
0b35a7ffceb2 patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents: 19973
diff changeset
1863 set noignorecase nosmartcase
0b35a7ffceb2 patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents: 19973
diff changeset
1864 call assert_fails('exe "normal /\\a\\_.\\(.*\\)O\<CR>"', 'E486:')
0b35a7ffceb2 patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents: 19973
diff changeset
1865
0b35a7ffceb2 patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents: 19973
diff changeset
1866 set ignorecase nosmartcase
0b35a7ffceb2 patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents: 19973
diff changeset
1867 exe "normal /\\a\\_.\\(.*\\)O\<CR>"
0b35a7ffceb2 patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents: 19973
diff changeset
1868 call assert_equal([2, 1], [line('.'), col('.')])
0b35a7ffceb2 patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents: 19973
diff changeset
1869
0b35a7ffceb2 patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents: 19973
diff changeset
1870 call cursor(1, 1)
0b35a7ffceb2 patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents: 19973
diff changeset
1871 set ignorecase smartcase
0b35a7ffceb2 patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents: 19973
diff changeset
1872 call assert_fails('exe "normal /\\a\\_.\\(.*\\)O\<CR>"', 'E486:')
0b35a7ffceb2 patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents: 19973
diff changeset
1873
0b35a7ffceb2 patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents: 19973
diff changeset
1874 exe "normal /\\a\\_.\\(.*\\)o\<CR>"
0b35a7ffceb2 patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents: 19973
diff changeset
1875 call assert_equal([2, 1], [line('.'), col('.')])
0b35a7ffceb2 patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents: 19973
diff changeset
1876
20199
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1877 " Test for using special atoms with 'smartcase'
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1878 call setline(1, ['', ' Hello\ '])
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1879 call cursor(1, 1)
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1880 call feedkeys('/\_.\%(\uello\)\' .. "\<CR>", 'xt')
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1881 call assert_equal([2, 4], [line('.'), col('.')])
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1882
20128
0b35a7ffceb2 patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents: 19973
diff changeset
1883 set ignorecase& smartcase&
0b35a7ffceb2 patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents: 19973
diff changeset
1884 close!
21491
e3c1e12f062c patch 8.2.1296: some part of using 'smarcase' was not tested
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
1885 endfun
e3c1e12f062c patch 8.2.1296: some part of using 'smarcase' was not tested
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
1886
e3c1e12f062c patch 8.2.1296: some part of using 'smarcase' was not tested
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
1887 " Test 'smartcase' with utf-8.
e3c1e12f062c patch 8.2.1296: some part of using 'smarcase' was not tested
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
1888 func Test_search_smartcase_utf8()
e3c1e12f062c patch 8.2.1296: some part of using 'smarcase' was not tested
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
1889 new
e3c1e12f062c patch 8.2.1296: some part of using 'smarcase' was not tested
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
1890 let save_enc = &encoding
e3c1e12f062c patch 8.2.1296: some part of using 'smarcase' was not tested
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
1891 set encoding=utf8 ignorecase smartcase
e3c1e12f062c patch 8.2.1296: some part of using 'smarcase' was not tested
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
1892
e3c1e12f062c patch 8.2.1296: some part of using 'smarcase' was not tested
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
1893 call setline(1, 'Café cafÉ')
e3c1e12f062c patch 8.2.1296: some part of using 'smarcase' was not tested
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
1894 1s/café/x/g
e3c1e12f062c patch 8.2.1296: some part of using 'smarcase' was not tested
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
1895 call assert_equal('x x', getline(1))
e3c1e12f062c patch 8.2.1296: some part of using 'smarcase' was not tested
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
1896
e3c1e12f062c patch 8.2.1296: some part of using 'smarcase' was not tested
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
1897 call setline(1, 'Café cafÉ')
e3c1e12f062c patch 8.2.1296: some part of using 'smarcase' was not tested
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
1898 1s/cafÉ/x/g
e3c1e12f062c patch 8.2.1296: some part of using 'smarcase' was not tested
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
1899 call assert_equal('Café x', getline(1))
e3c1e12f062c patch 8.2.1296: some part of using 'smarcase' was not tested
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
1900
e3c1e12f062c patch 8.2.1296: some part of using 'smarcase' was not tested
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
1901 set ignorecase& smartcase&
e3c1e12f062c patch 8.2.1296: some part of using 'smarcase' was not tested
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
1902 let &encoding = save_enc
31233
d80066065462 patch 9.0.0950: the pattern "_szs" matches at EOL
Bram Moolenaar <Bram@vim.org>
parents: 30769
diff changeset
1903 bwipe!
20128
0b35a7ffceb2 patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents: 19973
diff changeset
1904 endfunc
0b35a7ffceb2 patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents: 19973
diff changeset
1905
0b35a7ffceb2 patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents: 19973
diff changeset
1906 " Test searching past the end of a file
0b35a7ffceb2 patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents: 19973
diff changeset
1907 func Test_search_past_eof()
0b35a7ffceb2 patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents: 19973
diff changeset
1908 new
0b35a7ffceb2 patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents: 19973
diff changeset
1909 call setline(1, ['Line'])
0b35a7ffceb2 patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents: 19973
diff changeset
1910 exe "normal /\\n\\zs\<CR>"
0b35a7ffceb2 patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents: 19973
diff changeset
1911 call assert_equal([1, 4], [line('.'), col('.')])
31233
d80066065462 patch 9.0.0950: the pattern "_szs" matches at EOL
Bram Moolenaar <Bram@vim.org>
parents: 30769
diff changeset
1912 bwipe!
d80066065462 patch 9.0.0950: the pattern "_szs" matches at EOL
Bram Moolenaar <Bram@vim.org>
parents: 30769
diff changeset
1913 endfunc
d80066065462 patch 9.0.0950: the pattern "_szs" matches at EOL
Bram Moolenaar <Bram@vim.org>
parents: 30769
diff changeset
1914
d80066065462 patch 9.0.0950: the pattern "_szs" matches at EOL
Bram Moolenaar <Bram@vim.org>
parents: 30769
diff changeset
1915 " Test setting the start of the match and still finding a next match in the
d80066065462 patch 9.0.0950: the pattern "_szs" matches at EOL
Bram Moolenaar <Bram@vim.org>
parents: 30769
diff changeset
1916 " same line.
d80066065462 patch 9.0.0950: the pattern "_szs" matches at EOL
Bram Moolenaar <Bram@vim.org>
parents: 30769
diff changeset
1917 func Test_search_set_start_same_line()
d80066065462 patch 9.0.0950: the pattern "_szs" matches at EOL
Bram Moolenaar <Bram@vim.org>
parents: 30769
diff changeset
1918 new
d80066065462 patch 9.0.0950: the pattern "_szs" matches at EOL
Bram Moolenaar <Bram@vim.org>
parents: 30769
diff changeset
1919 set cpo-=c
d80066065462 patch 9.0.0950: the pattern "_szs" matches at EOL
Bram Moolenaar <Bram@vim.org>
parents: 30769
diff changeset
1920
d80066065462 patch 9.0.0950: the pattern "_szs" matches at EOL
Bram Moolenaar <Bram@vim.org>
parents: 30769
diff changeset
1921 call setline(1, ['1', '2', '3 .', '4', '5'])
d80066065462 patch 9.0.0950: the pattern "_szs" matches at EOL
Bram Moolenaar <Bram@vim.org>
parents: 30769
diff changeset
1922 exe "normal /\\_s\\zs\\S\<CR>"
d80066065462 patch 9.0.0950: the pattern "_szs" matches at EOL
Bram Moolenaar <Bram@vim.org>
parents: 30769
diff changeset
1923 call assert_equal([2, 1], [line('.'), col('.')])
d80066065462 patch 9.0.0950: the pattern "_szs" matches at EOL
Bram Moolenaar <Bram@vim.org>
parents: 30769
diff changeset
1924 exe 'normal n'
d80066065462 patch 9.0.0950: the pattern "_szs" matches at EOL
Bram Moolenaar <Bram@vim.org>
parents: 30769
diff changeset
1925 call assert_equal([3, 1], [line('.'), col('.')])
d80066065462 patch 9.0.0950: the pattern "_szs" matches at EOL
Bram Moolenaar <Bram@vim.org>
parents: 30769
diff changeset
1926 exe 'normal n'
d80066065462 patch 9.0.0950: the pattern "_szs" matches at EOL
Bram Moolenaar <Bram@vim.org>
parents: 30769
diff changeset
1927 call assert_equal([3, 3], [line('.'), col('.')])
d80066065462 patch 9.0.0950: the pattern "_szs" matches at EOL
Bram Moolenaar <Bram@vim.org>
parents: 30769
diff changeset
1928 exe 'normal n'
d80066065462 patch 9.0.0950: the pattern "_szs" matches at EOL
Bram Moolenaar <Bram@vim.org>
parents: 30769
diff changeset
1929 call assert_equal([4, 1], [line('.'), col('.')])
d80066065462 patch 9.0.0950: the pattern "_szs" matches at EOL
Bram Moolenaar <Bram@vim.org>
parents: 30769
diff changeset
1930 exe 'normal n'
d80066065462 patch 9.0.0950: the pattern "_szs" matches at EOL
Bram Moolenaar <Bram@vim.org>
parents: 30769
diff changeset
1931 call assert_equal([5, 1], [line('.'), col('.')])
d80066065462 patch 9.0.0950: the pattern "_szs" matches at EOL
Bram Moolenaar <Bram@vim.org>
parents: 30769
diff changeset
1932
d80066065462 patch 9.0.0950: the pattern "_szs" matches at EOL
Bram Moolenaar <Bram@vim.org>
parents: 30769
diff changeset
1933 set cpo+=c
d80066065462 patch 9.0.0950: the pattern "_szs" matches at EOL
Bram Moolenaar <Bram@vim.org>
parents: 30769
diff changeset
1934 bwipe!
20128
0b35a7ffceb2 patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents: 19973
diff changeset
1935 endfunc
0b35a7ffceb2 patch 8.2.0619: null dict is not handled like an empty dict
Bram Moolenaar <Bram@vim.org>
parents: 19973
diff changeset
1936
20199
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1937 " Test for various search offsets
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1938 func Test_search_offset()
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1939 " With /e, for a match in the first column of a line, the cursor should be
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1940 " placed at the end of the previous line.
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1941 new
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1942 call setline(1, ['one two', 'three four'])
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1943 call search('two\_.', 'e')
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1944 call assert_equal([1, 7], [line('.'), col('.')])
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1945
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1946 " with cursor at the beginning of the file, use /s+1
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1947 call cursor(1, 1)
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1948 exe "normal /two/s+1\<CR>"
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1949 call assert_equal([1, 6], [line('.'), col('.')])
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1950
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1951 " with cursor at the end of the file, use /e-1
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1952 call cursor(2, 10)
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1953 exe "normal ?three?e-1\<CR>"
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1954 call assert_equal([2, 4], [line('.'), col('.')])
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1955
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1956 " line offset - after the last line
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1957 call cursor(1, 1)
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1958 exe "normal /three/+1\<CR>"
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1959 call assert_equal([2, 1], [line('.'), col('.')])
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1960
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1961 " line offset - before the first line
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1962 call cursor(2, 1)
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1963 exe "normal ?one?-1\<CR>"
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1964 call assert_equal([1, 1], [line('.'), col('.')])
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1965
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1966 " character offset - before the first character in the file
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1967 call cursor(2, 1)
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1968 exe "normal ?one?s-1\<CR>"
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1969 call assert_equal([1, 1], [line('.'), col('.')])
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1970 call cursor(2, 1)
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1971 exe "normal ?one?e-3\<CR>"
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1972 call assert_equal([1, 1], [line('.'), col('.')])
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1973
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1974 " character offset - after the last character in the file
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1975 call cursor(1, 1)
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1976 exe "normal /four/s+4\<CR>"
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1977 call assert_equal([2, 10], [line('.'), col('.')])
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1978 call cursor(1, 1)
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1979 exe "normal /four/e+1\<CR>"
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1980 call assert_equal([2, 10], [line('.'), col('.')])
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1981
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1982 close!
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1983 endfunc
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1984
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1985 " Test for searching for matching parenthesis using %
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1986 func Test_search_match_paren()
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1987 new
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1988 call setline(1, "abc(def')'ghi'('jk'\\t'lm)no")
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1989 " searching for a matching parenthesis should skip single quoted characters
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1990 call cursor(1, 4)
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1991 normal %
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1992 call assert_equal([1, 25], [line('.'), col('.')])
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1993 normal %
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1994 call assert_equal([1, 4], [line('.'), col('.')])
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1995 call cursor(1, 5)
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1996 normal ])
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1997 call assert_equal([1, 25], [line('.'), col('.')])
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1998 call cursor(1, 24)
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
1999 normal [(
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
2000 call assert_equal([1, 4], [line('.'), col('.')])
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
2001
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
2002 " matching parenthesis in 'virtualedit' mode with cursor after the eol
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
2003 call setline(1, 'abc(defgh)')
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
2004 set virtualedit=all
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
2005 normal 20|%
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
2006 call assert_equal(4, col('.'))
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
2007 set virtualedit&
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
2008 close!
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
2009 endfunc
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
2010
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
2011 " Test for searching a pattern and stopping before a specified line
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
2012 func Test_search_stopline()
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
2013 new
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
2014 call setline(1, ['', '', '', 'vim'])
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
2015 call assert_equal(0, search('vim', 'n', 3))
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
2016 call assert_equal(4, search('vim', 'n', 4))
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
2017 call setline(1, ['vim', '', '', ''])
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
2018 call cursor(4, 1)
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
2019 call assert_equal(0, search('vim', 'bn', 2))
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
2020 call assert_equal(1, search('vim', 'bn', 1))
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
2021 close!
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
2022 endfunc
a4bd28e2cf1d patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 20164
diff changeset
2023
23007
7cb072acc5c0 patch 8.2.2050: search test contains unneeded sleeps
Bram Moolenaar <Bram@vim.org>
parents: 22997
diff changeset
2024 func Test_incsearch_highlighting_newline()
22997
00548e40e708 patch 8.2.2045: highlighting a character too much with incsearch
Bram Moolenaar <Bram@vim.org>
parents: 22478
diff changeset
2025 CheckRunVimInTerminal
00548e40e708 patch 8.2.2045: highlighting a character too much with incsearch
Bram Moolenaar <Bram@vim.org>
parents: 22478
diff changeset
2026 CheckOption incsearch
00548e40e708 patch 8.2.2045: highlighting a character too much with incsearch
Bram Moolenaar <Bram@vim.org>
parents: 22478
diff changeset
2027 CheckScreendump
00548e40e708 patch 8.2.2045: highlighting a character too much with incsearch
Bram Moolenaar <Bram@vim.org>
parents: 22478
diff changeset
2028 new
00548e40e708 patch 8.2.2045: highlighting a character too much with incsearch
Bram Moolenaar <Bram@vim.org>
parents: 22478
diff changeset
2029 call test_override("char_avail", 1)
00548e40e708 patch 8.2.2045: highlighting a character too much with incsearch
Bram Moolenaar <Bram@vim.org>
parents: 22478
diff changeset
2030
00548e40e708 patch 8.2.2045: highlighting a character too much with incsearch
Bram Moolenaar <Bram@vim.org>
parents: 22478
diff changeset
2031 let commands =<< trim [CODE]
00548e40e708 patch 8.2.2045: highlighting a character too much with incsearch
Bram Moolenaar <Bram@vim.org>
parents: 22478
diff changeset
2032 set incsearch nohls
00548e40e708 patch 8.2.2045: highlighting a character too much with incsearch
Bram Moolenaar <Bram@vim.org>
parents: 22478
diff changeset
2033 call setline(1, ['test', 'xxx'])
00548e40e708 patch 8.2.2045: highlighting a character too much with incsearch
Bram Moolenaar <Bram@vim.org>
parents: 22478
diff changeset
2034 [CODE]
30769
ae10b91ac6b3 patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 29277
diff changeset
2035 call writefile(commands, 'Xincsearch_nl', 'D')
22997
00548e40e708 patch 8.2.2045: highlighting a character too much with incsearch
Bram Moolenaar <Bram@vim.org>
parents: 22478
diff changeset
2036 let buf = RunVimInTerminal('-S Xincsearch_nl', {'rows': 5, 'cols': 10})
23007
7cb072acc5c0 patch 8.2.2050: search test contains unneeded sleeps
Bram Moolenaar <Bram@vim.org>
parents: 22997
diff changeset
2037 call term_sendkeys(buf, '/test')
7cb072acc5c0 patch 8.2.2050: search test contains unneeded sleeps
Bram Moolenaar <Bram@vim.org>
parents: 22997
diff changeset
2038 call VerifyScreenDump(buf, 'Test_incsearch_newline1', {})
22997
00548e40e708 patch 8.2.2045: highlighting a character too much with incsearch
Bram Moolenaar <Bram@vim.org>
parents: 22478
diff changeset
2039 " Need to send one key at a time to force a redraw
00548e40e708 patch 8.2.2045: highlighting a character too much with incsearch
Bram Moolenaar <Bram@vim.org>
parents: 22478
diff changeset
2040 call term_sendkeys(buf, '\n')
00548e40e708 patch 8.2.2045: highlighting a character too much with incsearch
Bram Moolenaar <Bram@vim.org>
parents: 22478
diff changeset
2041 call VerifyScreenDump(buf, 'Test_incsearch_newline2', {})
00548e40e708 patch 8.2.2045: highlighting a character too much with incsearch
Bram Moolenaar <Bram@vim.org>
parents: 22478
diff changeset
2042 call term_sendkeys(buf, 'x')
00548e40e708 patch 8.2.2045: highlighting a character too much with incsearch
Bram Moolenaar <Bram@vim.org>
parents: 22478
diff changeset
2043 call VerifyScreenDump(buf, 'Test_incsearch_newline3', {})
00548e40e708 patch 8.2.2045: highlighting a character too much with incsearch
Bram Moolenaar <Bram@vim.org>
parents: 22478
diff changeset
2044 call term_sendkeys(buf, 'x')
00548e40e708 patch 8.2.2045: highlighting a character too much with incsearch
Bram Moolenaar <Bram@vim.org>
parents: 22478
diff changeset
2045 call VerifyScreenDump(buf, 'Test_incsearch_newline4', {})
00548e40e708 patch 8.2.2045: highlighting a character too much with incsearch
Bram Moolenaar <Bram@vim.org>
parents: 22478
diff changeset
2046 call term_sendkeys(buf, "\<CR>")
00548e40e708 patch 8.2.2045: highlighting a character too much with incsearch
Bram Moolenaar <Bram@vim.org>
parents: 22478
diff changeset
2047 call VerifyScreenDump(buf, 'Test_incsearch_newline5', {})
00548e40e708 patch 8.2.2045: highlighting a character too much with incsearch
Bram Moolenaar <Bram@vim.org>
parents: 22478
diff changeset
2048 call StopVimInTerminal(buf)
00548e40e708 patch 8.2.2045: highlighting a character too much with incsearch
Bram Moolenaar <Bram@vim.org>
parents: 22478
diff changeset
2049
00548e40e708 patch 8.2.2045: highlighting a character too much with incsearch
Bram Moolenaar <Bram@vim.org>
parents: 22478
diff changeset
2050 " clean up
00548e40e708 patch 8.2.2045: highlighting a character too much with incsearch
Bram Moolenaar <Bram@vim.org>
parents: 22478
diff changeset
2051 call test_override("char_avail", 0)
00548e40e708 patch 8.2.2045: highlighting a character too much with incsearch
Bram Moolenaar <Bram@vim.org>
parents: 22478
diff changeset
2052 bw
00548e40e708 patch 8.2.2045: highlighting a character too much with incsearch
Bram Moolenaar <Bram@vim.org>
parents: 22478
diff changeset
2053 endfunc
00548e40e708 patch 8.2.2045: highlighting a character too much with incsearch
Bram Moolenaar <Bram@vim.org>
parents: 22478
diff changeset
2054
23505
bb29b09902d5 patch 8.2.2295: incsearch does not detect empty pattern properly
Bram Moolenaar <Bram@vim.org>
parents: 23007
diff changeset
2055 func Test_incsearch_substitute_dump2()
bb29b09902d5 patch 8.2.2295: incsearch does not detect empty pattern properly
Bram Moolenaar <Bram@vim.org>
parents: 23007
diff changeset
2056 CheckOption incsearch
bb29b09902d5 patch 8.2.2295: incsearch does not detect empty pattern properly
Bram Moolenaar <Bram@vim.org>
parents: 23007
diff changeset
2057 CheckScreendump
bb29b09902d5 patch 8.2.2295: incsearch does not detect empty pattern properly
Bram Moolenaar <Bram@vim.org>
parents: 23007
diff changeset
2058
bb29b09902d5 patch 8.2.2295: incsearch does not detect empty pattern properly
Bram Moolenaar <Bram@vim.org>
parents: 23007
diff changeset
2059 call writefile([
bb29b09902d5 patch 8.2.2295: incsearch does not detect empty pattern properly
Bram Moolenaar <Bram@vim.org>
parents: 23007
diff changeset
2060 \ 'set incsearch hlsearch scrolloff=0',
bb29b09902d5 patch 8.2.2295: incsearch does not detect empty pattern properly
Bram Moolenaar <Bram@vim.org>
parents: 23007
diff changeset
2061 \ 'for n in range(1, 4)',
bb29b09902d5 patch 8.2.2295: incsearch does not detect empty pattern properly
Bram Moolenaar <Bram@vim.org>
parents: 23007
diff changeset
2062 \ ' call setline(n, "foo " . n)',
bb29b09902d5 patch 8.2.2295: incsearch does not detect empty pattern properly
Bram Moolenaar <Bram@vim.org>
parents: 23007
diff changeset
2063 \ 'endfor',
bb29b09902d5 patch 8.2.2295: incsearch does not detect empty pattern properly
Bram Moolenaar <Bram@vim.org>
parents: 23007
diff changeset
2064 \ 'call setline(5, "abc|def")',
bb29b09902d5 patch 8.2.2295: incsearch does not detect empty pattern properly
Bram Moolenaar <Bram@vim.org>
parents: 23007
diff changeset
2065 \ '3',
30769
ae10b91ac6b3 patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 29277
diff changeset
2066 \ ], 'Xis_subst_script2', 'D')
23505
bb29b09902d5 patch 8.2.2295: incsearch does not detect empty pattern properly
Bram Moolenaar <Bram@vim.org>
parents: 23007
diff changeset
2067 let buf = RunVimInTerminal('-S Xis_subst_script2', {'rows': 9, 'cols': 70})
bb29b09902d5 patch 8.2.2295: incsearch does not detect empty pattern properly
Bram Moolenaar <Bram@vim.org>
parents: 23007
diff changeset
2068
bb29b09902d5 patch 8.2.2295: incsearch does not detect empty pattern properly
Bram Moolenaar <Bram@vim.org>
parents: 23007
diff changeset
2069 call term_sendkeys(buf, ':%s/\vabc|')
bb29b09902d5 patch 8.2.2295: incsearch does not detect empty pattern properly
Bram Moolenaar <Bram@vim.org>
parents: 23007
diff changeset
2070 sleep 100m
bb29b09902d5 patch 8.2.2295: incsearch does not detect empty pattern properly
Bram Moolenaar <Bram@vim.org>
parents: 23007
diff changeset
2071 call VerifyScreenDump(buf, 'Test_incsearch_sub_01', {})
bb29b09902d5 patch 8.2.2295: incsearch does not detect empty pattern properly
Bram Moolenaar <Bram@vim.org>
parents: 23007
diff changeset
2072 call term_sendkeys(buf, "\<Esc>")
bb29b09902d5 patch 8.2.2295: incsearch does not detect empty pattern properly
Bram Moolenaar <Bram@vim.org>
parents: 23007
diff changeset
2073
bb29b09902d5 patch 8.2.2295: incsearch does not detect empty pattern properly
Bram Moolenaar <Bram@vim.org>
parents: 23007
diff changeset
2074 " The following should not be highlighted
bb29b09902d5 patch 8.2.2295: incsearch does not detect empty pattern properly
Bram Moolenaar <Bram@vim.org>
parents: 23007
diff changeset
2075 call term_sendkeys(buf, ':1,5s/\v|')
bb29b09902d5 patch 8.2.2295: incsearch does not detect empty pattern properly
Bram Moolenaar <Bram@vim.org>
parents: 23007
diff changeset
2076 sleep 100m
bb29b09902d5 patch 8.2.2295: incsearch does not detect empty pattern properly
Bram Moolenaar <Bram@vim.org>
parents: 23007
diff changeset
2077 call VerifyScreenDump(buf, 'Test_incsearch_sub_02', {})
bb29b09902d5 patch 8.2.2295: incsearch does not detect empty pattern properly
Bram Moolenaar <Bram@vim.org>
parents: 23007
diff changeset
2078
bb29b09902d5 patch 8.2.2295: incsearch does not detect empty pattern properly
Bram Moolenaar <Bram@vim.org>
parents: 23007
diff changeset
2079
bb29b09902d5 patch 8.2.2295: incsearch does not detect empty pattern properly
Bram Moolenaar <Bram@vim.org>
parents: 23007
diff changeset
2080 call StopVimInTerminal(buf)
bb29b09902d5 patch 8.2.2295: incsearch does not detect empty pattern properly
Bram Moolenaar <Bram@vim.org>
parents: 23007
diff changeset
2081 endfunc
bb29b09902d5 patch 8.2.2295: incsearch does not detect empty pattern properly
Bram Moolenaar <Bram@vim.org>
parents: 23007
diff changeset
2082
32743
df63fa700fc6 patch 9.0.1691: wrong viewport restored for incsearch and smoothscroll
Christian Brabandt <cb@256bit.org>
parents: 31802
diff changeset
2083 func Test_incsearch_restore_view()
df63fa700fc6 patch 9.0.1691: wrong viewport restored for incsearch and smoothscroll
Christian Brabandt <cb@256bit.org>
parents: 31802
diff changeset
2084 CheckOption incsearch
df63fa700fc6 patch 9.0.1691: wrong viewport restored for incsearch and smoothscroll
Christian Brabandt <cb@256bit.org>
parents: 31802
diff changeset
2085 CheckScreendump
df63fa700fc6 patch 9.0.1691: wrong viewport restored for incsearch and smoothscroll
Christian Brabandt <cb@256bit.org>
parents: 31802
diff changeset
2086
df63fa700fc6 patch 9.0.1691: wrong viewport restored for incsearch and smoothscroll
Christian Brabandt <cb@256bit.org>
parents: 31802
diff changeset
2087 let lines =<< trim [CODE]
df63fa700fc6 patch 9.0.1691: wrong viewport restored for incsearch and smoothscroll
Christian Brabandt <cb@256bit.org>
parents: 31802
diff changeset
2088 set incsearch nohlsearch
df63fa700fc6 patch 9.0.1691: wrong viewport restored for incsearch and smoothscroll
Christian Brabandt <cb@256bit.org>
parents: 31802
diff changeset
2089 setlocal scrolloff=0 smoothscroll
df63fa700fc6 patch 9.0.1691: wrong viewport restored for incsearch and smoothscroll
Christian Brabandt <cb@256bit.org>
parents: 31802
diff changeset
2090 call setline(1, [join(range(25), ' '), '', '', '', '', 'xxx'])
df63fa700fc6 patch 9.0.1691: wrong viewport restored for incsearch and smoothscroll
Christian Brabandt <cb@256bit.org>
parents: 31802
diff changeset
2091 call feedkeys("2\<C-E>", 't')
df63fa700fc6 patch 9.0.1691: wrong viewport restored for incsearch and smoothscroll
Christian Brabandt <cb@256bit.org>
parents: 31802
diff changeset
2092 [CODE]
df63fa700fc6 patch 9.0.1691: wrong viewport restored for incsearch and smoothscroll
Christian Brabandt <cb@256bit.org>
parents: 31802
diff changeset
2093 call writefile(lines, 'Xincsearch_restore_view', 'D')
df63fa700fc6 patch 9.0.1691: wrong viewport restored for incsearch and smoothscroll
Christian Brabandt <cb@256bit.org>
parents: 31802
diff changeset
2094 let buf = RunVimInTerminal('-S Xincsearch_restore_view', {'rows': 6, 'cols': 20})
df63fa700fc6 patch 9.0.1691: wrong viewport restored for incsearch and smoothscroll
Christian Brabandt <cb@256bit.org>
parents: 31802
diff changeset
2095
df63fa700fc6 patch 9.0.1691: wrong viewport restored for incsearch and smoothscroll
Christian Brabandt <cb@256bit.org>
parents: 31802
diff changeset
2096 call VerifyScreenDump(buf, 'Test_incsearch_restore_view_01', {})
32756
ce3269eea32c patch 9.0.1697: incsearch test not sufficient
Christian Brabandt <cb@256bit.org>
parents: 32743
diff changeset
2097 call term_sendkeys(buf, '/xx')
32743
df63fa700fc6 patch 9.0.1691: wrong viewport restored for incsearch and smoothscroll
Christian Brabandt <cb@256bit.org>
parents: 31802
diff changeset
2098 call VerifyScreenDump(buf, 'Test_incsearch_restore_view_02', {})
32756
ce3269eea32c patch 9.0.1697: incsearch test not sufficient
Christian Brabandt <cb@256bit.org>
parents: 32743
diff changeset
2099 call term_sendkeys(buf, 'x')
ce3269eea32c patch 9.0.1697: incsearch test not sufficient
Christian Brabandt <cb@256bit.org>
parents: 32743
diff changeset
2100 call VerifyScreenDump(buf, 'Test_incsearch_restore_view_03', {})
32743
df63fa700fc6 patch 9.0.1691: wrong viewport restored for incsearch and smoothscroll
Christian Brabandt <cb@256bit.org>
parents: 31802
diff changeset
2101 call term_sendkeys(buf, "\<Esc>")
df63fa700fc6 patch 9.0.1691: wrong viewport restored for incsearch and smoothscroll
Christian Brabandt <cb@256bit.org>
parents: 31802
diff changeset
2102 call VerifyScreenDump(buf, 'Test_incsearch_restore_view_01', {})
df63fa700fc6 patch 9.0.1691: wrong viewport restored for incsearch and smoothscroll
Christian Brabandt <cb@256bit.org>
parents: 31802
diff changeset
2103
df63fa700fc6 patch 9.0.1691: wrong viewport restored for incsearch and smoothscroll
Christian Brabandt <cb@256bit.org>
parents: 31802
diff changeset
2104 call StopVimInTerminal(buf)
df63fa700fc6 patch 9.0.1691: wrong viewport restored for incsearch and smoothscroll
Christian Brabandt <cb@256bit.org>
parents: 31802
diff changeset
2105 endfunc
df63fa700fc6 patch 9.0.1691: wrong viewport restored for incsearch and smoothscroll
Christian Brabandt <cb@256bit.org>
parents: 31802
diff changeset
2106
25457
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2107 func Test_pattern_is_uppercase_smartcase()
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2108 new
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2109 let input=['abc', 'ABC', 'Abc', 'abC']
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2110 call setline(1, input)
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2111 call cursor(1,1)
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2112 " default, matches firstline
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2113 %s/abc//g
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2114 call assert_equal(['', 'ABC', 'Abc', 'abC'],
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2115 \ getline(1, '$'))
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2116
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2117 set smartcase ignorecase
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2118 sil %d
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2119 call setline(1, input)
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2120 call cursor(1,1)
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2121 " with smartcase and incsearch set, matches everything
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2122 %s/abc//g
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2123 call assert_equal(['', '', '', ''], getline(1, '$'))
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2124
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2125 sil %d
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2126 call setline(1, input)
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2127 call cursor(1,1)
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2128 " with smartcase and incsearch set and found an uppercase letter,
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2129 " match only that.
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2130 %s/abC//g
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2131 call assert_equal(['abc', 'ABC', 'Abc', ''],
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2132 \ getline(1, '$'))
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2133
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2134 sil %d
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2135 call setline(1, input)
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2136 call cursor(1,1)
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2137 exe "norm! vG$\<esc>"
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2138 " \%V should not be detected as uppercase letter
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2139 %s/\%Vabc//g
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2140 call assert_equal(['', '', '', ''], getline(1, '$'))
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2141
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2142 call setline(1, input)
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2143 call cursor(1,1)
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2144 exe "norm! vG$\<esc>"
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2145 " \v%V should not be detected as uppercase letter
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2146 %s/\v%Vabc//g
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2147 call assert_equal(['', '', '', ''], getline(1, '$'))
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2148
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2149 call setline(1, input)
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2150 call cursor(1,1)
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2151 exe "norm! vG$\<esc>"
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2152 " \v%VabC should be detected as uppercase letter
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2153 %s/\v%VabC//g
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2154 call assert_equal(['abc', 'ABC', 'Abc', ''],
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2155 \ getline(1, '$'))
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2156
25511
a6eea433586b patch 8.2.3292: underscore in very magic pattern causes a hang
Bram Moolenaar <Bram@vim.org>
parents: 25457
diff changeset
2157 call setline(1, input)
a6eea433586b patch 8.2.3292: underscore in very magic pattern causes a hang
Bram Moolenaar <Bram@vim.org>
parents: 25457
diff changeset
2158 call cursor(1,1)
a6eea433586b patch 8.2.3292: underscore in very magic pattern causes a hang
Bram Moolenaar <Bram@vim.org>
parents: 25457
diff changeset
2159 " \Vabc should match everything
a6eea433586b patch 8.2.3292: underscore in very magic pattern causes a hang
Bram Moolenaar <Bram@vim.org>
parents: 25457
diff changeset
2160 %s/\Vabc//g
a6eea433586b patch 8.2.3292: underscore in very magic pattern causes a hang
Bram Moolenaar <Bram@vim.org>
parents: 25457
diff changeset
2161 call assert_equal(['', '', '', ''], getline(1, '$'))
a6eea433586b patch 8.2.3292: underscore in very magic pattern causes a hang
Bram Moolenaar <Bram@vim.org>
parents: 25457
diff changeset
2162
a6eea433586b patch 8.2.3292: underscore in very magic pattern causes a hang
Bram Moolenaar <Bram@vim.org>
parents: 25457
diff changeset
2163 call setline(1, input + ['_abc'])
a6eea433586b patch 8.2.3292: underscore in very magic pattern causes a hang
Bram Moolenaar <Bram@vim.org>
parents: 25457
diff changeset
2164 " _ matches normally
a6eea433586b patch 8.2.3292: underscore in very magic pattern causes a hang
Bram Moolenaar <Bram@vim.org>
parents: 25457
diff changeset
2165 %s/\v_.*//g
a6eea433586b patch 8.2.3292: underscore in very magic pattern causes a hang
Bram Moolenaar <Bram@vim.org>
parents: 25457
diff changeset
2166 call assert_equal(['abc', 'ABC', 'Abc', 'abC', ''], getline(1, '$'))
a6eea433586b patch 8.2.3292: underscore in very magic pattern causes a hang
Bram Moolenaar <Bram@vim.org>
parents: 25457
diff changeset
2167
25457
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2168 set smartcase& ignorecase&
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2169 bw!
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2170 endfunc
b95f9cc3d1b9 patch 8.2.3265: smartcase does not work correctly in very magic pattern
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2171
25874
054623fc54c5 patch 8.2.3471: crash when using CTRL-T after an empty search pattern
Bram Moolenaar <Bram@vim.org>
parents: 25511
diff changeset
2172 func Test_no_last_search_pattern()
054623fc54c5 patch 8.2.3471: crash when using CTRL-T after an empty search pattern
Bram Moolenaar <Bram@vim.org>
parents: 25511
diff changeset
2173 CheckOption incsearch
054623fc54c5 patch 8.2.3471: crash when using CTRL-T after an empty search pattern
Bram Moolenaar <Bram@vim.org>
parents: 25511
diff changeset
2174
054623fc54c5 patch 8.2.3471: crash when using CTRL-T after an empty search pattern
Bram Moolenaar <Bram@vim.org>
parents: 25511
diff changeset
2175 let @/ = ""
054623fc54c5 patch 8.2.3471: crash when using CTRL-T after an empty search pattern
Bram Moolenaar <Bram@vim.org>
parents: 25511
diff changeset
2176 set incsearch
25876
b4d009c477a4 patch 8.2.3472: other crashes with empty search pattern not tested
Bram Moolenaar <Bram@vim.org>
parents: 25874
diff changeset
2177 " these were causing a crash
b4d009c477a4 patch 8.2.3472: other crashes with empty search pattern not tested
Bram Moolenaar <Bram@vim.org>
parents: 25874
diff changeset
2178 call feedkeys("//\<C-G>", 'xt')
b4d009c477a4 patch 8.2.3472: other crashes with empty search pattern not tested
Bram Moolenaar <Bram@vim.org>
parents: 25874
diff changeset
2179 call feedkeys("//\<C-T>", 'xt')
b4d009c477a4 patch 8.2.3472: other crashes with empty search pattern not tested
Bram Moolenaar <Bram@vim.org>
parents: 25874
diff changeset
2180 call feedkeys("??\<C-G>", 'xt')
b4d009c477a4 patch 8.2.3472: other crashes with empty search pattern not tested
Bram Moolenaar <Bram@vim.org>
parents: 25874
diff changeset
2181 call feedkeys("??\<C-T>", 'xt')
25874
054623fc54c5 patch 8.2.3471: crash when using CTRL-T after an empty search pattern
Bram Moolenaar <Bram@vim.org>
parents: 25511
diff changeset
2182 endfunc
054623fc54c5 patch 8.2.3471: crash when using CTRL-T after an empty search pattern
Bram Moolenaar <Bram@vim.org>
parents: 25511
diff changeset
2183
25911
d6d31972c76d patch 8.2.3489: ml_get error after search with range
Bram Moolenaar <Bram@vim.org>
parents: 25876
diff changeset
2184 func Test_search_with_invalid_range()
d6d31972c76d patch 8.2.3489: ml_get error after search with range
Bram Moolenaar <Bram@vim.org>
parents: 25876
diff changeset
2185 new
d6d31972c76d patch 8.2.3489: ml_get error after search with range
Bram Moolenaar <Bram@vim.org>
parents: 25876
diff changeset
2186 let lines =<< trim END
d6d31972c76d patch 8.2.3489: ml_get error after search with range
Bram Moolenaar <Bram@vim.org>
parents: 25876
diff changeset
2187 /\%.v
d6d31972c76d patch 8.2.3489: ml_get error after search with range
Bram Moolenaar <Bram@vim.org>
parents: 25876
diff changeset
2188 5/
d6d31972c76d patch 8.2.3489: ml_get error after search with range
Bram Moolenaar <Bram@vim.org>
parents: 25876
diff changeset
2189 c
d6d31972c76d patch 8.2.3489: ml_get error after search with range
Bram Moolenaar <Bram@vim.org>
parents: 25876
diff changeset
2190 END
30769
ae10b91ac6b3 patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 29277
diff changeset
2191 call writefile(lines, 'Xrangesearch', 'D')
25911
d6d31972c76d patch 8.2.3489: ml_get error after search with range
Bram Moolenaar <Bram@vim.org>
parents: 25876
diff changeset
2192 source Xrangesearch
d6d31972c76d patch 8.2.3489: ml_get error after search with range
Bram Moolenaar <Bram@vim.org>
parents: 25876
diff changeset
2193
d6d31972c76d patch 8.2.3489: ml_get error after search with range
Bram Moolenaar <Bram@vim.org>
parents: 25876
diff changeset
2194 bwipe!
d6d31972c76d patch 8.2.3489: ml_get error after search with range
Bram Moolenaar <Bram@vim.org>
parents: 25876
diff changeset
2195 endfunc
d6d31972c76d patch 8.2.3489: ml_get error after search with range
Bram Moolenaar <Bram@vim.org>
parents: 25876
diff changeset
2196
25874
054623fc54c5 patch 8.2.3471: crash when using CTRL-T after an empty search pattern
Bram Moolenaar <Bram@vim.org>
parents: 25511
diff changeset
2197
19308
6fd567c927c0 patch 8.2.0212: missing search/substitute pattern hardly tested
Bram Moolenaar <Bram@vim.org>
parents: 19151
diff changeset
2198 " vim: shiftwidth=2 sts=2 expandtab