aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ex_cmds/debug_spec.lua
blob: d657f9aa6dc738be83729abdb45f8421aa50d519 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')

local feed = n.feed
local clear = n.clear

describe(':debug', function()
  local screen
  before_each(function()
    clear()
    screen = Screen.new(30, 14)
    screen:set_default_attr_ids({
      [1] = { bold = true, foreground = Screen.colors.Blue1 },
      [2] = { bold = true, reverse = true },
      [3] = { foreground = Screen.colors.Grey100, background = Screen.colors.Red },
      [4] = { bold = true, foreground = Screen.colors.SeaGreen4 },
    })
  end)
  it('scrolls messages correctly', function()
    feed(':echoerr bork<cr>')
    screen:expect([[
                                    |
      {1:~                             }|*8
      {2:                              }|
      {3:E121: Undefined variable: bork}|
                                    |
      {4:Press ENTER or type command to}|
      {4: continue}^                     |
    ]])

    feed(':debug echo "aa"| echo "bb"<cr>')
    screen:expect([[
                                    |
      {1:~                             }|*5
      {2:                              }|
      {3:E121: Undefined variable: bork}|
                                    |
      {4:Press ENTER or type command to}|
      Entering Debug mode.  Type "co|
      nt" to continue.              |
      cmd: echo "aa"| echo "bb"     |
      >^                             |
    ]])

    feed('step<cr>')
    screen:expect([[
                                    |
      {1:~                             }|*2
      {2:                              }|
      {3:E121: Undefined variable: bork}|
                                    |
      {4:Press ENTER or type command to}|
      Entering Debug mode.  Type "co|
      nt" to continue.              |
      cmd: echo "aa"| echo "bb"     |
      >step                         |
      aa                            |
      cmd: echo "bb"                |
      >^                             |
    ]])

    feed('step<cr>')
    screen:expect([[
      {2:                              }|
      {3:E121: Undefined variable: bork}|
                                    |
      {4:Press ENTER or type command to}|
      Entering Debug mode.  Type "co|
      nt" to continue.              |
      cmd: echo "aa"| echo "bb"     |
      >step                         |
      aa                            |
      cmd: echo "bb"                |
      >step                         |
      bb                            |
      {4:Press ENTER or type command to}|
      {4: continue}^                     |
    ]])

    feed('<cr>')
    screen:expect([[
      ^                              |
      {1:~                             }|*12
                                    |
    ]])
  end)
end)