debug_spec.lua 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. local n = require('test.functional.testnvim')()
  2. local Screen = require('test.functional.ui.screen')
  3. local feed = n.feed
  4. local clear = n.clear
  5. describe(':debug', function()
  6. local screen
  7. before_each(function()
  8. clear()
  9. screen = Screen.new(30, 14)
  10. screen:set_default_attr_ids({
  11. [1] = { bold = true, foreground = Screen.colors.Blue1 },
  12. [2] = { bold = true, reverse = true },
  13. [3] = { foreground = Screen.colors.Grey100, background = Screen.colors.Red },
  14. [4] = { bold = true, foreground = Screen.colors.SeaGreen4 },
  15. })
  16. end)
  17. it('scrolls messages correctly', function()
  18. feed(':echoerr bork<cr>')
  19. screen:expect([[
  20. |
  21. {1:~ }|*8
  22. {2: }|
  23. {3:E121: Undefined variable: bork}|
  24. |
  25. {4:Press ENTER or type command to}|
  26. {4: continue}^ |
  27. ]])
  28. feed(':debug echo "aa"| echo "bb"<cr>')
  29. screen:expect([[
  30. |
  31. {1:~ }|*5
  32. {2: }|
  33. {3:E121: Undefined variable: bork}|
  34. |
  35. {4:Press ENTER or type command to}|
  36. Entering Debug mode. Type "co|
  37. nt" to continue. |
  38. cmd: echo "aa"| echo "bb" |
  39. >^ |
  40. ]])
  41. feed('step<cr>')
  42. screen:expect([[
  43. |
  44. {1:~ }|*2
  45. {2: }|
  46. {3:E121: Undefined variable: bork}|
  47. |
  48. {4:Press ENTER or type command to}|
  49. Entering Debug mode. Type "co|
  50. nt" to continue. |
  51. cmd: echo "aa"| echo "bb" |
  52. >step |
  53. aa |
  54. cmd: echo "bb" |
  55. >^ |
  56. ]])
  57. feed('step<cr>')
  58. screen:expect([[
  59. {2: }|
  60. {3:E121: Undefined variable: bork}|
  61. |
  62. {4:Press ENTER or type command to}|
  63. Entering Debug mode. Type "co|
  64. nt" to continue. |
  65. cmd: echo "aa"| echo "bb" |
  66. >step |
  67. aa |
  68. cmd: echo "bb" |
  69. >step |
  70. bb |
  71. {4:Press ENTER or type command to}|
  72. {4: continue}^ |
  73. ]])
  74. feed('<cr>')
  75. screen:expect([[
  76. ^ |
  77. {1:~ }|*12
  78. |
  79. ]])
  80. end)
  81. end)