Mercurial > vim
annotate src/testdir/test_autochdir.vim @ 26554:7a74515dde6b v8.2.3806
patch 8.2.3806: terminal focus test fails sometimes
Commit: https://github.com/vim/vim/commit/c2958585f6c7ce4d822d3191ba501c0757b3ffff
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Dec 14 11:16:31 2021 +0000
patch 8.2.3806: terminal focus test fails sometimes
Problem: Terminal focus test fails sometimes.
Solution: Run the test function before others.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 14 Dec 2021 12:30:03 +0100 |
parents | 013de2ce0e30 |
children | c95a3f25b6b1 |
rev | line source |
---|---|
9469
38e2fc4ee4ef
commit https://github.com/vim/vim/commit/5c71994f4ee5f87d4cce990dbc9684c70b1e108b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Test 'autochdir' behavior |
38e2fc4ee4ef
commit https://github.com/vim/vim/commit/5c71994f4ee5f87d4cce990dbc9684c70b1e108b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
17657
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
16951
diff
changeset
|
3 source check.vim |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
16951
diff
changeset
|
4 CheckOption autochdir |
9469
38e2fc4ee4ef
commit https://github.com/vim/vim/commit/5c71994f4ee5f87d4cce990dbc9684c70b1e108b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 |
38e2fc4ee4ef
commit https://github.com/vim/vim/commit/5c71994f4ee5f87d4cce990dbc9684c70b1e108b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 func Test_set_filename() |
12692
03a6aeea2096
patch 8.0.1224: still interference between test functions
Christian Brabandt <cb@256bit.org>
parents:
9469
diff
changeset
|
7 let cwd = getcwd() |
9469
38e2fc4ee4ef
commit https://github.com/vim/vim/commit/5c71994f4ee5f87d4cce990dbc9684c70b1e108b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 call test_autochdir() |
38e2fc4ee4ef
commit https://github.com/vim/vim/commit/5c71994f4ee5f87d4cce990dbc9684c70b1e108b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 set acd |
15184
90ab2d3ce11d
patch 8.1.0602: DirChanged is also triggered when directory didn't change
Bram Moolenaar <Bram@vim.org>
parents:
12692
diff
changeset
|
10 |
90ab2d3ce11d
patch 8.1.0602: DirChanged is also triggered when directory didn't change
Bram Moolenaar <Bram@vim.org>
parents:
12692
diff
changeset
|
11 let s:li = [] |
90ab2d3ce11d
patch 8.1.0602: DirChanged is also triggered when directory didn't change
Bram Moolenaar <Bram@vim.org>
parents:
12692
diff
changeset
|
12 autocmd DirChanged auto call add(s:li, "autocd") |
90ab2d3ce11d
patch 8.1.0602: DirChanged is also triggered when directory didn't change
Bram Moolenaar <Bram@vim.org>
parents:
12692
diff
changeset
|
13 autocmd DirChanged auto call add(s:li, expand("<afile>")) |
90ab2d3ce11d
patch 8.1.0602: DirChanged is also triggered when directory didn't change
Bram Moolenaar <Bram@vim.org>
parents:
12692
diff
changeset
|
14 |
9469
38e2fc4ee4ef
commit https://github.com/vim/vim/commit/5c71994f4ee5f87d4cce990dbc9684c70b1e108b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 new |
38e2fc4ee4ef
commit https://github.com/vim/vim/commit/5c71994f4ee5f87d4cce990dbc9684c70b1e108b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 w samples/Xtest |
38e2fc4ee4ef
commit https://github.com/vim/vim/commit/5c71994f4ee5f87d4cce990dbc9684c70b1e108b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 call assert_equal("Xtest", expand('%')) |
38e2fc4ee4ef
commit https://github.com/vim/vim/commit/5c71994f4ee5f87d4cce990dbc9684c70b1e108b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 call assert_equal("samples", substitute(getcwd(), '.*/\(\k*\)', '\1', '')) |
15184
90ab2d3ce11d
patch 8.1.0602: DirChanged is also triggered when directory didn't change
Bram Moolenaar <Bram@vim.org>
parents:
12692
diff
changeset
|
19 call assert_equal(["autocd", getcwd()], s:li) |
90ab2d3ce11d
patch 8.1.0602: DirChanged is also triggered when directory didn't change
Bram Moolenaar <Bram@vim.org>
parents:
12692
diff
changeset
|
20 |
9469
38e2fc4ee4ef
commit https://github.com/vim/vim/commit/5c71994f4ee5f87d4cce990dbc9684c70b1e108b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 bwipe! |
15184
90ab2d3ce11d
patch 8.1.0602: DirChanged is also triggered when directory didn't change
Bram Moolenaar <Bram@vim.org>
parents:
12692
diff
changeset
|
22 au! DirChanged |
9469
38e2fc4ee4ef
commit https://github.com/vim/vim/commit/5c71994f4ee5f87d4cce990dbc9684c70b1e108b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 set noacd |
18568
26a04a556982
patch 8.1.2278: using "cd" with "exe" may fail
Bram Moolenaar <Bram@vim.org>
parents:
17657
diff
changeset
|
24 call chdir(cwd) |
9469
38e2fc4ee4ef
commit https://github.com/vim/vim/commit/5c71994f4ee5f87d4cce990dbc9684c70b1e108b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 call delete('samples/Xtest') |
38e2fc4ee4ef
commit https://github.com/vim/vim/commit/5c71994f4ee5f87d4cce990dbc9684c70b1e108b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 endfunc |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
27 |
26416
7606d9b13068
patch 8.2.3739: in wrong directory when using win_execute() with 'acd' set
Bram Moolenaar <Bram@vim.org>
parents:
26181
diff
changeset
|
28 func Test_set_filename_other_window() |
7606d9b13068
patch 8.2.3739: in wrong directory when using win_execute() with 'acd' set
Bram Moolenaar <Bram@vim.org>
parents:
26181
diff
changeset
|
29 let cwd = getcwd() |
7606d9b13068
patch 8.2.3739: in wrong directory when using win_execute() with 'acd' set
Bram Moolenaar <Bram@vim.org>
parents:
26181
diff
changeset
|
30 call test_autochdir() |
7606d9b13068
patch 8.2.3739: in wrong directory when using win_execute() with 'acd' set
Bram Moolenaar <Bram@vim.org>
parents:
26181
diff
changeset
|
31 call mkdir('Xa') |
7606d9b13068
patch 8.2.3739: in wrong directory when using win_execute() with 'acd' set
Bram Moolenaar <Bram@vim.org>
parents:
26181
diff
changeset
|
32 call mkdir('Xb') |
7606d9b13068
patch 8.2.3739: in wrong directory when using win_execute() with 'acd' set
Bram Moolenaar <Bram@vim.org>
parents:
26181
diff
changeset
|
33 call mkdir('Xc') |
7606d9b13068
patch 8.2.3739: in wrong directory when using win_execute() with 'acd' set
Bram Moolenaar <Bram@vim.org>
parents:
26181
diff
changeset
|
34 try |
7606d9b13068
patch 8.2.3739: in wrong directory when using win_execute() with 'acd' set
Bram Moolenaar <Bram@vim.org>
parents:
26181
diff
changeset
|
35 args Xa/aaa.txt Xb/bbb.txt |
7606d9b13068
patch 8.2.3739: in wrong directory when using win_execute() with 'acd' set
Bram Moolenaar <Bram@vim.org>
parents:
26181
diff
changeset
|
36 set acd |
7606d9b13068
patch 8.2.3739: in wrong directory when using win_execute() with 'acd' set
Bram Moolenaar <Bram@vim.org>
parents:
26181
diff
changeset
|
37 let winid = win_getid() |
7606d9b13068
patch 8.2.3739: in wrong directory when using win_execute() with 'acd' set
Bram Moolenaar <Bram@vim.org>
parents:
26181
diff
changeset
|
38 snext |
7606d9b13068
patch 8.2.3739: in wrong directory when using win_execute() with 'acd' set
Bram Moolenaar <Bram@vim.org>
parents:
26181
diff
changeset
|
39 call assert_equal('Xb', substitute(getcwd(), '.*/\([^/]*\)$', '\1', '')) |
7606d9b13068
patch 8.2.3739: in wrong directory when using win_execute() with 'acd' set
Bram Moolenaar <Bram@vim.org>
parents:
26181
diff
changeset
|
40 call win_execute(winid, 'file ' .. cwd .. '/Xc/ccc.txt') |
7606d9b13068
patch 8.2.3739: in wrong directory when using win_execute() with 'acd' set
Bram Moolenaar <Bram@vim.org>
parents:
26181
diff
changeset
|
41 call assert_equal('Xb', substitute(getcwd(), '.*/\([^/]*\)$', '\1', '')) |
7606d9b13068
patch 8.2.3739: in wrong directory when using win_execute() with 'acd' set
Bram Moolenaar <Bram@vim.org>
parents:
26181
diff
changeset
|
42 finally |
7606d9b13068
patch 8.2.3739: in wrong directory when using win_execute() with 'acd' set
Bram Moolenaar <Bram@vim.org>
parents:
26181
diff
changeset
|
43 set noacd |
7606d9b13068
patch 8.2.3739: in wrong directory when using win_execute() with 'acd' set
Bram Moolenaar <Bram@vim.org>
parents:
26181
diff
changeset
|
44 call chdir(cwd) |
26422
4397cc04f2b1
patch 8.2.3742: dec mouse test fails without gnome terminfo entry
Bram Moolenaar <Bram@vim.org>
parents:
26416
diff
changeset
|
45 bwipe! aaa.txt |
4397cc04f2b1
patch 8.2.3742: dec mouse test fails without gnome terminfo entry
Bram Moolenaar <Bram@vim.org>
parents:
26416
diff
changeset
|
46 bwipe! bbb.txt |
4397cc04f2b1
patch 8.2.3742: dec mouse test fails without gnome terminfo entry
Bram Moolenaar <Bram@vim.org>
parents:
26416
diff
changeset
|
47 bwipe! ccc.txt |
26416
7606d9b13068
patch 8.2.3739: in wrong directory when using win_execute() with 'acd' set
Bram Moolenaar <Bram@vim.org>
parents:
26181
diff
changeset
|
48 call delete('Xa', 'rf') |
7606d9b13068
patch 8.2.3739: in wrong directory when using win_execute() with 'acd' set
Bram Moolenaar <Bram@vim.org>
parents:
26181
diff
changeset
|
49 call delete('Xb', 'rf') |
7606d9b13068
patch 8.2.3739: in wrong directory when using win_execute() with 'acd' set
Bram Moolenaar <Bram@vim.org>
parents:
26181
diff
changeset
|
50 call delete('Xc', 'rf') |
7606d9b13068
patch 8.2.3739: in wrong directory when using win_execute() with 'acd' set
Bram Moolenaar <Bram@vim.org>
parents:
26181
diff
changeset
|
51 endtry |
7606d9b13068
patch 8.2.3739: in wrong directory when using win_execute() with 'acd' set
Bram Moolenaar <Bram@vim.org>
parents:
26181
diff
changeset
|
52 endfunc |
7606d9b13068
patch 8.2.3739: in wrong directory when using win_execute() with 'acd' set
Bram Moolenaar <Bram@vim.org>
parents:
26181
diff
changeset
|
53 |
26171
fa8161b003f6
patch 8.2.3617: ":verbose pwd" does not mention 'autochdir' was applied
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
54 func Test_verbose_pwd() |
fa8161b003f6
patch 8.2.3617: ":verbose pwd" does not mention 'autochdir' was applied
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
55 let cwd = getcwd() |
fa8161b003f6
patch 8.2.3617: ":verbose pwd" does not mention 'autochdir' was applied
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
56 call test_autochdir() |
fa8161b003f6
patch 8.2.3617: ":verbose pwd" does not mention 'autochdir' was applied
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
57 |
fa8161b003f6
patch 8.2.3617: ":verbose pwd" does not mention 'autochdir' was applied
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
58 edit global.txt |
fa8161b003f6
patch 8.2.3617: ":verbose pwd" does not mention 'autochdir' was applied
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
59 call assert_match('\[global\].*testdir$', execute('verbose pwd')) |
fa8161b003f6
patch 8.2.3617: ":verbose pwd" does not mention 'autochdir' was applied
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
60 |
fa8161b003f6
patch 8.2.3617: ":verbose pwd" does not mention 'autochdir' was applied
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
61 call mkdir('Xautodir') |
fa8161b003f6
patch 8.2.3617: ":verbose pwd" does not mention 'autochdir' was applied
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
62 split Xautodir/local.txt |
fa8161b003f6
patch 8.2.3617: ":verbose pwd" does not mention 'autochdir' was applied
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
63 lcd Xautodir |
fa8161b003f6
patch 8.2.3617: ":verbose pwd" does not mention 'autochdir' was applied
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
64 call assert_match('\[window\].*testdir[/\\]Xautodir', execute('verbose pwd')) |
fa8161b003f6
patch 8.2.3617: ":verbose pwd" does not mention 'autochdir' was applied
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
65 |
fa8161b003f6
patch 8.2.3617: ":verbose pwd" does not mention 'autochdir' was applied
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
66 set acd |
fa8161b003f6
patch 8.2.3617: ":verbose pwd" does not mention 'autochdir' was applied
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
67 wincmd w |
fa8161b003f6
patch 8.2.3617: ":verbose pwd" does not mention 'autochdir' was applied
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
68 call assert_match('\[autochdir\].*testdir$', execute('verbose pwd')) |
26181
027c5b4b6f07
patch 8.2.3622: "verbose pwd" shows confusing info
Bram Moolenaar <Bram@vim.org>
parents:
26171
diff
changeset
|
69 execute 'lcd' cwd |
027c5b4b6f07
patch 8.2.3622: "verbose pwd" shows confusing info
Bram Moolenaar <Bram@vim.org>
parents:
26171
diff
changeset
|
70 call assert_match('\[window\].*testdir$', execute('verbose pwd')) |
027c5b4b6f07
patch 8.2.3622: "verbose pwd" shows confusing info
Bram Moolenaar <Bram@vim.org>
parents:
26171
diff
changeset
|
71 execute 'tcd' cwd |
027c5b4b6f07
patch 8.2.3622: "verbose pwd" shows confusing info
Bram Moolenaar <Bram@vim.org>
parents:
26171
diff
changeset
|
72 call assert_match('\[tabpage\].*testdir$', execute('verbose pwd')) |
027c5b4b6f07
patch 8.2.3622: "verbose pwd" shows confusing info
Bram Moolenaar <Bram@vim.org>
parents:
26171
diff
changeset
|
73 execute 'cd' cwd |
027c5b4b6f07
patch 8.2.3622: "verbose pwd" shows confusing info
Bram Moolenaar <Bram@vim.org>
parents:
26171
diff
changeset
|
74 call assert_match('\[global\].*testdir$', execute('verbose pwd')) |
027c5b4b6f07
patch 8.2.3622: "verbose pwd" shows confusing info
Bram Moolenaar <Bram@vim.org>
parents:
26171
diff
changeset
|
75 edit |
027c5b4b6f07
patch 8.2.3622: "verbose pwd" shows confusing info
Bram Moolenaar <Bram@vim.org>
parents:
26171
diff
changeset
|
76 call assert_match('\[autochdir\].*testdir$', execute('verbose pwd')) |
26171
fa8161b003f6
patch 8.2.3617: ":verbose pwd" does not mention 'autochdir' was applied
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
77 wincmd w |
fa8161b003f6
patch 8.2.3617: ":verbose pwd" does not mention 'autochdir' was applied
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
78 call assert_match('\[autochdir\].*testdir[/\\]Xautodir', execute('verbose pwd')) |
fa8161b003f6
patch 8.2.3617: ":verbose pwd" does not mention 'autochdir' was applied
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
79 set noacd |
fa8161b003f6
patch 8.2.3617: ":verbose pwd" does not mention 'autochdir' was applied
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
80 call assert_match('\[autochdir\].*testdir[/\\]Xautodir', execute('verbose pwd')) |
fa8161b003f6
patch 8.2.3617: ":verbose pwd" does not mention 'autochdir' was applied
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
81 wincmd w |
26416
7606d9b13068
patch 8.2.3739: in wrong directory when using win_execute() with 'acd' set
Bram Moolenaar <Bram@vim.org>
parents:
26181
diff
changeset
|
82 call assert_match('\[autochdir\].*testdir[/\\]Xautodir', execute('verbose pwd')) |
7606d9b13068
patch 8.2.3739: in wrong directory when using win_execute() with 'acd' set
Bram Moolenaar <Bram@vim.org>
parents:
26181
diff
changeset
|
83 execute 'cd' cwd |
26171
fa8161b003f6
patch 8.2.3617: ":verbose pwd" does not mention 'autochdir' was applied
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
84 call assert_match('\[global\].*testdir', execute('verbose pwd')) |
fa8161b003f6
patch 8.2.3617: ":verbose pwd" does not mention 'autochdir' was applied
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
85 wincmd w |
fa8161b003f6
patch 8.2.3617: ":verbose pwd" does not mention 'autochdir' was applied
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
86 call assert_match('\[window\].*testdir[/\\]Xautodir', execute('verbose pwd')) |
fa8161b003f6
patch 8.2.3617: ":verbose pwd" does not mention 'autochdir' was applied
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
87 |
fa8161b003f6
patch 8.2.3617: ":verbose pwd" does not mention 'autochdir' was applied
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
88 bwipe! |
fa8161b003f6
patch 8.2.3617: ":verbose pwd" does not mention 'autochdir' was applied
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
89 call chdir(cwd) |
fa8161b003f6
patch 8.2.3617: ":verbose pwd" does not mention 'autochdir' was applied
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
90 call delete('Xautodir', 'rf') |
fa8161b003f6
patch 8.2.3617: ":verbose pwd" does not mention 'autochdir' was applied
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
91 endfunc |
fa8161b003f6
patch 8.2.3617: ":verbose pwd" does not mention 'autochdir' was applied
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
92 |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
93 " vim: shiftwidth=2 sts=2 expandtab |