spell_spec.lua 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. -- Test for scenarios involving 'spell'
  2. local helpers = require('test.functional.helpers')(after_each)
  3. local Screen = require('test.functional.ui.screen')
  4. local clear = helpers.clear
  5. local feed = helpers.feed
  6. local insert = helpers.insert
  7. local uname = helpers.uname
  8. local command = helpers.command
  9. describe("'spell'", function()
  10. local screen
  11. before_each(function()
  12. clear()
  13. screen = Screen.new(80, 8)
  14. screen:attach()
  15. screen:set_default_attr_ids( {
  16. [0] = {bold=true, foreground=Screen.colors.Blue},
  17. [1] = {special = Screen.colors.Red, undercurl = true},
  18. [2] = {special = Screen.colors.Blue1, undercurl = true},
  19. })
  20. end)
  21. it('joins long lines #7937', function()
  22. if uname() == 'openbsd' then pending('FIXME #12104', function() end) return end
  23. command('set spell')
  24. insert([[
  25. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
  26. tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
  27. quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
  28. consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
  29. cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat
  30. non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
  31. ]])
  32. feed('ggJJJJJJ0')
  33. screen:expect([[
  34. {1:^Lorem} {1:ipsum} dolor sit {1:amet}, {1:consectetur} {1:adipiscing} {1:elit}, {1:sed} do {1:eiusmod} {1:tempor} {1:i}|
  35. {1:ncididunt} {1:ut} {1:labore} et {1:dolore} {1:magna} {1:aliqua}. {1:Ut} {1:enim} ad minim {1:veniam}, {1:quis} {1:nostru}|
  36. {1:d} {1:exercitation} {1:ullamco} {1:laboris} {1:nisi} {1:ut} {1:aliquip} ex ea {1:commodo} {1:consequat}. {1:Duis} {1:aut}|
  37. {1:e} {1:irure} dolor in {1:reprehenderit} in {1:voluptate} {1:velit} {1:esse} {1:cillum} {1:dolore} {1:eu} {1:fugiat} {1:n}|
  38. {1:ulla} {1:pariatur}. {1:Excepteur} {1:sint} {1:occaecat} {1:cupidatat} non {1:proident}, {1:sunt} in culpa {1:qui}|
  39. {1:officia} {1:deserunt} {1:mollit} {1:anim} id est {1:laborum}. |
  40. {0:~ }|
  41. |
  42. ]])
  43. end)
  44. it('has correct highlight at start of line', function()
  45. insert([[
  46. "This is some text without any spell errors. Everything",
  47. "should just be black, nothing wrong here.",
  48. "",
  49. "This line has a sepll error. and missing caps.",
  50. "And and this is the the duplication.",
  51. "with missing caps here.",
  52. ]])
  53. command('set spell spelllang=en_nz')
  54. screen:expect([[
  55. "This is some text without any spell errors. Everything", |
  56. "should just be black, nothing wrong here.", |
  57. "", |
  58. "This line has a {1:sepll} error. {2:and} missing caps.", |
  59. "{1:And and} this is {1:the the} duplication.", |
  60. "with missing caps here.", |
  61. ^ |
  62. |
  63. ]])
  64. end)
  65. end)