Skip to content

Commit

Permalink
test(command): add commands sp-clone-sexp
Browse files Browse the repository at this point in the history
Fixes #938.
  • Loading branch information
Fuco1 committed Mar 25, 2024
1 parent 37dfec5 commit 38afe79
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test/smartparens-commands-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -807,6 +807,31 @@ be."
(((mode 'js))
("{|'foo': 'bar'}" "{'|': 'bar'}"))))

(sp-test-command sp-clone-sexp
((nil
;; from #938 later in the thread
("|(foo (bar) baz)" "(foo (bar) baz)\n|(foo (bar) baz)")
("(foo |(bar) baz)" "(foo (bar)\n |(bar) baz)")
("(foo (bar) |baz)" "(foo (bar) baz)\n(foo (bar) |baz)")
("(foo (bar) baz)|" "(foo (bar) baz)|")

("(foo (bar)| 'baz 'qux)" "(foo (bar) 'baz 'qux)\n(foo (bar)| 'baz 'qux)")
("(foo (bar) 'baz '|qux)" "(foo (bar) 'baz 'qux)\n(foo (bar) 'baz '|qux)")

;; from #938 OP
("(defun my-smartparens-hook ()
(setq sp-base-key-bindings 'paredit)
(define-key smartparens-|mode-map (kbd \"C-, C-y\") #'sp-clone-sexp)
(define-key smartparens-mode-map (kbd \"C-k\") #'kill-sexp)
(define-key smartparens-mode-map (kbd \"C-M-t\") #'sp-transpose-sexp)
)" "(defun my-smartparens-hook ()
(setq sp-base-key-bindings 'paredit)
(define-key smartparens-mode-map (kbd \"C-, C-y\") #'sp-clone-sexp)
(define-key smartparens-|mode-map (kbd \"C-, C-y\") #'sp-clone-sexp)
(define-key smartparens-mode-map (kbd \"C-k\") #'kill-sexp)
(define-key smartparens-mode-map (kbd \"C-M-t\") #'sp-transpose-sexp)
)"))))

(defun sp--test-sp-rewrap-sexp (initial pair expected &optional keep)
(sp-test-with-temp-elisp-buffer initial
(sp-rewrap-sexp pair keep)
Expand Down

0 comments on commit 38afe79

Please sign in to comment.