Skip to content

Commit

Permalink
Added Ecukes features.
Browse files Browse the repository at this point in the history
  • Loading branch information
rejeep committed Apr 1, 2010
1 parent fc28cf9 commit b3b41fc
Show file tree
Hide file tree
Showing 7 changed files with 251 additions and 0 deletions.
29 changes: 29 additions & 0 deletions features/drag-stuff.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Feature: Drag Stuff
In order to move stuff in Emacs
As an Emacs user
I want to drag them

Background:
Given I am in buffer "*drag-stuff*"
And the buffer is empty
And transient mark mode is active
And there is no region selected

Scenario: Global mode
When I open temp file "global"
And I insert:
"""
line 1
line 2
"""
And I load the following:
"""
(drag-stuff-global-mode t)
"""
When I go to line "1"
And I press "<M-down>"
Then I should see:
"""
line 2
line 1
"""
53 changes: 53 additions & 0 deletions features/line.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
Feature: Drag line
In order to move a line up and down
As an emacs user
I want to drag it

Background:
Given I am in buffer "*drag-stuff*"
And the buffer is empty
And I insert:
"""
line 1
line 2
"""
And there is no region selected
And I enable drag-stuff

Scenario: Drag line up
When I go to line "2"
And I press "<M-up>"
Then I should see:
"""
line 2
line 1
"""

Scenario: Drag line down
When I go to line "1"
And I press "<M-down>"
Then I should see:
"""
line 2
line 1
"""

Scenario: Drag line down out of scope
When I go to line "2"
And I press "<M-down>"
Then I should see:
"""
line 1
line 2
"""
And I should see message "Can not move line further down"

Scenario: Drag line up out of scope
When I go to line "1"
And I press "<M-up>"
Then I should see:
"""
line 1
line 2
"""
And I should see message "Can not move line further up"
86 changes: 86 additions & 0 deletions features/lines.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
Feature: Drag lines
In order to move lines up and down
As an emacs user
I want to drag them

Background:
And I am in buffer "*drag-stuff*"
And the buffer is empty
And I insert:
"""
line 1
line 2
line 3
"""
And there is no region selected
And I enable drag-stuff

Scenario: Drag lines up
When I go to point "10"
And I set the mark
And I go to point "17"
When I press "<M-up>"
Then I should see:
"""
line 2
line 3
line 1
"""
And the region should be:
"""
ne 2
li
"""

Scenario: Drag lines down
When I go to point "3"
And I set the mark
And I go to point "10"
When I press "<M-down>"
Then I should see:
"""
line 3
line 1
line 2
"""
And the region should be:
"""
ne 1
li
"""

Scenario: Drag lines up out of scope
When I go to point "3"
And I set the mark
And I go to point "10"
When I press "<M-up>"
Then I should see:
"""
line 1
line 2
line 3
"""
And I should see message "Can not move lines further up"
And the region should be:
"""
ne 1
li
"""

Scenario: Drag lines down out of scope
When I go to point "10"
And I set the mark
And I go to point "17"
When I press "<M-down>"
Then I should see:
"""
line 1
line 2
line 3
"""
And I should see message "Can not move lines further down"
And the region should be:
"""
ne 2
li
"""
37 changes: 37 additions & 0 deletions features/region.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
Feature: Drag region
In order to move a region left and right
As an emacs user
I want to drag it

Background:
And I am in buffer "*drag-stuff*"
And the buffer is empty
And I insert "beforeREGIONafter"
And there is no region selected
And I enable drag-stuff

Scenario: Drag region left
When I select "REGION"
And I press "<M-left>"
Then I should see "beforREGIONeafter"
And the region should be "REGION"

Scenario: Drag region right
When I select "REGION"
And I press "<M-right>"
Then I should see "beforeaREGIONfter"
And the region should be "REGION"

Scenario: Drag word left out of scope
When I select "before"
And I press "<M-left>"
Then I should see "beforeREGIONafter"
And I should see message "Can not move region further to the left"
And the region should be "before"

Scenario: Drag word right out of scope
When I select "after"
And I press "<M-right>"
Then I should see "beforeREGIONafter"
And I should see message "Can not move region further to the right"
And the region should be "after"
5 changes: 5 additions & 0 deletions features/step-definitions/drag-stuff-steps.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
(Given "^I \\(enable\\|disable\\) drag-stuff$"
(lambda (status)
(if (string= status "enable")
(turn-on-drag-stuff-mode)
(turn-off-drag-stuff-mode))))
8 changes: 8 additions & 0 deletions features/support.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
(add-to-list 'load-path "~/dev/drag-stuff")
(require 'drag-stuff)

(add-to-list 'load-path "~/dev/espuds")
(require 'espuds)

(Before
(setq transient-mark-mode t))
33 changes: 33 additions & 0 deletions features/word.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
Feature: Drag word
In order to move a word left and right
As an emacs user
I want to drag it

Background:
And I am in buffer "*drag-stuff*"
And the buffer is empty
And I insert "word1 word2 word3"
And there is no region selected
And I enable drag-stuff

Scenario: Drag word left
When I go to word "word3"
And I press "<M-left>"
Then I should see "word1 word3 word2"

Scenario: Drag word right
When I go to word "word1"
And I press "<M-right>"
Then I should see "word2 word1 word3"

Scenario: Drag word left out of scope
When I go to word "word1"
And I press "<M-left>"
Then I should see "word1 word2 word3"
And I should see message "Can not move word further to the left"

Scenario: Drag word right out of scope
When I go to word "word3"
And I press "<M-right>"
Then I should see "word1 word2 word3"
And I should see message "Can not move word further to the right"

0 comments on commit b3b41fc

Please sign in to comment.