annotate src/testdir/test_ex_mode.vim @ 30136:5380551172aa v9.0.0404

patch 9.0.0404: crash when passing invalid arguments to assert_fails() Commit: https://github.com/vim/vim/commit/1540d334a04d874c2aa9d26b82dbbcd4bc5a78de Author: Bram Moolenaar <Bram@vim.org> Date: Wed Sep 7 15:20:26 2022 +0100 patch 9.0.0404: crash when passing invalid arguments to assert_fails() Problem: Crash when passing invalid arguments to assert_fails(). Solution: Check for NULL string.
author Bram Moolenaar <Bram@vim.org>
date Wed, 07 Sep 2022 16:30:02 +0200
parents 34bb46847ba0
children ea38db8639eb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18924
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Test editing line in Ex mode (see :help Q and :help gQ).
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2
19289
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 18924
diff changeset
3 source check.vim
22782
53b996eb5e76 patch 8.2.1939: invalid memory access in Ex mode with global command
Bram Moolenaar <Bram@vim.org>
parents: 20897
diff changeset
4 source shared.vim
19289
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 18924
diff changeset
5
18924
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6 " Helper function to test editing line in Q Ex mode
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7 func Ex_Q(cmd)
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8 " Is there a simpler way to test editing Ex line?
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9 call feedkeys("Q"
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10 \ .. "let s:test_ex =<< END\<CR>"
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11 \ .. a:cmd .. "\<CR>"
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12 \ .. "END\<CR>"
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13 \ .. "visual\<CR>", 'tx')
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14 return s:test_ex[0]
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15 endfunc
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17 " Helper function to test editing line in gQ Ex mode
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18 func Ex_gQ(cmd)
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19 call feedkeys("gQ" .. a:cmd .. "\<C-b>\"\<CR>", 'tx')
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 let ret = @:[1:] " Remove leading quote.
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21 call feedkeys("visual\<CR>", 'tx')
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 return ret
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23 endfunc
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25 " Helper function to test editing line with both Q and gQ Ex mode.
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26 func Ex(cmd)
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27 return [Ex_Q(a:cmd), Ex_gQ(a:cmd)]
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28 endfunc
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30 " Test editing line in Ex mode (both Q and gQ)
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 func Test_ex_mode()
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32 let encoding_save = &encoding
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33 set sw=2
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35 for e in ['utf8', 'latin1']
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36 exe 'set encoding=' . e
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38 call assert_equal(['bar', 'bar'], Ex("foo bar\<C-u>bar"), e)
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39 call assert_equal(["1\<C-u>2", "1\<C-u>2"], Ex("1\<C-v>\<C-u>2"), e)
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40 call assert_equal(["1\<C-b>2\<C-e>3", '213'], Ex("1\<C-b>2\<C-e>3"), e)
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41 call assert_equal(['0123', '2013'], Ex("01\<Home>2\<End>3"), e)
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42 call assert_equal(['0123', '0213'], Ex("01\<Left>2\<Right>3"), e)
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
43 call assert_equal(['01234', '0342'], Ex("012\<Left>\<Left>\<Insert>3\<Insert>4"), e)
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44 call assert_equal(["foo bar\<C-w>", 'foo '], Ex("foo bar\<C-w>"), e)
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45 call assert_equal(['foo', 'foo'], Ex("fooba\<Del>\<Del>"), e)
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
46 call assert_equal(["foo\tbar", 'foobar'], Ex("foo\<Tab>bar"), e)
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
47 call assert_equal(["abbrev\t", 'abbreviate'], Ex("abbrev\<Tab>"), e)
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48 call assert_equal([' 1', "1\<C-t>\<C-t>"], Ex("1\<C-t>\<C-t>"), e)
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
49 call assert_equal([' 1', "1\<C-t>\<C-t>"], Ex("1\<C-t>\<C-t>\<C-d>"), e)
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
50 call assert_equal([' foo', ' foo'], Ex(" foo\<C-d>"), e)
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51 call assert_equal(['foo', ' foo0'], Ex(" foo0\<C-d>"), e)
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52 call assert_equal(['foo', ' foo^'], Ex(" foo^\<C-d>"), e)
19570
43c04edcafec patch 8.2.0342: some code in ex_getln.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19536
diff changeset
53 call assert_equal(['foo', 'foo'],
19581
848dc460adf0 patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19570
diff changeset
54 \ Ex("\<BS>\<C-H>\<Del>\<kDel>foo"), e)
848dc460adf0 patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19570
diff changeset
55 " default wildchar <Tab> interferes with this test
848dc460adf0 patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19570
diff changeset
56 set wildchar=<c-e>
848dc460adf0 patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19570
diff changeset
57 call assert_equal(["a\tb", "a\tb"], Ex("a\t\t\<C-H>b"), e)
19603
6d3c683466f4 patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents: 19581
diff changeset
58 call assert_equal(["\t mn", "\tm\<C-T>n"], Ex("\tm\<C-T>n"), e)
19581
848dc460adf0 patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19570
diff changeset
59 set wildchar&
18924
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
60 endfor
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
61
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62 set sw&
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
63 let &encoding = encoding_save
a18d7782b80f patch 8.2.0023: command line editing not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
64 endfunc
19289
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 18924
diff changeset
65
19425
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
66 " Test substitute confirmation prompt :%s/pat/str/c in Ex mode
19289
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 18924
diff changeset
67 func Test_Ex_substitute()
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 18924
diff changeset
68 CheckRunVimInTerminal
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 18924
diff changeset
69 let buf = RunVimInTerminal('', {'rows': 6})
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 18924
diff changeset
70
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 18924
diff changeset
71 call term_sendkeys(buf, ":call setline(1, ['foo foo', 'foo foo', 'foo foo'])\<CR>")
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 18924
diff changeset
72 call term_sendkeys(buf, ":set number\<CR>")
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 18924
diff changeset
73 call term_sendkeys(buf, "gQ")
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 18924
diff changeset
74 call WaitForAssert({-> assert_match(':', term_getline(buf, 6))}, 1000)
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 18924
diff changeset
75
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 18924
diff changeset
76 call term_sendkeys(buf, "%s/foo/bar/gc\<CR>")
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 18924
diff changeset
77 call WaitForAssert({-> assert_match(' 1 foo foo', term_getline(buf, 5))},
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 18924
diff changeset
78 \ 1000)
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 18924
diff changeset
79 call WaitForAssert({-> assert_match(' ^^^', term_getline(buf, 6))}, 1000)
24383
ea2b697ddea8 patch 8.2.2732: prompt for s///c in Ex mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 23766
diff changeset
80 call term_sendkeys(buf, "N\<CR>")
ea2b697ddea8 patch 8.2.2732: prompt for s///c in Ex mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 23766
diff changeset
81 call term_wait(buf)
ea2b697ddea8 patch 8.2.2732: prompt for s///c in Ex mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 23766
diff changeset
82 call WaitForAssert({-> assert_match(' ^^^', term_getline(buf, 6))}, 1000)
19289
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 18924
diff changeset
83 call term_sendkeys(buf, "n\<CR>")
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 18924
diff changeset
84 call WaitForAssert({-> assert_match(' ^^^', term_getline(buf, 6))},
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 18924
diff changeset
85 \ 1000)
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 18924
diff changeset
86 call term_sendkeys(buf, "y\<CR>")
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 18924
diff changeset
87
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 18924
diff changeset
88 call term_sendkeys(buf, "q\<CR>")
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 18924
diff changeset
89 call WaitForAssert({-> assert_match(':', term_getline(buf, 6))}, 1000)
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 18924
diff changeset
90
19425
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
91 " Pressing enter in ex mode should print the current line
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
92 call term_sendkeys(buf, "\<CR>")
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
93 call WaitForAssert({-> assert_match(' 3 foo foo',
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
94 \ term_getline(buf, 5))}, 1000)
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19370
diff changeset
95
19289
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 18924
diff changeset
96 call term_sendkeys(buf, ":vi\<CR>")
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 18924
diff changeset
97 call WaitForAssert({-> assert_match('foo bar', term_getline(buf, 1))}, 1000)
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 18924
diff changeset
98
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 18924
diff changeset
99 call StopVimInTerminal(buf)
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 18924
diff changeset
100 endfunc
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 18924
diff changeset
101
19370
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
102 " Test for displaying lines from an empty buffer in Ex mode
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
103 func Test_Ex_emptybuf()
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
104 new
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
105 call assert_fails('call feedkeys("Q\<CR>", "xt")', 'E749:')
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
106 call setline(1, "abc")
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
107 call assert_fails('call feedkeys("Q\<CR>", "xt")', 'E501:')
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
108 call assert_fails('call feedkeys("Q%d\<CR>", "xt")', 'E749:')
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
109 close!
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
110 endfunc
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
111
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
112 " Test for the :open command
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
113 func Test_open_command()
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
114 new
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
115 call setline(1, ['foo foo', 'foo bar', 'foo baz'])
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
116 call feedkeys("Qopen\<CR>j", 'xt')
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
117 call assert_equal('foo bar', getline('.'))
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
118 call feedkeys("Qopen /bar/\<CR>", 'xt')
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
119 call assert_equal(5, col('.'))
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
120 call assert_fails('call feedkeys("Qopen /baz/\<CR>", "xt")', 'E479:')
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
121 close!
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
122 endfunc
02111977dd05 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
123
26420
75e6d917696e patch 8.2.3741: using freed memory in open command
Bram Moolenaar <Bram@vim.org>
parents: 24639
diff changeset
124 func Test_open_command_flush_line()
75e6d917696e patch 8.2.3741: using freed memory in open command
Bram Moolenaar <Bram@vim.org>
parents: 24639
diff changeset
125 " this was accessing freed memory: the regexp match uses a pointer to the
75e6d917696e patch 8.2.3741: using freed memory in open command
Bram Moolenaar <Bram@vim.org>
parents: 24639
diff changeset
126 " current line which becomes invalid when searching for the ') mark.
75e6d917696e patch 8.2.3741: using freed memory in open command
Bram Moolenaar <Bram@vim.org>
parents: 24639
diff changeset
127 new
75e6d917696e patch 8.2.3741: using freed memory in open command
Bram Moolenaar <Bram@vim.org>
parents: 24639
diff changeset
128 call setline(1, ['one', 'two. three'])
75e6d917696e patch 8.2.3741: using freed memory in open command
Bram Moolenaar <Bram@vim.org>
parents: 24639
diff changeset
129 s/one/ONE
75e6d917696e patch 8.2.3741: using freed memory in open command
Bram Moolenaar <Bram@vim.org>
parents: 24639
diff changeset
130 try
75e6d917696e patch 8.2.3741: using freed memory in open command
Bram Moolenaar <Bram@vim.org>
parents: 24639
diff changeset
131 open /\%')/
75e6d917696e patch 8.2.3741: using freed memory in open command
Bram Moolenaar <Bram@vim.org>
parents: 24639
diff changeset
132 catch /E479/
75e6d917696e patch 8.2.3741: using freed memory in open command
Bram Moolenaar <Bram@vim.org>
parents: 24639
diff changeset
133 endtry
75e6d917696e patch 8.2.3741: using freed memory in open command
Bram Moolenaar <Bram@vim.org>
parents: 24639
diff changeset
134 bwipe!
75e6d917696e patch 8.2.3741: using freed memory in open command
Bram Moolenaar <Bram@vim.org>
parents: 24639
diff changeset
135 endfunc
75e6d917696e patch 8.2.3741: using freed memory in open command
Bram Moolenaar <Bram@vim.org>
parents: 24639
diff changeset
136
19471
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19433
diff changeset
137 " Test for :g/pat/visual to run vi commands in Ex mode
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19433
diff changeset
138 " This used to hang Vim before 8.2.0274.
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19433
diff changeset
139 func Test_Ex_global()
19433
af9d5585cfbf patch 8.2.0274: hang with combination of feedkeys(), Ex mode and :global
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
140 new
19471
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19433
diff changeset
141 call setline(1, ['', 'foo', 'bar', 'foo', 'bar', 'foo'])
19536
bab20768e1fd patch 8.2.0325: ex_getln.c code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
142 call feedkeys("Q\<bs>g/bar/visual\<CR>$rxQ$ryQvisual\<CR>j", "xt")
19471
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19433
diff changeset
143 call assert_equal('bax', getline(3))
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19433
diff changeset
144 call assert_equal('bay', getline(5))
19433
af9d5585cfbf patch 8.2.0274: hang with combination of feedkeys(), Ex mode and :global
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
145 bwipe!
af9d5585cfbf patch 8.2.0274: hang with combination of feedkeys(), Ex mode and :global
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
146 endfunc
af9d5585cfbf patch 8.2.0274: hang with combination of feedkeys(), Ex mode and :global
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
147
29419
b43cb3fd0c7b patch 9.0.0051: using CTRL-C wih :append may hang Vim
Bram Moolenaar <Bram@vim.org>
parents: 29148
diff changeset
148 " Test for pressing Ctrl-C in :append inside a loop in Ex mode
b43cb3fd0c7b patch 9.0.0051: using CTRL-C wih :append may hang Vim
Bram Moolenaar <Bram@vim.org>
parents: 29148
diff changeset
149 " This used to hang Vim
b43cb3fd0c7b patch 9.0.0051: using CTRL-C wih :append may hang Vim
Bram Moolenaar <Bram@vim.org>
parents: 29148
diff changeset
150 func Test_Ex_append_in_loop()
b43cb3fd0c7b patch 9.0.0051: using CTRL-C wih :append may hang Vim
Bram Moolenaar <Bram@vim.org>
parents: 29148
diff changeset
151 CheckRunVimInTerminal
b43cb3fd0c7b patch 9.0.0051: using CTRL-C wih :append may hang Vim
Bram Moolenaar <Bram@vim.org>
parents: 29148
diff changeset
152 let buf = RunVimInTerminal('', {'rows': 6})
b43cb3fd0c7b patch 9.0.0051: using CTRL-C wih :append may hang Vim
Bram Moolenaar <Bram@vim.org>
parents: 29148
diff changeset
153
b43cb3fd0c7b patch 9.0.0051: using CTRL-C wih :append may hang Vim
Bram Moolenaar <Bram@vim.org>
parents: 29148
diff changeset
154 call term_sendkeys(buf, "gQ")
b43cb3fd0c7b patch 9.0.0051: using CTRL-C wih :append may hang Vim
Bram Moolenaar <Bram@vim.org>
parents: 29148
diff changeset
155 call term_sendkeys(buf, "for i in range(1)\<CR>")
b43cb3fd0c7b patch 9.0.0051: using CTRL-C wih :append may hang Vim
Bram Moolenaar <Bram@vim.org>
parents: 29148
diff changeset
156 call term_sendkeys(buf, "append\<CR>")
b43cb3fd0c7b patch 9.0.0051: using CTRL-C wih :append may hang Vim
Bram Moolenaar <Bram@vim.org>
parents: 29148
diff changeset
157 call WaitForAssert({-> assert_match(': append', term_getline(buf, 5))}, 1000)
b43cb3fd0c7b patch 9.0.0051: using CTRL-C wih :append may hang Vim
Bram Moolenaar <Bram@vim.org>
parents: 29148
diff changeset
158 call term_sendkeys(buf, "\<C-C>")
29481
34bb46847ba0 patch 9.0.0082: cannot interrupt global command from command line
Bram Moolenaar <Bram@vim.org>
parents: 29419
diff changeset
159 " Wait for input to be flushed
29419
b43cb3fd0c7b patch 9.0.0051: using CTRL-C wih :append may hang Vim
Bram Moolenaar <Bram@vim.org>
parents: 29148
diff changeset
160 call term_wait(buf)
b43cb3fd0c7b patch 9.0.0051: using CTRL-C wih :append may hang Vim
Bram Moolenaar <Bram@vim.org>
parents: 29148
diff changeset
161 call term_sendkeys(buf, "foo\<CR>")
b43cb3fd0c7b patch 9.0.0051: using CTRL-C wih :append may hang Vim
Bram Moolenaar <Bram@vim.org>
parents: 29148
diff changeset
162 call WaitForAssert({-> assert_match('foo', term_getline(buf, 5))}, 1000)
b43cb3fd0c7b patch 9.0.0051: using CTRL-C wih :append may hang Vim
Bram Moolenaar <Bram@vim.org>
parents: 29148
diff changeset
163 call term_sendkeys(buf, ".\<CR>")
b43cb3fd0c7b patch 9.0.0051: using CTRL-C wih :append may hang Vim
Bram Moolenaar <Bram@vim.org>
parents: 29148
diff changeset
164 call WaitForAssert({-> assert_match('.', term_getline(buf, 5))}, 1000)
b43cb3fd0c7b patch 9.0.0051: using CTRL-C wih :append may hang Vim
Bram Moolenaar <Bram@vim.org>
parents: 29148
diff changeset
165 call term_sendkeys(buf, "endfor\<CR>")
b43cb3fd0c7b patch 9.0.0051: using CTRL-C wih :append may hang Vim
Bram Moolenaar <Bram@vim.org>
parents: 29148
diff changeset
166 call term_sendkeys(buf, "vi\<CR>")
b43cb3fd0c7b patch 9.0.0051: using CTRL-C wih :append may hang Vim
Bram Moolenaar <Bram@vim.org>
parents: 29148
diff changeset
167 call WaitForAssert({-> assert_match('foo', term_getline(buf, 1))}, 1000)
b43cb3fd0c7b patch 9.0.0051: using CTRL-C wih :append may hang Vim
Bram Moolenaar <Bram@vim.org>
parents: 29148
diff changeset
168
b43cb3fd0c7b patch 9.0.0051: using CTRL-C wih :append may hang Vim
Bram Moolenaar <Bram@vim.org>
parents: 29148
diff changeset
169 call StopVimInTerminal(buf)
b43cb3fd0c7b patch 9.0.0051: using CTRL-C wih :append may hang Vim
Bram Moolenaar <Bram@vim.org>
parents: 29148
diff changeset
170 endfunc
b43cb3fd0c7b patch 9.0.0051: using CTRL-C wih :append may hang Vim
Bram Moolenaar <Bram@vim.org>
parents: 29148
diff changeset
171
19536
bab20768e1fd patch 8.2.0325: ex_getln.c code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
172 " In Ex-mode, a backslash escapes a newline
bab20768e1fd patch 8.2.0325: ex_getln.c code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
173 func Test_Ex_escape_enter()
bab20768e1fd patch 8.2.0325: ex_getln.c code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
174 call feedkeys("gQlet l = \"a\\\<kEnter>b\"\<cr>vi\<cr>", 'xt')
bab20768e1fd patch 8.2.0325: ex_getln.c code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
175 call assert_equal("a\rb", l)
bab20768e1fd patch 8.2.0325: ex_getln.c code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
176 endfunc
bab20768e1fd patch 8.2.0325: ex_getln.c code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
177
19570
43c04edcafec patch 8.2.0342: some code in ex_getln.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19536
diff changeset
178 " Test for :append! command in Ex mode
43c04edcafec patch 8.2.0342: some code in ex_getln.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19536
diff changeset
179 func Test_Ex_append()
43c04edcafec patch 8.2.0342: some code in ex_getln.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19536
diff changeset
180 new
43c04edcafec patch 8.2.0342: some code in ex_getln.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19536
diff changeset
181 call setline(1, "\t abc")
43c04edcafec patch 8.2.0342: some code in ex_getln.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19536
diff changeset
182 call feedkeys("Qappend!\npqr\nxyz\n.\nvisual\n", 'xt')
43c04edcafec patch 8.2.0342: some code in ex_getln.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19536
diff changeset
183 call assert_equal(["\t abc", "\t pqr", "\t xyz"], getline(1, '$'))
43c04edcafec patch 8.2.0342: some code in ex_getln.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19536
diff changeset
184 close!
43c04edcafec patch 8.2.0342: some code in ex_getln.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19536
diff changeset
185 endfunc
43c04edcafec patch 8.2.0342: some code in ex_getln.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19536
diff changeset
186
19581
848dc460adf0 patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19570
diff changeset
187 " In Ex-mode, backslashes at the end of a command should be halved.
848dc460adf0 patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19570
diff changeset
188 func Test_Ex_echo_backslash()
848dc460adf0 patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19570
diff changeset
189 " This test works only when the language is English
19906
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 19754
diff changeset
190 CheckEnglish
19581
848dc460adf0 patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19570
diff changeset
191 let bsl = '\\\\'
848dc460adf0 patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19570
diff changeset
192 let bsl2 = '\\\'
848dc460adf0 patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19570
diff changeset
193 call assert_fails('call feedkeys("Qecho " .. bsl .. "\nvisual\n", "xt")',
24639
b2776ca79273 patch 8.2.2858: test fails because of changed error message
Bram Moolenaar <Bram@vim.org>
parents: 24383
diff changeset
194 \ 'E15: Invalid expression: "\\"')
19581
848dc460adf0 patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19570
diff changeset
195 call assert_fails('call feedkeys("Qecho " .. bsl2 .. "\nm\nvisual\n", "xt")',
24639
b2776ca79273 patch 8.2.2858: test fails because of changed error message
Bram Moolenaar <Bram@vim.org>
parents: 24383
diff changeset
196 \ "E15: Invalid expression: \"\\\nm\"")
19581
848dc460adf0 patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19570
diff changeset
197 endfunc
848dc460adf0 patch 8.2.0347: various code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19570
diff changeset
198
19625
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19603
diff changeset
199 func Test_ex_mode_errors()
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19603
diff changeset
200 " Not allowed to enter ex mode when text is locked
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19603
diff changeset
201 au InsertCharPre <buffer> normal! gQ<CR>
20118
252d2bb90394 patch 8.2.0614: get ml_get error when deleting a line in 'completefunc'
Bram Moolenaar <Bram@vim.org>
parents: 19906
diff changeset
202 let caught_e565 = 0
19625
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19603
diff changeset
203 try
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19603
diff changeset
204 call feedkeys("ix\<esc>", 'xt')
20118
252d2bb90394 patch 8.2.0614: get ml_get error when deleting a line in 'completefunc'
Bram Moolenaar <Bram@vim.org>
parents: 19906
diff changeset
205 catch /^Vim\%((\a\+)\)\=:E565/ " catch E565
252d2bb90394 patch 8.2.0614: get ml_get error when deleting a line in 'completefunc'
Bram Moolenaar <Bram@vim.org>
parents: 19906
diff changeset
206 let caught_e565 = 1
19625
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19603
diff changeset
207 endtry
20118
252d2bb90394 patch 8.2.0614: get ml_get error when deleting a line in 'completefunc'
Bram Moolenaar <Bram@vim.org>
parents: 19906
diff changeset
208 call assert_equal(1, caught_e565)
19625
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19603
diff changeset
209 au! InsertCharPre
20897
213fb059e02e patch 8.2.1000: get error when leaving Ex mode with :visual
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
210
213fb059e02e patch 8.2.1000: get error when leaving Ex mode with :visual
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
211 new
213fb059e02e patch 8.2.1000: get error when leaving Ex mode with :visual
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
212 au CmdLineEnter * call ExEnterFunc()
213fb059e02e patch 8.2.1000: get error when leaving Ex mode with :visual
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
213 func ExEnterFunc()
213fb059e02e patch 8.2.1000: get error when leaving Ex mode with :visual
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
214
213fb059e02e patch 8.2.1000: get error when leaving Ex mode with :visual
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
215 endfunc
213fb059e02e patch 8.2.1000: get error when leaving Ex mode with :visual
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
216 call feedkeys("gQvi\r", 'xt')
213fb059e02e patch 8.2.1000: get error when leaving Ex mode with :visual
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
217
213fb059e02e patch 8.2.1000: get error when leaving Ex mode with :visual
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
218 au! CmdLineEnter
213fb059e02e patch 8.2.1000: get error when leaving Ex mode with :visual
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
219 delfunc ExEnterFunc
213fb059e02e patch 8.2.1000: get error when leaving Ex mode with :visual
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
220 quit
19625
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19603
diff changeset
221 endfunc
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19603
diff changeset
222
22782
53b996eb5e76 patch 8.2.1939: invalid memory access in Ex mode with global command
Bram Moolenaar <Bram@vim.org>
parents: 20897
diff changeset
223 func Test_ex_mode_with_global()
22786
6fd35e873309 patch 8.2.1941: Ex mode test fails on MS-Windows with GUI
Bram Moolenaar <Bram@vim.org>
parents: 22782
diff changeset
224 CheckNotGui
22782
53b996eb5e76 patch 8.2.1939: invalid memory access in Ex mode with global command
Bram Moolenaar <Bram@vim.org>
parents: 20897
diff changeset
225 CheckFeature timers
53b996eb5e76 patch 8.2.1939: invalid memory access in Ex mode with global command
Bram Moolenaar <Bram@vim.org>
parents: 20897
diff changeset
226
53b996eb5e76 patch 8.2.1939: invalid memory access in Ex mode with global command
Bram Moolenaar <Bram@vim.org>
parents: 20897
diff changeset
227 " This will get stuck in Normal mode after the failed "J", use a timer to
53b996eb5e76 patch 8.2.1939: invalid memory access in Ex mode with global command
Bram Moolenaar <Bram@vim.org>
parents: 20897
diff changeset
228 " get going again.
53b996eb5e76 patch 8.2.1939: invalid memory access in Ex mode with global command
Bram Moolenaar <Bram@vim.org>
parents: 20897
diff changeset
229 let lines =<< trim END
53b996eb5e76 patch 8.2.1939: invalid memory access in Ex mode with global command
Bram Moolenaar <Bram@vim.org>
parents: 20897
diff changeset
230 call ch_logfile('logfile', 'w')
53b996eb5e76 patch 8.2.1939: invalid memory access in Ex mode with global command
Bram Moolenaar <Bram@vim.org>
parents: 20897
diff changeset
231 pedit
53b996eb5e76 patch 8.2.1939: invalid memory access in Ex mode with global command
Bram Moolenaar <Bram@vim.org>
parents: 20897
diff changeset
232 func FeedQ(id)
53b996eb5e76 patch 8.2.1939: invalid memory access in Ex mode with global command
Bram Moolenaar <Bram@vim.org>
parents: 20897
diff changeset
233 call feedkeys('Q', 't')
53b996eb5e76 patch 8.2.1939: invalid memory access in Ex mode with global command
Bram Moolenaar <Bram@vim.org>
parents: 20897
diff changeset
234 endfunc
53b996eb5e76 patch 8.2.1939: invalid memory access in Ex mode with global command
Bram Moolenaar <Bram@vim.org>
parents: 20897
diff changeset
235 call timer_start(10, 'FeedQ')
53b996eb5e76 patch 8.2.1939: invalid memory access in Ex mode with global command
Bram Moolenaar <Bram@vim.org>
parents: 20897
diff changeset
236 g/^/vi|HJ
53b996eb5e76 patch 8.2.1939: invalid memory access in Ex mode with global command
Bram Moolenaar <Bram@vim.org>
parents: 20897
diff changeset
237 call writefile(['done'], 'Xdidexmode')
53b996eb5e76 patch 8.2.1939: invalid memory access in Ex mode with global command
Bram Moolenaar <Bram@vim.org>
parents: 20897
diff changeset
238 qall!
53b996eb5e76 patch 8.2.1939: invalid memory access in Ex mode with global command
Bram Moolenaar <Bram@vim.org>
parents: 20897
diff changeset
239 END
53b996eb5e76 patch 8.2.1939: invalid memory access in Ex mode with global command
Bram Moolenaar <Bram@vim.org>
parents: 20897
diff changeset
240 call writefile(lines, 'Xexmodescript')
53b996eb5e76 patch 8.2.1939: invalid memory access in Ex mode with global command
Bram Moolenaar <Bram@vim.org>
parents: 20897
diff changeset
241 call assert_equal(1, RunVim([], [], '-e -s -S Xexmodescript'))
53b996eb5e76 patch 8.2.1939: invalid memory access in Ex mode with global command
Bram Moolenaar <Bram@vim.org>
parents: 20897
diff changeset
242 call assert_equal(['done'], readfile('Xdidexmode'))
53b996eb5e76 patch 8.2.1939: invalid memory access in Ex mode with global command
Bram Moolenaar <Bram@vim.org>
parents: 20897
diff changeset
243
22977
515d1651c6c6 patch 8.2.2035: MS-Windows: some tests may fail
Bram Moolenaar <Bram@vim.org>
parents: 22786
diff changeset
244 call delete('logfile')
22782
53b996eb5e76 patch 8.2.1939: invalid memory access in Ex mode with global command
Bram Moolenaar <Bram@vim.org>
parents: 20897
diff changeset
245 call delete('Xdidexmode')
53b996eb5e76 patch 8.2.1939: invalid memory access in Ex mode with global command
Bram Moolenaar <Bram@vim.org>
parents: 20897
diff changeset
246 call delete('Xexmodescript')
53b996eb5e76 patch 8.2.1939: invalid memory access in Ex mode with global command
Bram Moolenaar <Bram@vim.org>
parents: 20897
diff changeset
247 endfunc
53b996eb5e76 patch 8.2.1939: invalid memory access in Ex mode with global command
Bram Moolenaar <Bram@vim.org>
parents: 20897
diff changeset
248
23762
0f89d58eb3e3 patch 8.2.2422: crash when deleting with line number out of range
Bram Moolenaar <Bram@vim.org>
parents: 22977
diff changeset
249 func Test_ex_mode_count_overflow()
23766
704fdd4d0949 patch 8.2.2424: some tests are known to cause an error with ASAN
Bram Moolenaar <Bram@vim.org>
parents: 23762
diff changeset
250 " The multiplication causes an integer overflow
704fdd4d0949 patch 8.2.2424: some tests are known to cause an error with ASAN
Bram Moolenaar <Bram@vim.org>
parents: 23762
diff changeset
251 CheckNotAsan
704fdd4d0949 patch 8.2.2424: some tests are known to cause an error with ASAN
Bram Moolenaar <Bram@vim.org>
parents: 23762
diff changeset
252
23762
0f89d58eb3e3 patch 8.2.2422: crash when deleting with line number out of range
Bram Moolenaar <Bram@vim.org>
parents: 22977
diff changeset
253 " this used to cause a crash
0f89d58eb3e3 patch 8.2.2422: crash when deleting with line number out of range
Bram Moolenaar <Bram@vim.org>
parents: 22977
diff changeset
254 let lines =<< trim END
0f89d58eb3e3 patch 8.2.2422: crash when deleting with line number out of range
Bram Moolenaar <Bram@vim.org>
parents: 22977
diff changeset
255 call feedkeys("\<Esc>Q\<CR>")
0f89d58eb3e3 patch 8.2.2422: crash when deleting with line number out of range
Bram Moolenaar <Bram@vim.org>
parents: 22977
diff changeset
256 v9|9silent! vi|333333233333y32333333%O
0f89d58eb3e3 patch 8.2.2422: crash when deleting with line number out of range
Bram Moolenaar <Bram@vim.org>
parents: 22977
diff changeset
257 call writefile(['done'], 'Xdidexmode')
0f89d58eb3e3 patch 8.2.2422: crash when deleting with line number out of range
Bram Moolenaar <Bram@vim.org>
parents: 22977
diff changeset
258 qall!
0f89d58eb3e3 patch 8.2.2422: crash when deleting with line number out of range
Bram Moolenaar <Bram@vim.org>
parents: 22977
diff changeset
259 END
0f89d58eb3e3 patch 8.2.2422: crash when deleting with line number out of range
Bram Moolenaar <Bram@vim.org>
parents: 22977
diff changeset
260 call writefile(lines, 'Xexmodescript')
0f89d58eb3e3 patch 8.2.2422: crash when deleting with line number out of range
Bram Moolenaar <Bram@vim.org>
parents: 22977
diff changeset
261 call assert_equal(1, RunVim([], [], '-e -s -S Xexmodescript -c qa'))
0f89d58eb3e3 patch 8.2.2422: crash when deleting with line number out of range
Bram Moolenaar <Bram@vim.org>
parents: 22977
diff changeset
262 call assert_equal(['done'], readfile('Xdidexmode'))
0f89d58eb3e3 patch 8.2.2422: crash when deleting with line number out of range
Bram Moolenaar <Bram@vim.org>
parents: 22977
diff changeset
263
0f89d58eb3e3 patch 8.2.2422: crash when deleting with line number out of range
Bram Moolenaar <Bram@vim.org>
parents: 22977
diff changeset
264 call delete('Xdidexmode')
0f89d58eb3e3 patch 8.2.2422: crash when deleting with line number out of range
Bram Moolenaar <Bram@vim.org>
parents: 22977
diff changeset
265 call delete('Xexmodescript')
0f89d58eb3e3 patch 8.2.2422: crash when deleting with line number out of range
Bram Moolenaar <Bram@vim.org>
parents: 22977
diff changeset
266 endfunc
0f89d58eb3e3 patch 8.2.2422: crash when deleting with line number out of range
Bram Moolenaar <Bram@vim.org>
parents: 22977
diff changeset
267
27372
81d391f7c189 patch 8.2.4214: illegal memory access with large 'tabstop' in Ex mode
Bram Moolenaar <Bram@vim.org>
parents: 26420
diff changeset
268 func Test_ex_mode_large_indent()
81d391f7c189 patch 8.2.4214: illegal memory access with large 'tabstop' in Ex mode
Bram Moolenaar <Bram@vim.org>
parents: 26420
diff changeset
269 new
81d391f7c189 patch 8.2.4214: illegal memory access with large 'tabstop' in Ex mode
Bram Moolenaar <Bram@vim.org>
parents: 26420
diff changeset
270 set ts=500 ai
81d391f7c189 patch 8.2.4214: illegal memory access with large 'tabstop' in Ex mode
Bram Moolenaar <Bram@vim.org>
parents: 26420
diff changeset
271 call setline(1, "\t")
81d391f7c189 patch 8.2.4214: illegal memory access with large 'tabstop' in Ex mode
Bram Moolenaar <Bram@vim.org>
parents: 26420
diff changeset
272 exe "normal gQi\<CR>."
81d391f7c189 patch 8.2.4214: illegal memory access with large 'tabstop' in Ex mode
Bram Moolenaar <Bram@vim.org>
parents: 26420
diff changeset
273 set ts=8 noai
81d391f7c189 patch 8.2.4214: illegal memory access with large 'tabstop' in Ex mode
Bram Moolenaar <Bram@vim.org>
parents: 26420
diff changeset
274 bwipe!
81d391f7c189 patch 8.2.4214: illegal memory access with large 'tabstop' in Ex mode
Bram Moolenaar <Bram@vim.org>
parents: 26420
diff changeset
275 endfunc
81d391f7c189 patch 8.2.4214: illegal memory access with large 'tabstop' in Ex mode
Bram Moolenaar <Bram@vim.org>
parents: 26420
diff changeset
276
28477
0ae0946ebf9b patch 8.2.4763: using invalid pointer with "V:" in Ex mode
Bram Moolenaar <Bram@vim.org>
parents: 27372
diff changeset
277 " This was accessing illegal memory when using "+" for eap->cmd.
0ae0946ebf9b patch 8.2.4763: using invalid pointer with "V:" in Ex mode
Bram Moolenaar <Bram@vim.org>
parents: 27372
diff changeset
278 func Test_empty_command_visual_mode()
0ae0946ebf9b patch 8.2.4763: using invalid pointer with "V:" in Ex mode
Bram Moolenaar <Bram@vim.org>
parents: 27372
diff changeset
279 let lines =<< trim END
0ae0946ebf9b patch 8.2.4763: using invalid pointer with "V:" in Ex mode
Bram Moolenaar <Bram@vim.org>
parents: 27372
diff changeset
280 r<sfile>
0ae0946ebf9b patch 8.2.4763: using invalid pointer with "V:" in Ex mode
Bram Moolenaar <Bram@vim.org>
parents: 27372
diff changeset
281 0norm0V:
0ae0946ebf9b patch 8.2.4763: using invalid pointer with "V:" in Ex mode
Bram Moolenaar <Bram@vim.org>
parents: 27372
diff changeset
282 :qall!
0ae0946ebf9b patch 8.2.4763: using invalid pointer with "V:" in Ex mode
Bram Moolenaar <Bram@vim.org>
parents: 27372
diff changeset
283 END
0ae0946ebf9b patch 8.2.4763: using invalid pointer with "V:" in Ex mode
Bram Moolenaar <Bram@vim.org>
parents: 27372
diff changeset
284 call writefile(lines, 'Xexmodescript')
0ae0946ebf9b patch 8.2.4763: using invalid pointer with "V:" in Ex mode
Bram Moolenaar <Bram@vim.org>
parents: 27372
diff changeset
285 call assert_equal(1, RunVim([], [], '-u NONE -e -s -S Xexmodescript'))
0ae0946ebf9b patch 8.2.4763: using invalid pointer with "V:" in Ex mode
Bram Moolenaar <Bram@vim.org>
parents: 27372
diff changeset
286
0ae0946ebf9b patch 8.2.4763: using invalid pointer with "V:" in Ex mode
Bram Moolenaar <Bram@vim.org>
parents: 27372
diff changeset
287 call delete('Xexmodescript')
29148
8e87a5d2284c patch 8.2.5094: MS-Windows GUI: empty command may cause a dialog
Bram Moolenaar <Bram@vim.org>
parents: 28477
diff changeset
288
8e87a5d2284c patch 8.2.5094: MS-Windows GUI: empty command may cause a dialog
Bram Moolenaar <Bram@vim.org>
parents: 28477
diff changeset
289 " This may cause a dialog to be displayed for an empty command, ignore it.
8e87a5d2284c patch 8.2.5094: MS-Windows GUI: empty command may cause a dialog
Bram Moolenaar <Bram@vim.org>
parents: 28477
diff changeset
290 call delete('guidialogfile')
28477
0ae0946ebf9b patch 8.2.4763: using invalid pointer with "V:" in Ex mode
Bram Moolenaar <Bram@vim.org>
parents: 27372
diff changeset
291 endfunc
0ae0946ebf9b patch 8.2.4763: using invalid pointer with "V:" in Ex mode
Bram Moolenaar <Bram@vim.org>
parents: 27372
diff changeset
292
27372
81d391f7c189 patch 8.2.4214: illegal memory access with large 'tabstop' in Ex mode
Bram Moolenaar <Bram@vim.org>
parents: 26420
diff changeset
293
19289
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 18924
diff changeset
294 " vim: shiftwidth=2 sts=2 expandtab