Skip to content

Commit

Permalink
refactor(test): generate an ert test per testcase to simplify review
Browse files Browse the repository at this point in the history
  • Loading branch information
Fuco1 committed Mar 20, 2024
1 parent 35cc100 commit d22df4b
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions test/smartparens-commands-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -705,19 +705,19 @@ be."

(defun sp-test--sp-backward-delete-char-textmode (initial expected &optional n)
(setq n (or n 1))
(sp-test-with-temp-buffer initial
(text-mode)
(sp-backward-delete-char n)
(sp-buffer-equals expected)))

(ert-deftest sp-test-command-sp-backward-delete-char-textmode ()
(let ((sp-pairs '((t . ((:open "\"" :close "\"" :actions (insert wrap autoskip navigate))
(:open "'" :close "'" :actions (insert wrap autoskip navigate)))))))
(sp-test--sp-backward-delete-char-textmode "foo \"it'| OK\" baz" "foo \"it| OK\" baz")
(sp-test--sp-backward-delete-char-textmode "foo \"|OK\" baz" "foo \"|OK\" baz")
(sp-test--sp-backward-delete-char-textmode "foo \"it's OK\"| baz" "foo \"it's OK|\" baz")
(sp-test--sp-backward-delete-char-textmode "\"this\" doesn'|" "\"this\" doesn|")
(sp-test--sp-backward-delete-char-textmode "\"don't\"|" "|" 7)))
(sp-test-with-temp-buffer initial
(text-mode)
(sp-backward-delete-char n)
(sp-buffer-equals expected))))

(sp-ert-deftest sp-test-command-sp-backward-delete-char-textmode
(sp-test--sp-backward-delete-char-textmode "foo \"it'| OK\" baz" "foo \"it| OK\" baz")
(sp-test--sp-backward-delete-char-textmode "foo \"|OK\" baz" "foo \"|OK\" baz")
(sp-test--sp-backward-delete-char-textmode "foo \"it's OK\"| baz" "foo \"it's OK|\" baz")
(sp-test--sp-backward-delete-char-textmode "\"this\" doesn'|" "\"this\" doesn|")
(sp-test--sp-backward-delete-char-textmode "\"don't\"|" "|" 7))

(ert-deftest sp-test-command-sp-backward-delete-pair-with-skip-match ()
(let ((sp-pairs '((t . ((:open "`" :close "'" :actions (insert wrap autoskip navigate)
Expand Down

0 comments on commit d22df4b

Please sign in to comment.