diff src/testdir/test_options.vim @ 10420:7a631c6b0a20 v8.0.0104

commit https://github.com/vim/vim/commit/f422bcc7f9615fe91fa69b059cfe4785093d3d4a Author: Bram Moolenaar <Bram@vim.org> Date: Sat Nov 26 17:45:53 2016 +0100 patch 8.0.0104 Problem: Value of 'thesaurus' option not checked properly. Solution: Add P_NDNAME flag. (Daisuke Suzuki)
author Christian Brabandt <cb@256bit.org>
date Sat, 26 Nov 2016 18:00:04 +0100
parents ef5474130b0e
children a7da553980ee
line wrap: on
line diff
--- a/src/testdir/test_options.vim
+++ b/src/testdir/test_options.vim
@@ -107,17 +107,25 @@ func Test_keymap_valid()
   call assert_fails(":set kmp=trunc\x00name", "trunc")
 endfunc
 
-func Test_dictionary()
+func Check_dir_option(name)
   " Check that it's possible to set the option.
-  set dictionary=/usr/share/dict/words
-  call assert_equal('/usr/share/dict/words', &dictionary)
-  set dictionary=/usr/share/dict/words,/and/there
-  call assert_equal('/usr/share/dict/words,/and/there', &dictionary)
-  set dictionary=/usr/share/dict\ words
-  call assert_equal('/usr/share/dict words', &dictionary)
+  exe 'set ' . a:name . '=/usr/share/dict/words'
+  call assert_equal('/usr/share/dict/words', eval('&' . a:name))
+  exe 'set ' . a:name . '=/usr/share/dict/words,/and/there'
+  call assert_equal('/usr/share/dict/words,/and/there', eval('&' . a:name))
+  exe 'set ' . a:name . '=/usr/share/dict\ words'
+  call assert_equal('/usr/share/dict words', eval('&' . a:name))
 
   " Check rejecting weird characters.
-  call assert_fails("set dictionary=/not&there", "E474:")
-  call assert_fails("set dictionary=/not>there", "E474:")
-  call assert_fails("set dictionary=/not.*there", "E474:")
+  call assert_fails("set " . a:name . "=/not&there", "E474:")
+  call assert_fails("set " . a:name . "=/not>there", "E474:")
+  call assert_fails("set " . a:name . "=/not.*there", "E474:")
 endfunc
+
+func Test_dictionary()
+  call Check_dir_option('dictionary')
+endfunc
+
+func Test_thesaurus()
+  call Check_dir_option('thesaurus')
+endfunc