File tree Expand file tree Collapse file tree 4 files changed +70
-0
lines changed Expand file tree Collapse file tree 4 files changed +70
-0
lines changed Original file line number Diff line number Diff line change
1
+ Feature : Correct window setup
2
+ In order to use Vdebug with all window panels
3
+ As a user
4
+ I want to see correct watch, stack and status information
5
+
6
+ Scenario : The watch window
7
+ Given I have a file example.php containing
8
+ """
9
+ <?php
10
+ $var1 = 1;
11
+ $var2 = array("hello", "world");
12
+ ?>
13
+ """
14
+ And I start the debugger with the PHP script example.php
15
+ When I step over
16
+ Then the watch window should show the variable $var1
17
+ And the watch window should show the variable $var2
18
+ And the watch window variable $var1 should be (int) 1
19
+ And the watch window variable $var2 should be (uninitialized)
20
+
21
+ Scenario : The stack window
22
+ Given I have a file example.php containing
23
+ """
24
+ <?php
25
+ $var1 = 1;
26
+ $var2 = array("hello", "world");
27
+ ?>
28
+ """
29
+ And I start the debugger with the PHP script example.php
30
+ When I step over
31
+ Then the first item on the stack should show the file example.php
32
+ And the first item on the stack should show line 3
Original file line number Diff line number Diff line change
1
+ Then "the first item on the stack should show the file $file" do |file |
2
+ vdebug . stack . first [ :file ] . should include file
3
+ end
4
+
5
+ Then "the first item on the stack should show line $line" do |line |
6
+ vdebug . stack . first [ :line ] . should == line
7
+ end
Original file line number Diff line number Diff line change 1
1
Then "the watch window should show the variable $var" do |var |
2
2
vdebug . watch_window_content . should include var
3
3
end
4
+
5
+ Then "the watch window variable $var should be $value" do |var , value |
6
+ vdebug . watch_vars [ var ] . should == value
7
+ end
Original file line number Diff line number Diff line change @@ -50,6 +50,33 @@ def watch_window_content
50
50
fetch_buffer_content 'DebuggerWatch'
51
51
end
52
52
53
+ def watch_vars
54
+ watch_lines = watch_window_content . split ( "\n " ) [ 4 ..-1 ]
55
+ Hash [ watch_lines . join ( "" ) . split ( '|' ) . map { |v |
56
+ v [ 3 ..-1 ] . split ( "=" , 2 ) . map ( &:strip )
57
+ } ]
58
+ end
59
+
60
+ def stack_window_content
61
+ fetch_buffer_content 'DebuggerStack'
62
+ end
63
+
64
+ def stack
65
+ stack_window_content . split ( "\n " ) . map { |l |
66
+ s = { }
67
+ matches = /^\[ (\d +)\] {([^}]+)} @ ([^:]+):(\d +)/ . match ( l )
68
+ if matches
69
+ s [ :level ] = matches [ 1 ]
70
+ s [ :name ] = matches [ 2 ]
71
+ s [ :file ] = matches [ 3 ]
72
+ s [ :line ] = matches [ 4 ]
73
+ s
74
+ else
75
+ raise "Invalid stack line: #{ l } "
76
+ end
77
+ }
78
+ end
79
+
53
80
def status_window_content
54
81
fetch_buffer_content 'DebuggerStatus'
55
82
end
You can’t perform that action at this time.
0 commit comments