Mercurial > vim
annotate src/testdir/test_expand_func.vim @ 33223:def9fc5c92d1 v9.0.1886
patch 9.0.1886: Various Typos
Commit: https://github.com/vim/vim/commit/ee17b6f70d382ec6c5d8d27b56c4e84106ac8c55
Author: Christian Brabandt <cb@256bit.org>
Date: Sat Sep 9 11:23:50 2023 +0200
patch 9.0.1886: Various Typos
Problem: Various Typos
Solution: Fix Typos
This is a collection of typo related commits.
closes: #12753
closes: #13016
Co-authored-by: Adri Verhoef <a3@a3.xs4all.nl>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: Viktor Sz?pe <viktor@szepe.net>
Co-authored-by: nuid64 <lvkuzvesov@proton.me>
Co-authored-by: Meng Xiangzhuo <aumo@foxmail.com>
Co-authored-by: Dominique Pell? <dominique.pelle@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 09 Sep 2023 11:45:04 +0200 |
parents | dbec60b8c253 |
children |
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() |
31849
dbec60b8c253
patch 9.0.1257: code style is not check in test scripts
Bram Moolenaar <Bram@vim.org>
parents:
30405
diff
changeset
|
10 return 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
|
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() |
31849
dbec60b8c253
patch 9.0.1257: code style is not check in test scripts
Bram Moolenaar <Bram@vim.org>
parents:
30405
diff
changeset
|
14 return str2nr(expand('<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
|
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() |
31849
dbec60b8c253
patch 9.0.1257: code style is not check in test scripts
Bram Moolenaar <Bram@vim.org>
parents:
30405
diff
changeset
|
18 return 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
|
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 |
30405
ea38db8639eb
patch 9.0.0538: manually deleting test temp files
Bram Moolenaar <Bram@vim.org>
parents:
29754
diff
changeset
|
59 call writefile(lines, 'Xstack', 'D') |
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
|
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 |
32f358d71ec2
patch 9.0.0217: 'shellslash' works differently when sourcing a script again
Bram Moolenaar <Bram@vim.org>
parents:
28637
diff
changeset
|
63 |
32f358d71ec2
patch 9.0.0217: 'shellslash' works differently when sourcing a script again
Bram Moolenaar <Bram@vim.org>
parents:
28637
diff
changeset
|
64 if exists('+shellslash') |
30405
ea38db8639eb
patch 9.0.0538: manually deleting test temp files
Bram Moolenaar <Bram@vim.org>
parents:
29754
diff
changeset
|
65 call mkdir('Xshellslash', 'R') |
29754
32f358d71ec2
patch 9.0.0217: 'shellslash' works differently when sourcing a script again
Bram Moolenaar <Bram@vim.org>
parents:
28637
diff
changeset
|
66 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
|
67 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
|
68 set noshellslash |
32f358d71ec2
patch 9.0.0217: 'shellslash' works differently when sourcing a script again
Bram Moolenaar <Bram@vim.org>
parents:
28637
diff
changeset
|
69 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
|
70 set shellslash |
32f358d71ec2
patch 9.0.0217: 'shellslash' works differently when sourcing a script again
Bram Moolenaar <Bram@vim.org>
parents:
28637
diff
changeset
|
71 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
|
72 END |
32f358d71ec2
patch 9.0.0217: 'shellslash' works differently when sourcing a script again
Bram Moolenaar <Bram@vim.org>
parents:
28637
diff
changeset
|
73 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
|
74 " 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
|
75 " 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
|
76 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
|
77 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
|
78 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
|
79 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
|
80 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
|
81 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
|
82 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
|
83 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
|
84 endfor |
32f358d71ec2
patch 9.0.0217: 'shellslash' works differently when sourcing a script again
Bram Moolenaar <Bram@vim.org>
parents:
28637
diff
changeset
|
85 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
|
86 endfunc |
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
87 |
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
88 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
|
89 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
|
90 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
|
91 |
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
92 " 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
|
93 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
|
94 \ 5, |
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
95 \ 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
|
96 |
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
97 " 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
|
98 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
|
99 |
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 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
|
101 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
|
102 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
|
103 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
|
104 endfunc |
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
105 |
16668
81be817c9d9a
patch 8.1.1336: some eval functionality is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
14700
diff
changeset
|
106 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
|
107 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
|
108 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
|
109 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
|
110 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
|
111 " 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
|
112 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
|
113 set verbose=1 |
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=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
|
116 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
|
117 quit |
81be817c9d9a
patch 8.1.1336: some eval functionality is not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
14700
diff
changeset
|
118 endfunc |
19603
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
17849
diff
changeset
|
119 |
21594
5daca8504c63
patch 8.2.1347: cannot easily get the script ID
Bram Moolenaar <Bram@vim.org>
parents:
21493
diff
changeset
|
120 func s:sid_test() |
5daca8504c63
patch 8.2.1347: cannot easily get the script ID
Bram Moolenaar <Bram@vim.org>
parents:
21493
diff
changeset
|
121 return 'works' |
5daca8504c63
patch 8.2.1347: cannot easily get the script ID
Bram Moolenaar <Bram@vim.org>
parents:
21493
diff
changeset
|
122 endfunc |
5daca8504c63
patch 8.2.1347: cannot easily get the script ID
Bram Moolenaar <Bram@vim.org>
parents:
21493
diff
changeset
|
123 |
5daca8504c63
patch 8.2.1347: cannot easily get the script ID
Bram Moolenaar <Bram@vim.org>
parents:
21493
diff
changeset
|
124 func Test_expand_SID() |
5daca8504c63
patch 8.2.1347: cannot easily get the script ID
Bram Moolenaar <Bram@vim.org>
parents:
21493
diff
changeset
|
125 let sid = expand('<SID>') |
5daca8504c63
patch 8.2.1347: cannot easily get the script ID
Bram Moolenaar <Bram@vim.org>
parents:
21493
diff
changeset
|
126 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
|
127 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
|
128 endfunc |
5daca8504c63
patch 8.2.1347: cannot easily get the script ID
Bram Moolenaar <Bram@vim.org>
parents:
21493
diff
changeset
|
129 |
5daca8504c63
patch 8.2.1347: cannot easily get the script ID
Bram Moolenaar <Bram@vim.org>
parents:
21493
diff
changeset
|
130 |
19603
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
17849
diff
changeset
|
131 " Test for 'wildignore' with expand() |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
17849
diff
changeset
|
132 func Test_expand_wildignore() |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
17849
diff
changeset
|
133 set wildignore=*.vim |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
17849
diff
changeset
|
134 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
|
135 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
|
136 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
|
137 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
|
138 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
|
139 \ 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
|
140 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
|
141 set wildignore& |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
17849
diff
changeset
|
142 endfunc |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
17849
diff
changeset
|
143 |
6d3c683466f4
patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents:
17849
diff
changeset
|
144 " vim: shiftwidth=2 sts=2 expandtab |