File tree Expand file tree Collapse file tree 5 files changed +59
-2
lines changed Expand file tree Collapse file tree 5 files changed +59
-2
lines changed Original file line number Diff line number Diff line change @@ -30,3 +30,22 @@ Feature: Correct window setup
30
30
When I step over
31
31
Then the first item on the stack should show the file example.php
32
32
And the first item on the stack should show line 3
33
+
34
+ Scenario : Reading the stack window with multiple files
35
+ Given I have a file example.php containing
36
+ """
37
+ <?php
38
+ include "example2.php";
39
+ ?>
40
+ """
41
+ And I have a file example2.php containing
42
+ """
43
+ <?php
44
+ $var1 = 1;
45
+ $var2 = array("hello", "world");
46
+ ?>
47
+ """
48
+ And I start the debugger with the PHP script example.php
49
+ When I step in
50
+ Then item 1 on the stack should show the file example2.php
51
+ And item 1 on the stack should show line 2
Original file line number Diff line number Diff line change 2
2
vdebug . step_over
3
3
vdebug . running? . should be ( true ) , 'Vdebug is not running'
4
4
end
5
+
6
+ When "I step in" do
7
+ vdebug . step_in
8
+ vdebug . running? . should be ( true ) , 'Vdebug is not running'
9
+ end
Original file line number Diff line number Diff line change 5
5
Then "the first item on the stack should show line $line" do |line |
6
6
vdebug . stack . first [ :line ] . should == line
7
7
end
8
+
9
+ Then "item $item on the stack should show the file $file" do |idx , file |
10
+ idx = idx . to_i
11
+ stack_length = vdebug . stack . length
12
+ stack_length . should be >= idx , "There are only #{ stack_length } items on the stack"
13
+ vdebug . stack [ idx -1 ] [ :file ] . should include file
14
+ end
15
+
16
+ Then "item $item on the stack should show line $line" do |idx , line |
17
+ idx = idx . to_i
18
+ stack_length = vdebug . stack . length
19
+ stack_length . should be >= idx , "There are only #{ stack_length } items on the stack"
20
+ vdebug . stack [ idx -1 ] [ :line ] . should == line
21
+ end
Original file line number Diff line number Diff line change @@ -19,13 +19,19 @@ def kill_vim
19
19
end
20
20
21
21
module ScriptRunner
22
+ STDERR_FILE = "error.out"
23
+
22
24
def run_php_script ( path )
23
25
fork_and_run "php -c #{ PHP_INI } " , Shellwords . escape ( path )
24
26
end
25
27
28
+ def stderr_contents
29
+ File . read ( STDERR_FILE )
30
+ end
31
+
26
32
def fork_and_run ( bin , argstr )
27
33
fork do
28
- exec %Q{XDEBUG_CONFIG="idekey=something" /usr/bin/env #{ bin } #{ argstr } }
34
+ exec %Q{XDEBUG_CONFIG="idekey=something" /usr/bin/env #{ bin } #{ argstr } 2> #{ STDERR_FILE } }
29
35
exit!
30
36
end
31
37
sleep 0.5
Original file line number Diff line number Diff line change @@ -13,10 +13,23 @@ def start_listening
13
13
sleep 1
14
14
end
15
15
16
+ def messages
17
+ vim . command ( "messages" )
18
+ end
19
+
20
+ def step_to_line ( number )
21
+ vim . command "#{ number } "
22
+ vim . command "python debugger.run_to_cursor()"
23
+ end
24
+
16
25
def step_over
17
26
vim . command 'python debugger.step_over()'
18
27
end
19
28
29
+ def step_in
30
+ vim . command 'python debugger.step_into()'
31
+ end
32
+
20
33
# Retrieve a hash with the buffer names (values) and numbers (keys)
21
34
def buffers
22
35
@buffers ||= fetch_buffers
@@ -64,7 +77,7 @@ def stack_window_content
64
77
def stack
65
78
stack_window_content . split ( "\n " ) . map { |l |
66
79
s = { }
67
- matches = /^\[ (\d +)\] {([^}]+)} @ ([^:]+):(\d +)/ . match ( l )
80
+ matches = /^\[ (\d +)\] ( \S +) @ ([^:]+):(\d +)/ . match ( l )
68
81
if matches
69
82
s [ :level ] = matches [ 1 ]
70
83
s [ :name ] = matches [ 2 ]
You can’t perform that action at this time.
0 commit comments