utils.vim 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. " vim: fdm=indent
  2. source t/config/options.vim
  3. describe 'utils'
  4. describe 'line'
  5. it 'should return the current line number'
  6. Expect tablemode#utils#line('.') == line('.')
  7. end
  8. it 'should return the line number itself if it is a number'
  9. Expect tablemode#utils#line(1) == 1
  10. end
  11. end
  12. describe 'strip'
  13. it 'should strip all initial or trailing whitespace from a string'
  14. let string = ' This is awesome '
  15. Expect tablemode#utils#strip(string) == 'This is awesome'
  16. end
  17. end
  18. describe 'strlen'
  19. it 'should return the length of a string correctly'
  20. let string = 'this is a test'
  21. Expect tablemode#utils#strlen(string) == 14
  22. end
  23. it 'should return the length of a unicode string correctly'
  24. let string = '測試 is good.'
  25. Expect tablemode#utils#strlen(string) == 11
  26. end
  27. end
  28. describe 'strdisplaywidth'
  29. it 'should return the display width of a string correctly'
  30. let string = 'this is a test'
  31. Expect tablemode#utils#StrDisplayWidth(string) == 14
  32. end
  33. it 'should return the display width of a unicode string correctly'
  34. let string = '測試 is good.'
  35. Expect tablemode#utils#StrDisplayWidth(string) == 13
  36. end
  37. end
  38. end