blob: 76bd787ad8081c7a502e54255e1cb28ff9f56d84 [file] [log] [blame]
Bram Moolenaar6d91bcb2020-08-12 18:50:36 +02001" Test for expanding dllpath options
2
Bram Moolenaara6e42502016-04-20 16:19:52 +02003func s:test_expand_dllpath(optname)
4 let $TEST_EXPAND_DLLPATH = '/dllpath/lib' . substitute(a:optname, '\zedll$', '.', '')
5 execute 'let dllpath_save = &' . a:optname
6 try
7 execute 'set ' . a:optname . '=$TEST_EXPAND_DLLPATH'
8 execute 'call assert_equal("' . $TEST_EXPAND_DLLPATH . '", &' . a:optname . ')'
9
10 execute 'set ' . a:optname . '=~' . $TEST_EXPAND_DLLPATH
Bram Moolenaar5449f7c2017-07-30 13:51:37 +020011 let home = substitute($HOME, '\\', '/', 'g')
12 execute 'call assert_equal("' . home . $TEST_EXPAND_DLLPATH . '", &' . a:optname . ')'
Bram Moolenaara6e42502016-04-20 16:19:52 +020013 finally
14 execute 'let &' . a:optname . ' = dllpath_save'
15 let $TEST_EXPAND_DLLPATH = ''
16 endtry
17endfunc
18
19func s:generate_test_if_exists(optname)
Bram Moolenaara713ff82017-02-25 22:18:43 +010020 if exists('+' . a:optname)
Bram Moolenaara6e42502016-04-20 16:19:52 +020021 execute join([
22 \ 'func Test_expand_' . a:optname . '()',
23 \ ' call s:test_expand_dllpath("' . a:optname . '")',
24 \ 'endfunc'
25 \ ], "\n")
26 endif
27endfunc
28
29call s:generate_test_if_exists('luadll')
30call s:generate_test_if_exists('perldll')
31call s:generate_test_if_exists('pythondll')
32call s:generate_test_if_exists('pythonthreedll')
33call s:generate_test_if_exists('rubydll')
34call s:generate_test_if_exists('tcldll')
Bram Moolenaar6d91bcb2020-08-12 18:50:36 +020035
36" vim: shiftwidth=2 sts=2 expandtab