Skip to content

Commit f302876

Browse files
committed
Add more cucumber features, e.g for eval
1 parent 85b6a15 commit f302876

File tree

7 files changed

+31
-7
lines changed

7 files changed

+31
-7
lines changed

features/correct_window_setup.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ Feature: Correct window setup
2424
"""
2525
And I start the debugger with the PHP script example.php
2626
When I step over
27-
Then the watch window should show the variable $var1
28-
And the watch window should show the variable $var2
27+
Then the watch window should show $var1
28+
And the watch window should show $var2
2929
And the watch window variable $var1 should be (int) 1
3030
And the watch window variable $var2 should be (uninitialized)
3131

features/eval.feature

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Feature: Evaluating expressions
2+
In order to evaluate variables in Vdebug
3+
As a user
4+
I want to see the evaluated variable in the watch window
5+
6+
Scenario: Evaluating a PHP expression
7+
Given I have a file example.php containing
8+
"""
9+
<?php
10+
$var1 = 1;
11+
?>
12+
"""
13+
And I start the debugger with the PHP script example.php
14+
When I evaluate $var1
15+
Then the watch window should show Eval of: '$var1'
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
When "I evaluate $expression" do |expr|
2+
vdebug.evaluate expr
3+
vdebug.running?.should be(true), 'Vdebug is not running'
4+
end

features/step_definitions/watch_window_steps.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Then "the watch window should show the variable $var" do |var|
2-
vdebug.watch_window_content.should include var
1+
Then "the watch window should show $text" do |text|
2+
vdebug.watch_window_content.should include text
33
end
44

55
Then "the watch window variable $var should be $value" do |var, value|

features/unicode_in_source_buffer.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ Feature: Unicode in source buffer
1212
"""
1313
And I start the debugger with the PHP script test.php
1414
When I step over
15-
Then the watch window should show the variable $arr
15+
Then the watch window should show $arr

features/valid_file_names.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Feature: Valid file names
1212
"""
1313
And I start the debugger with the PHP script My File.php
1414
When I step over
15-
Then the watch window should show the variable $var
15+
Then the watch window should show $var
1616

1717
Scenario: Debug a PHP file with a space in the directory
1818
Given I have a file A Path/myfile.php containing
@@ -23,4 +23,4 @@ Feature: Valid file names
2323
"""
2424
And I start the debugger with the PHP script A Path/myfile.php
2525
When I step over
26-
Then the watch window should show the variable $var
26+
Then the watch window should show $var

rubylib/vdebug.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ def step_in
3030
vim.command 'python debugger.step_into()'
3131
end
3232

33+
def evaluate(expression)
34+
safe_expression = expression.gsub(/['"\\\x0]/,'\\\\\0')
35+
vim.command %Q{python debugger.handle_eval("#{safe_expression}")}
36+
end
37+
3338
# Retrieve a hash with the buffer names (values) and numbers (keys)
3439
def buffers
3540
@buffers ||= fetch_buffers

0 commit comments

Comments
 (0)