Mercurial > vim
annotate src/testdir/test_expand_func.vim @ 29869:0eab537e9ccb v9.0.0273
patch 9.0.0273: Konsole termresponse not recognized
Commit: https://github.com/vim/vim/commit/d55f9ef8b2f1e9f868ed1440fe859d1b18b1cfe8
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Aug 26 12:26:07 2022 +0100
patch 9.0.0273: Konsole termresponse not recognized
Problem: Konsole termresponse not recognized.
Solution: Handle Konsole like libvterm, set 'ttymouse' to "sgr".
(closes #10990)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 26 Aug 2022 13:30:03 +0200 |
parents | 32f358d71ec2 |
children | ea38db8639eb |
rev | line source |
---|---|
14700
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Tests for expand() |
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
21594
5daca8504c63
patch 8.2.1347: cannot easily get the script ID
Bram Moolenaar <Bram@vim.org>
parents:
21493
diff
changeset
|
3 source shared.vim |
5daca8504c63
patch 8.2.1347: cannot easily get the script ID
Bram Moolenaar <Bram@vim.org>
parents:
21493
diff
changeset
|
4 |
14700
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 let s:sfile = expand('<sfile>') |
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 let s:slnum = str2nr(expand('<slnum>')) |
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 let s:sflnum = str2nr(expand('<sflnum>')) |
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 |
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 func s:expand_sfile() |
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 return expand('<sfile>') |
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 endfunc |
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 |
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 func s:expand_slnum() |
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 return str2nr(expand('<slnum>')) |
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 endfunc |
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 |
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 func s:expand_sflnum() |
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 return str2nr(expand('<sflnum>')) |
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 endfunc |
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 |
21493
7449921216bc
patch 8.2.1297: when a test fails it's often not easy to see where
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
21 " This test depends on the location in the test file, put it first. |
7449921216bc
patch 8.2.1297: when a test fails it's often not easy to see where
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
22 func Test_expand_sflnum() |
21594
5daca8504c63
patch 8.2.1347: cannot easily get the script ID
Bram Moolenaar <Bram@vim.org>
parents:
21493
diff
changeset
|
23 call assert_equal(7, s:sflnum) |
5daca8504c63
patch 8.2.1347: cannot easily get the script ID
Bram Moolenaar <Bram@vim.org>
parents:
21493
diff
changeset
|
24 call assert_equal(24, str2nr(expand('<sflnum>'))) |
21493
7449921216bc
patch 8.2.1297: when a test fails it's often not easy to see where
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
25 |
7449921216bc
patch 8.2.1297: when a test fails it's often not easy to see where
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
26 " Line-continuation |
7449921216bc
patch 8.2.1297: when a test fails it's often not easy to see where
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
27 call assert_equal( |
21594
5daca8504c63
patch 8.2.1347: cannot easily get the script ID
Bram Moolenaar <Bram@vim.org>
parents:
21493
diff
changeset
|
28 \ 27, |
21493
7449921216bc
patch 8.2.1297: when a test fails it's often not easy to see where
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
29 \ str2nr(expand('<sflnum>'))) |
14700
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
30 |
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 " Call in script-local function |
21594
5daca8504c63
patch 8.2.1347: cannot easily get the script ID
Bram Moolenaar <Bram@vim.org>
parents:
21493
diff
changeset
|
32 call assert_equal(18, s:expand_sflnum()) |
21493
7449921216bc
patch 8.2.1297: when a test fails it's often not easy to see where
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
33 |
7449921216bc
patch 8.2.1297: when a test fails it's often not easy to see where
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
34 " Call in command |
7449921216bc
patch 8.2.1297: when a test fails it's often not easy to see where
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
35 command Flnum echo expand('<sflnum>') |
21594
5daca8504c63
patch 8.2.1347: cannot easily get the script ID
Bram Moolenaar <Bram@vim.org>
parents:
21493
diff
changeset
|
36 call assert_equal(36, str2nr(trim(execute('Flnum')))) |
21493
7449921216bc
patch 8.2.1297: when a test fails it's often not easy to see where
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
37 delcommand Flnum |
7449921216bc
patch 8.2.1297: when a test fails it's often not easy to see where
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
38 endfunc |
7449921216bc
patch 8.2.1297: when a test fails it's often not easy to see where
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
39 |
7449921216bc
patch 8.2.1297: when a test fails it's often not easy to see where
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
40 func Test_expand_sfile_and_stack() |
7449921216bc
patch 8.2.1297: when a test fails it's often not easy to see where
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
41 call assert_match('test_expand_func\.vim$', s:sfile) |
22208
a607f02fd17a
patch 8.2.1653: expand('<stack>') does not include the final line number
Bram Moolenaar <Bram@vim.org>
parents:
21594
diff
changeset
|
42 let expected = 'script .*testdir/runtest.vim\[\d\+\]\.\.function RunTheTest\[\d\+\]\.\.Test_expand_sfile_and_stack' |
a607f02fd17a
patch 8.2.1653: expand('<stack>') does not include the final line number
Bram Moolenaar <Bram@vim.org>
parents:
21594
diff
changeset
|
43 call assert_match(expected .. '$', expand('<sfile>')) |
29754
32f358d71ec2
patch 9.0.0217: 'shellslash' works differently when sourcing a script again
Bram Moolenaar <Bram@vim.org>
parents:
28637
diff
changeset
|
44 call assert_match(expected .. '\[4\]$' , expand('<stack>')) |
21493
7449921216bc
patch 8.2.1297: when a test fails it's often not easy to see where
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
45 |
7449921216bc
patch 8.2.1297: when a test fails it's often not easy to see where
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
46 " Call in script-local function |
7449921216bc
patch 8.2.1297: when a test fails it's often not easy to see where
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
47 call assert_match('script .*testdir/runtest.vim\[\d\+\]\.\.function RunTheTest\[\d\+\]\.\.Test_expand_sfile_and_stack\[7\]\.\.<SNR>\d\+_expand_sfile$', s:expand_sfile()) |
14700
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
48 |
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
49 " Call in command |
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
50 command Sfile echo expand('<sfile>') |
21493
7449921216bc
patch 8.2.1297: when a test fails it's often not easy to see where
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
51 call assert_match('script .*testdir/runtest.vim\[\d\+\]\.\.function RunTheTest\[\d\+\]\.\.Test_expand_sfile_and_stack$', trim(execute('Sfile'))) |
14700
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
52 delcommand Sfile |
21493
7449921216bc
patch 8.2.1297: when a test fails it's often not easy to see where
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
53 |
7449921216bc
patch 8.2.1297: when a test fails it's often not easy to see where
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
54 " Use <stack> from sourced script. |
7449921216bc
patch 8.2.1297: when a test fails it's often not easy to see where
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
55 let lines =<< trim END |
22208
a607f02fd17a
patch 8.2.1653: expand('<stack>') does not include the final line number
Bram Moolenaar <Bram@vim.org>
parents:
21594
diff
changeset
|
56 " comment here |
21493
7449921216bc
patch 8.2.1297: when a test fails it's often not easy to see where
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
57 let g:stack_value = expand('<stack>') |
7449921216bc
patch 8.2.1297: when a test fails it's often not easy to see where
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
58 END |
7449921216bc
patch 8.2.1297: when a test fails it's often not easy to see where
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
59 call writefile(lines, 'Xstack') |
7449921216bc
patch 8.2.1297: when a test fails it's often not easy to see where
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
60 source Xstack |
22218
195a617b405a
patch 8.2.1658: expand('<stack>') has trailing ".."
Bram Moolenaar <Bram@vim.org>
parents:
22208
diff
changeset
|
61 call assert_match('\<Xstack\[2\]$', g:stack_value) |
29754
32f358d71ec2
patch 9.0.0217: 'shellslash' works differently when sourcing a script again
Bram Moolenaar <Bram@vim.org>
parents:
28637
diff
changeset
|
62 unlet g:stack_value |
21493
7449921216bc
patch 8.2.1297: when a test fails it's often not easy to see where
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
63 call delete('Xstack') |
29754
32f358d71ec2
patch 9.0.0217: 'shellslash' works differently when sourcing a script again
Bram Moolenaar <Bram@vim.org>
parents:
28637
diff
changeset
|
64 |
32f358d71ec2
patch 9.0.0217: 'shellslash' works differently when sourcing a script again
Bram Moolenaar <Bram@vim.org>
parents:
28637
diff
changeset
|
65 if exists('+shellslash') |
32f358d71ec2
patch 9.0.0217: 'shellslash' works differently when sourcing a script again
Bram Moolenaar <Bram@vim.org>
parents:
28637
diff
changeset
|
66 call mkdir('Xshellslash') |
32f358d71ec2
patch 9.0.0217: 'shellslash' works differently when sourcing a script again
Bram Moolenaar <Bram@vim.org>
parents:
28637
diff
changeset
|
67 let lines =<< trim END |
32f358d71ec2
patch 9.0.0217: 'shellslash' works differently when sourcing a script again
Bram Moolenaar <Bram@vim.org>
parents:
28637
diff
changeset
|
68 let g:stack1 = expand('<stack>') |
32f358d71ec2
patch 9.0.0217: 'shellslash' works differently when sourcing a script again
Bram Moolenaar <Bram@vim.org>
parents:
28637
diff
changeset
|
69 set noshellslash |
32f358d71ec2
patch 9.0.0217: 'shellslash' works differently when sourcing a script again
Bram Moolenaar <Bram@vim.org>
parents:
28637
diff
changeset
|
70 let g:stack2 = expand('<stack>') |
32f358d71ec2
patch 9.0.0217: 'shellslash' works differently when sourcing a script again
Bram Moolenaar <Bram@vim.org>
parents:
28637
diff
changeset
|
71 set shellslash |
32f358d71ec2
patch 9.0.0217: 'shellslash' works differently when sourcing a script again
Bram Moolenaar <Bram@vim.org>
parents:
28637
diff
changeset
|
72 let g:stack3 = expand('<stack>') |
32f358d71ec2
patch 9.0.0217: 'shellslash' works differently when sourcing a script again
Bram Moolenaar <Bram@vim.org>
parents:
28637
diff
changeset
|
73 END |
32f358d71ec2
patch 9.0.0217: 'shellslash' works differently when sourcing a script again
Bram Moolenaar <Bram@vim.org>
parents:
28637
diff
changeset
|
74 call writefile(lines, 'Xshellslash/Xstack') |
32f358d71ec2
patch 9.0.0217: 'shellslash' works differently when sourcing a script again
Bram Moolenaar <Bram@vim.org>
parents:
28637
diff
changeset
|
75 " Test that changing 'shellslash' always affects the result of expand() |
32f358d71ec2
patch 9.0.0217: 'shellslash' works differently when sourcing a script again
Bram Moolenaar <Bram@vim.org>
parents:
28637
diff
changeset
|
76 " when sourcing a script multiple times. |
32f358d71ec2
patch 9.0.0217: 'shellslash' works differently when sourcing a script again
Bram Moolenaar <Bram@vim.org>
parents:
28637
diff
changeset
|
77 for i in range(2) |
32f358d71ec2
patch 9.0.0217: 'shellslash' works differently when sourcing a script again
Bram Moolenaar <Bram@vim.org>
parents:
28637
diff
changeset
|
78 source Xshellslash/Xstack |
32f358d71ec2
patch 9.0.0217: 'shellslash' works differently when sourcing a script again
Bram Moolenaar <Bram@vim.org>
parents:
28637
diff
changeset
|
79 call assert_match('\<Xshellslash/Xstack\[1\]$', g:stack1) |
32f358d71ec2
patch 9.0.0217: 'shellslash' works differently when sourcing a script again
Bram Moolenaar <Bram@vim.org>
parents:
28637
diff
changeset
|
80 call assert_match('\<Xshellslash\\Xstack\[3\]$', g:stack2) |
32f358d71ec2
patch 9.0.0217: 'shellslash' works differently when sourcing a script again
Bram Moolenaar <Bram@vim.org>
parents:
28637
diff
changeset
|
81 call assert_match('\<Xshellslash/Xstack\[5\]$', g:stack3) |
32f358d71ec2
patch 9.0.0217: 'shellslash' works differently when sourcing a script again
Bram Moolenaar <Bram@vim.org>
parents:
28637
diff
changeset
|
82 unlet g:stack1 |
32f358d71ec2
patch 9.0.0217: 'shellslash' works differently when sourcing a script again
Bram Moolenaar <Bram@vim.org>
parents:
28637
diff
changeset
|
83 unlet g:stack2 |
32f358d71ec2
patch 9.0.0217: 'shellslash' works differently when sourcing a script again
Bram Moolenaar <Bram@vim.org>
parents:
28637
diff
changeset
|
84 unlet g:stack3 |
32f358d71ec2
patch 9.0.0217: 'shellslash' works differently when sourcing a script again
Bram Moolenaar <Bram@vim.org>
parents:
28637
diff
changeset
|
85 endfor |
32f358d71ec2
patch 9.0.0217: 'shellslash' works differently when sourcing a script again
Bram Moolenaar <Bram@vim.org>
parents:
28637
diff
changeset
|
86 call delete('Xshellslash', 'rf') |
32f358d71ec2
patch 9.0.0217: 'shellslash' works differently when sourcing a script again
Bram Moolenaar <Bram@vim.org>
parents:
28637
diff
changeset
|
87 endif |
14700
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
88 endfunc |
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
89 |
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
90 func Test_expand_slnum() |
21594
5daca8504c63
patch 8.2.1347: cannot easily get the script ID
Bram Moolenaar <Bram@vim.org>
parents:
21493
diff
changeset
|
91 call assert_equal(6, s:slnum) |
14700
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
92 call assert_equal(2, str2nr(expand('<slnum>'))) |
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
93 |
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
94 " Line-continuation |
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
95 call assert_equal( |
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
96 \ 5, |
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
97 \ str2nr(expand('<slnum>'))) |
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
98 |
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
99 " Call in script-local function |
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
100 call assert_equal(1, s:expand_slnum()) |
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
101 |
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
102 " Call in command |
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
103 command Slnum echo expand('<slnum>') |
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
104 call assert_equal(14, str2nr(trim(execute('Slnum')))) |
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
105 delcommand Slnum |
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
106 endfunc |
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
107 |
16668
81be817c9d9a
patch 8.1.1336: some eval functionality is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
14700
diff
changeset
|
108 func Test_expand() |
81be817c9d9a
patch 8.1.1336: some eval functionality is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
14700
diff
changeset
|
109 new |
28637
5cf6dee0f305
patch 8.2.4842: expand("%:p") is not empty when there is no buffer name
Bram Moolenaar <Bram@vim.org>
parents:
28635
diff
changeset
|
110 call assert_equal("", expand('%:S')) |
17849
73ddc462979d
patch 8.1.1921: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
16668
diff
changeset
|
111 call assert_equal('3', '<slnum>'->expand()) |
16668
81be817c9d9a
patch 8.1.1336: some eval functionality is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
14700
diff
changeset
|
112 call assert_equal(['4'], expand('<slnum>', v:false, v:true)) |
81be817c9d9a
patch 8.1.1336: some eval functionality is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
14700
diff
changeset
|
113 " Don't add any line above this, otherwise <slnum> will change. |
28635
dfe18756f2ad
patch 8.2.4841: empty string considered an error for expand()
Bram Moolenaar <Bram@vim.org>
parents:
22218
diff
changeset
|
114 call assert_equal("", expand('%')) |
dfe18756f2ad
patch 8.2.4841: empty string considered an error for expand()
Bram Moolenaar <Bram@vim.org>
parents:
22218
diff
changeset
|
115 set verbose=1 |
dfe18756f2ad
patch 8.2.4841: empty string considered an error for expand()
Bram Moolenaar <Bram@vim.org>
parents:
22218
diff
changeset
|
116 call assert_equal("", expand('%')) |
dfe18756f2ad
patch 8.2.4841: empty string considered an error for expand()
Bram Moolenaar <Bram@vim.org>
parents:
22218
diff
changeset
|
117 set verbose=0 |
28637
5cf6dee0f305
patch 8.2.4842: expand("%:p") is not empty when there is no buffer name
Bram Moolenaar <Bram@vim.org>
parents:
28635
diff
changeset
|
118 call assert_equal("", expand('%:p')) |
16668
81be817c9d9a
patch 8.1.1336: some eval functionality is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
14700
diff
changeset
|
119 quit |
81be817c9d9a
patch 8.1.1336: some eval functionality is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
14700
diff
changeset
|
120 endfunc |
19603
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
17849
diff
changeset
|
121 |
21594
5daca8504c63
patch 8.2.1347: cannot easily get the script ID
Bram Moolenaar <Bram@vim.org>
parents:
21493
diff
changeset
|
122 func s:sid_test() |
5daca8504c63
patch 8.2.1347: cannot easily get the script ID
Bram Moolenaar <Bram@vim.org>
parents:
21493
diff
changeset
|
123 return 'works' |
5daca8504c63
patch 8.2.1347: cannot easily get the script ID
Bram Moolenaar <Bram@vim.org>
parents:
21493
diff
changeset
|
124 endfunc |
5daca8504c63
patch 8.2.1347: cannot easily get the script ID
Bram Moolenaar <Bram@vim.org>
parents:
21493
diff
changeset
|
125 |
5daca8504c63
patch 8.2.1347: cannot easily get the script ID
Bram Moolenaar <Bram@vim.org>
parents:
21493
diff
changeset
|
126 func Test_expand_SID() |
5daca8504c63
patch 8.2.1347: cannot easily get the script ID
Bram Moolenaar <Bram@vim.org>
parents:
21493
diff
changeset
|
127 let sid = expand('<SID>') |
5daca8504c63
patch 8.2.1347: cannot easily get the script ID
Bram Moolenaar <Bram@vim.org>
parents:
21493
diff
changeset
|
128 execute 'let g:sid_result = ' .. sid .. 'sid_test()' |
5daca8504c63
patch 8.2.1347: cannot easily get the script ID
Bram Moolenaar <Bram@vim.org>
parents:
21493
diff
changeset
|
129 call assert_equal('works', g:sid_result) |
5daca8504c63
patch 8.2.1347: cannot easily get the script ID
Bram Moolenaar <Bram@vim.org>
parents:
21493
diff
changeset
|
130 endfunc |
5daca8504c63
patch 8.2.1347: cannot easily get the script ID
Bram Moolenaar <Bram@vim.org>
parents:
21493
diff
changeset
|
131 |
5daca8504c63
patch 8.2.1347: cannot easily get the script ID
Bram Moolenaar <Bram@vim.org>
parents:
21493
diff
changeset
|
132 |
19603
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
17849
diff
changeset
|
133 " Test for 'wildignore' with expand() |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
17849
diff
changeset
|
134 func Test_expand_wildignore() |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
17849
diff
changeset
|
135 set wildignore=*.vim |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
17849
diff
changeset
|
136 call assert_equal('', expand('test_expand_func.vim')) |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
17849
diff
changeset
|
137 call assert_equal('', expand('test_expand_func.vim', 0)) |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
17849
diff
changeset
|
138 call assert_equal([], expand('test_expand_func.vim', 0, 1)) |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
17849
diff
changeset
|
139 call assert_equal('test_expand_func.vim', expand('test_expand_func.vim', 1)) |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
17849
diff
changeset
|
140 call assert_equal(['test_expand_func.vim'], |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
17849
diff
changeset
|
141 \ expand('test_expand_func.vim', 1, 1)) |
19783
546bdeef35f1
patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
19603
diff
changeset
|
142 call assert_fails("call expand('*', [])", 'E745:') |
19603
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
17849
diff
changeset
|
143 set wildignore& |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
17849
diff
changeset
|
144 endfunc |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
17849
diff
changeset
|
145 |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
17849
diff
changeset
|
146 " vim: shiftwidth=2 sts=2 expandtab |