test_set.vim 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. " Tests for the :set command
  2. function Test_set_backslash()
  3. let isk_save = &isk
  4. set isk=a,b,c
  5. set isk+=d
  6. call assert_equal('a,b,c,d', &isk)
  7. set isk+=\\,e
  8. call assert_equal('a,b,c,d,\,e', &isk)
  9. set isk-=e
  10. call assert_equal('a,b,c,d,\', &isk)
  11. set isk-=\\
  12. call assert_equal('a,b,c,d', &isk)
  13. let &isk = isk_save
  14. endfunction
  15. function Test_set_add()
  16. let wig_save = &wig
  17. set wildignore=*.png,
  18. set wildignore+=*.jpg
  19. call assert_equal('*.png,*.jpg', &wig)
  20. let &wig = wig_save
  21. endfunction
  22. " :set, :setlocal, :setglobal without arguments show values of options.
  23. func Test_set_no_arg()
  24. set textwidth=79
  25. let a = execute('set')
  26. call assert_match("^\n--- Options ---\n.*textwidth=79\\>", a)
  27. set textwidth&
  28. setlocal textwidth=78
  29. let a = execute('setlocal')
  30. call assert_match("^\n--- Local option values ---\n.*textwidth=78\\>", a)
  31. setlocal textwidth&
  32. setglobal textwidth=77
  33. let a = execute('setglobal')
  34. call assert_match("^\n--- Global option values ---\n.*textwidth=77\\>", a)
  35. setglobal textwidth&
  36. endfunc
  37. " vim: shiftwidth=2 sts=2 expandtab