aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ex_cmds/debug_spec.lua
blob: a4d381d3f1dc104ff627140f9ea590022491175b (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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local feed = helpers.feed
local clear = helpers.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},
    })
    screen:attach()
  end)
  it('scrolls messages correctly', function()
    feed(':echoerr bork<cr>')
    screen:expect([[
                                    |
      {1:~                             }|
      {1:~                             }|
      {1:~                             }|
      {1:~                             }|
      {1:~                             }|
      {1:~                             }|
      {1:~                             }|
      {1:~                             }|
      {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:~                             }|
      {1:~                             }|
      {1:~                             }|
      {1:~                             }|
      {1:~                             }|
      {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:~                             }|
      {1:~                             }|
      {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:~                             }|
      {1:~                             }|
      {1:~                             }|
      {1:~                             }|
      {1:~                             }|
      {1:~                             }|
      {1:~                             }|
      {1:~                             }|
      {1:~                             }|
      {1:~                             }|
      {1:~                             }|
      {1:~                             }|
                                    |
    ]])
  end)
end)