Mercurial > vim
annotate src/testdir/test_autochdir.vim @ 24281:243985ba92b5 v8.2.2681
patch 8.2.2681: Vim9: test fails for redeclaring script variable
Commit: https://github.com/vim/vim/commit/12be734faffe1da04dfa9098e73abaa864204bc5
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Mar 31 21:47:33 2021 +0200
patch 8.2.2681: Vim9: test fails for redeclaring script variable
Problem: Vim9: test fails for redeclaring script variable.
Solution: It's OK to assign to an existing script variable in legacy.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 31 Mar 2021 22:00:03 +0200 |
parents | 08940efa6b4e |
children | fa8161b003f6 |
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 |
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
28 " vim: shiftwidth=2 sts=2 expandtab |