test_paste.vim 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. " Test for restoring option values when 'paste' is disabled
  2. func Test_paste_opt_restore()
  3. set autoindent expandtab ruler showmatch
  4. if has('rightleft')
  5. " set hkmap
  6. set revins
  7. endif
  8. set smarttab softtabstop=3 textwidth=27 wrapmargin=12
  9. if has('vartabs')
  10. set varsofttabstop=10,20
  11. endif
  12. " enabling 'paste' should reset the above options
  13. set paste
  14. call assert_false(&autoindent)
  15. call assert_false(&expandtab)
  16. if has('rightleft')
  17. call assert_false(&revins)
  18. " call assert_false(&hkmap)
  19. endif
  20. call assert_false(&ruler)
  21. call assert_false(&showmatch)
  22. call assert_false(&smarttab)
  23. call assert_equal(0, &softtabstop)
  24. call assert_equal(0, &textwidth)
  25. call assert_equal(0, &wrapmargin)
  26. if has('vartabs')
  27. call assert_equal('', &varsofttabstop)
  28. endif
  29. " disabling 'paste' should restore the option values
  30. set nopaste
  31. call assert_true(&autoindent)
  32. call assert_true(&expandtab)
  33. if has('rightleft')
  34. call assert_true(&revins)
  35. " call assert_true(&hkmap)
  36. endif
  37. call assert_true(&ruler)
  38. call assert_true(&showmatch)
  39. call assert_true(&smarttab)
  40. call assert_equal(3, &softtabstop)
  41. call assert_equal(27, &textwidth)
  42. call assert_equal(12, &wrapmargin)
  43. if has('vartabs')
  44. call assert_equal('10,20', &varsofttabstop)
  45. endif
  46. set autoindent& expandtab& ruler& showmatch&
  47. if has('rightleft')
  48. set revins& hkmap&
  49. endif
  50. set smarttab& softtabstop& textwidth& wrapmargin&
  51. if has('vartabs')
  52. set varsofttabstop&
  53. endif
  54. endfunc
  55. " vim: shiftwidth=2 sts=2 expandtab