Mercurial > vim
annotate src/testdir/test_shortpathname.vim @ 26378:a926ccd92ae1 v8.2.3720
patch 8.2.3720: Vim9: Internal error when invoking closure in legacy context
Commit: https://github.com/vim/vim/commit/69c76171f1a78b829196f72d7010fbe1d9ad2944
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Dec 2 16:38:52 2021 +0000
patch 8.2.3720: Vim9: Internal error when invoking closure in legacy context
Problem: Vim9: Internal error when invoking closure in legacy context.
Solution: Give a more appropriate error message. (closes https://github.com/vim/vim/issues/9251)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 02 Dec 2021 17:45:03 +0100 |
parents | 08940efa6b4e |
children | d4b549180a07 |
rev | line source |
---|---|
13146
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Test for shortpathname ':8' extension. |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 " Only for use on Win32 systems! |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 |
18479
cbea1392c393
patch 8.1.2234: get_short_pathname() fails depending on encoding
Bram Moolenaar <Bram@vim.org>
parents:
17663
diff
changeset
|
4 set encoding=utf-8 |
cbea1392c393
patch 8.1.2234: get_short_pathname() fails depending on encoding
Bram Moolenaar <Bram@vim.org>
parents:
17663
diff
changeset
|
5 scriptencoding utf-8 |
cbea1392c393
patch 8.1.2234: get_short_pathname() fails depending on encoding
Bram Moolenaar <Bram@vim.org>
parents:
17663
diff
changeset
|
6 |
17663
403ac78df9a0
patch 8.1.1829: difference in screenshots
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
7 source check.vim |
403ac78df9a0
patch 8.1.1829: difference in screenshots
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
8 CheckMSWindows |
13146
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 func TestIt(file, bits, expected) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 let res = fnamemodify(a:file, a:bits) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 if a:expected != '' |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 call assert_equal(substitute(a:expected, '/', '\\', 'g'), |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 \ substitute(res, '/', '\\', 'g'), |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 \ "'" . a:file . "'->(" . a:bits . ")->'" . res . "'") |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 endif |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 endfunc |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 func Test_ColonEight() |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 let save_dir = getcwd() |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 " This could change for CygWin to //cygdrive/c |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 let dir1 = 'c:/x.x.y' |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 if filereadable(dir1) || isdirectory(dir1) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 call assert_report("Fatal: '" . dir1 . "' exists, cannot run test") |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 return |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 endif |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 let file1 = dir1 . '/zz.y.txt' |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
30 let nofile1 = dir1 . '/z.y.txt' |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 let dir2 = dir1 . '/VimIsTheGreatestSinceSlicedBread' |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 let file2 = dir2 . '/z.txt' |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 let nofile2 = dir2 . '/zz.txt' |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
34 |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
35 call mkdir(dir1) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
36 let resdir1 = substitute(fnamemodify(dir1, ':p:8'), '/$', '', '') |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
37 call assert_match('\V\^c:/XX\x\x\x\x~1.Y\$', resdir1) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
38 |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
39 let resfile1 = resdir1 . '/ZZY~1.TXT' |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
40 let resnofile1 = resdir1 . '/z.y.txt' |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
41 let resdir2 = resdir1 . '/VIMIST~1' |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
42 let resfile2 = resdir2 . '/z.txt' |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
43 let resnofile2 = resdir2 . '/zz.txt' |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
44 |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
45 call mkdir(dir2) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
46 call writefile([], file1) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
47 call writefile([], file2) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
48 |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
49 call TestIt(file1, ':p:8', resfile1) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
50 call TestIt(nofile1, ':p:8', resnofile1) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
51 call TestIt(file2, ':p:8', resfile2) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
52 call TestIt(nofile2, ':p:8', resnofile2) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
53 call TestIt(nofile2, ':p:8:h', fnamemodify(resnofile2, ':h')) |
18568
26a04a556982
patch 8.1.2278: using "cd" with "exe" may fail
Bram Moolenaar <Bram@vim.org>
parents:
18479
diff
changeset
|
54 call chdir(dir1) |
13146
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
55 call TestIt(file1, ':.:8', strpart(resfile1, strlen(resdir1)+1)) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
56 call TestIt(nofile1, ':.:8', strpart(resnofile1, strlen(resdir1)+1)) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
57 call TestIt(file2, ':.:8', strpart(resfile2, strlen(resdir1)+1)) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
58 call TestIt(nofile2, ':.:8', strpart(resnofile2, strlen(resdir1)+1)) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
59 let $HOME=dir1 |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
60 call TestIt(file1, ':~:8', '~' . strpart(resfile1, strlen(resdir1))) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
61 call TestIt(nofile1, ':~:8', '~' . strpart(resnofile1, strlen(resdir1))) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
62 call TestIt(file2, ':~:8', '~' . strpart(resfile2, strlen(resdir1))) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
63 call TestIt(nofile2, ':~:8', '~' . strpart(resnofile2, strlen(resdir1))) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
64 |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
65 cd c:/ |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
66 call delete(file2) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
67 call delete(file1) |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
68 call delete(dir2, 'd') |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
69 call delete(dir1, 'd') |
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
70 |
18568
26a04a556982
patch 8.1.2278: using "cd" with "exe" may fail
Bram Moolenaar <Bram@vim.org>
parents:
18479
diff
changeset
|
71 call chdir(save_dir) |
13146
d9a94be389b5
patch 8.0.1447: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
72 endfunc |
18479
cbea1392c393
patch 8.1.2234: get_short_pathname() fails depending on encoding
Bram Moolenaar <Bram@vim.org>
parents:
17663
diff
changeset
|
73 |
cbea1392c393
patch 8.1.2234: get_short_pathname() fails depending on encoding
Bram Moolenaar <Bram@vim.org>
parents:
17663
diff
changeset
|
74 func Test_ColonEight_MultiByte() |
cbea1392c393
patch 8.1.2234: get_short_pathname() fails depending on encoding
Bram Moolenaar <Bram@vim.org>
parents:
17663
diff
changeset
|
75 let dir = 'Xtest' |
cbea1392c393
patch 8.1.2234: get_short_pathname() fails depending on encoding
Bram Moolenaar <Bram@vim.org>
parents:
17663
diff
changeset
|
76 |
cbea1392c393
patch 8.1.2234: get_short_pathname() fails depending on encoding
Bram Moolenaar <Bram@vim.org>
parents:
17663
diff
changeset
|
77 let file = dir . '/日本語のファイル.txt' |
cbea1392c393
patch 8.1.2234: get_short_pathname() fails depending on encoding
Bram Moolenaar <Bram@vim.org>
parents:
17663
diff
changeset
|
78 |
cbea1392c393
patch 8.1.2234: get_short_pathname() fails depending on encoding
Bram Moolenaar <Bram@vim.org>
parents:
17663
diff
changeset
|
79 call mkdir(dir) |
cbea1392c393
patch 8.1.2234: get_short_pathname() fails depending on encoding
Bram Moolenaar <Bram@vim.org>
parents:
17663
diff
changeset
|
80 call writefile([], file) |
cbea1392c393
patch 8.1.2234: get_short_pathname() fails depending on encoding
Bram Moolenaar <Bram@vim.org>
parents:
17663
diff
changeset
|
81 |
cbea1392c393
patch 8.1.2234: get_short_pathname() fails depending on encoding
Bram Moolenaar <Bram@vim.org>
parents:
17663
diff
changeset
|
82 let sfile = fnamemodify(file, ':8') |
cbea1392c393
patch 8.1.2234: get_short_pathname() fails depending on encoding
Bram Moolenaar <Bram@vim.org>
parents:
17663
diff
changeset
|
83 |
cbea1392c393
patch 8.1.2234: get_short_pathname() fails depending on encoding
Bram Moolenaar <Bram@vim.org>
parents:
17663
diff
changeset
|
84 call assert_notequal(file, sfile) |
cbea1392c393
patch 8.1.2234: get_short_pathname() fails depending on encoding
Bram Moolenaar <Bram@vim.org>
parents:
17663
diff
changeset
|
85 call assert_match('\~', sfile) |
cbea1392c393
patch 8.1.2234: get_short_pathname() fails depending on encoding
Bram Moolenaar <Bram@vim.org>
parents:
17663
diff
changeset
|
86 |
cbea1392c393
patch 8.1.2234: get_short_pathname() fails depending on encoding
Bram Moolenaar <Bram@vim.org>
parents:
17663
diff
changeset
|
87 call delete(file) |
cbea1392c393
patch 8.1.2234: get_short_pathname() fails depending on encoding
Bram Moolenaar <Bram@vim.org>
parents:
17663
diff
changeset
|
88 call delete(dir, 'd') |
cbea1392c393
patch 8.1.2234: get_short_pathname() fails depending on encoding
Bram Moolenaar <Bram@vim.org>
parents:
17663
diff
changeset
|
89 endfunc |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
90 |
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
18568
diff
changeset
|
91 " vim: shiftwidth=2 sts=2 expandtab |