Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding tests for expansions in fgallina's python.el.

 - Tests for marking the inner and outer part of a Python string.

 - Tests for marking inside & outside a multi-line Python string.

 - Tests for marking Python blocks.
  • Loading branch information...
commit 52ec97a90010aed452e30053d02a320e7c3e305c 1 parent bbf9740
Felix Geller fgeller authored
Showing with 146 additions and 0 deletions.
  1. +146 −0 features/fgallina-python-el-expansions.feature
146 features/fgallina-python-el-expansions.feature
View
@@ -0,0 +1,146 @@
+Feature: fgallinas python.el expansions
+ In order to quickly and precisely mark Python code blocks
+ As an Emacs user
+ I want to expand to them
+
+ Scenario: Baseline feature test.
+ Given I turn on python-mode
+ And there is no region selected
+ When I insert "run(23)"
+ And I place the cursor between "n" and "("
+ And I expand the region 2 times
+ Then the region should be "run(23)"
+
+ Scenario: Mark region inside a string.
+ Given I turn on python-mode
+ And there is no region selected
+ When I insert "'X-Men: Wolverine'"
+ And I place the cursor between "r" and "i"
+ And I expand the region 2 times
+ Then the region should be "X-Men: Wolverine"
+
+ Scenario: Mark region outside a string.
+ Given I turn on python-mode
+ And there is no region selected
+ When I insert "run('X-Men: ' + 'Wolverine')"
+ And I place the cursor between "M" and "e"
+ And I expand the region 3 times
+ Then the region should be "'X-Men: '"
+
+ Scenario: Mark region inside a multi-line string.
+ Given I turn on python-mode
+ And there is no region selected
+ When I insert:
+ """
+ '''This is a multi-line Python string
+ with lots of useless content.
+ '''
+ """
+ And I place the cursor between "-" and "l"
+ And I expand the region 2 times
+ Then the region should be:
+ """
+ This is a multi-line Python string
+ with lots of useless content.
+
+ """
+
+ Scenario: Mark region outside a multi-line string.
+ Given I turn on python-mode
+ And there is no region selected
+ When I insert:
+ """
+ '''This is a multi-line Python string
+ with lots of useless content.
+ '''
+ """
+ And I place the cursor between "-" and "l"
+ And I expand the region 3 times
+ Then the region should be:
+ """
+ '''This is a multi-line Python string
+ with lots of useless content.
+ '''
+ """
+
+ Scenario: Mark a basic Python block
+ Given I turn on python-mode
+ And there is no region selected
+ When I insert:
+ """
+ if True:
+ print('To be, or not to be...')
+ else:
+ print('Booyah.')
+ """
+ And I go to point "1"
+ And I expand the region 3 times
+ Then the region should be:
+ """
+ if True:
+ print('To be, or not to be...')
+ """
+
+ Scenario: Mark a Python block with a nested block
+ Given I turn on python-mode
+ And there is no region selected
+ When I insert:
+ """
+ if True:
+ if True:
+ print(23)
+ print('To be, or not to be...')
+ else:
+ print('Booyah.')
+ """
+ And I go to point "1"
+ And I expand the region 3 times
+ Then the region should be:
+ """
+ if True:
+ if True:
+ print(23)
+ print('To be, or not to be...')
+ """
+
+ Scenario: Mark an outer Python block
+ Given I turn on python-mode
+ And there is no region selected
+ When I insert:
+ """
+ print('More stuff')
+
+ def the_truth():
+ if True:
+ print('To be, or not to be...')
+ else:
+ print('Booyah.')
+
+ print('Even more stuff.')
+ """
+ And I go to point "42"
+ And I expand the region 1 times
+ Then the region should be:
+ """
+ if
+ """
+ And I expand the region 1 times
+ Then the region should be:
+ """
+ if True:
+ """
+ And I expand the region 1 times
+ Then the region should be:
+ """
+ if True:
+ print('To be, or not to be...')
+ """
+ And I expand the region 1 times
+ Then the region should be:
+ """
+ def the_truth():
+ if True:
+ print('To be, or not to be...')
+ else:
+ print('Booyah.')
+ """
Please sign in to comment.
Something went wrong with that request. Please try again.