Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
neojski committed Jun 24, 2017
1 parent 7e041c5 commit 942b1df
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 18 deletions.
3 changes: 2 additions & 1 deletion Cask
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
(development
(depends-on "ecukes")
(depends-on "espuds")
(depends-on "undercover"))
(depends-on "undercover")
(depends-on "merlin"))
49 changes: 35 additions & 14 deletions features/merlin-mode-expansions.feature
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,53 @@ Feature: merlin-mode expansions
As an Emacs user
I want to expand to them

Scenario: Mark name
Scenario: merlin mark name
Given I turn on merlin-mode
And there is no region selected
When I insert:
"""
let () =
List.iter (fun s ->
print_endline s)
["okta"; "guokte"]
List.iter (fun s -> print_endline s) ["foo"; "bar"]
"""
;; why does the below line not fail?
And x
And I place the cursor before "endline"
And I expand the region
Then the region should be "print_endline"
And I expand the region
Then the region should be "print_endline s"
And I expand the region
Then the region should be "s -> print_endline s"
And I expand the region
Then the region should be "(fun s -> print_endline s)"
And I expand the region
Then the region should be:
"""
List.iter (fun s -> print_endline s) ["foo"; "bar"]
"""
And I expand the region
Then the region should be:
"""
let () =
List.iter (fun s -> print_endline s) ["foo"; "bar"]
"""
And I place the cursor before "print_endline"
And I press "C-@"
Then the region should be "@print_endline"

Scenario: Mark fun
Scenario: merlin mark fun
Given I turn on merlin-mode
And there is no region selected
When I insert:
"""
let () =
List.iter (fun s ->
print_endline s)
["okta"; "guokte"]
List.iter (fun s -> print_endline s) ["foo"; "bar"]
"""
And I place the cursor before "fun "
And I press "C-@"
And I expand the region
Then the region should be:
"""
(fun s ->
print_endline s)
(fun s -> print_endline s)
"""
And I expand the region
Then the region should be:
"""
List.iter (fun s -> print_endline s) ["foo"; "bar"]
"""
13 changes: 10 additions & 3 deletions features/support/env.el
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,20 @@
(require 'expand-region)
(require 'espuds)
(require 'ert)
(require 'merlin)

;; GNU Emacs 25.1.1 automatically enters debug-on-error for some reason and
;; tests become extremely unreadable.
(setq debug-on-error nil)

(Before
(global-set-key (kbd "C-@") 'er/expand-region)
(global-set-key (kbd "C-S-@") 'er/contract-region)
(switch-to-buffer
(get-buffer-create "*expand-region*"))
(erase-buffer)

(switch-to-buffer (create-file-buffer "expand-region"))
;; merlin-mode-expansion gets upset if the buffer is not backed by file
(write-file (make-temp-file "expand-region" nil nil))

(fundamental-mode)
(transient-mark-mode 1)
(cua-mode 0)
Expand Down

0 comments on commit 942b1df

Please sign in to comment.