Skip to content

Commit

Permalink
Chore: format test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
justinbarclay committed May 4, 2024
1 parent f2132a7 commit ef64716
Showing 1 changed file with 46 additions and 22 deletions.
68 changes: 46 additions & 22 deletions test/user-submitted-cases.el
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@

(ert-deftest setting-options-works ()
(let* ((settings (list :lisp-vline-symbols t
:lisp-block-comments t
:guile-block-comments nil
:scheme-sexp-comments t
:janet-long-strings nil
:comment-char "#"
:string-delimiters (list "\"")))
:lisp-block-comments t
:guile-block-comments nil
:scheme-sexp-comments t
:janet-long-strings nil
:comment-char "#"
:string-delimiters (list "\"")))
(keys (mapcar #'car (seq-partition settings 2)))
(options (parinfer-rust-make-option)))
(parinfer-rust--set-options
Expand All @@ -69,17 +69,17 @@
(ert-deftest user-fill-paragraph ()
(let ((test
'(:setup (clojure-mode)
:before
"(ns some-namespace.core
:before
"(ns some-namespace.core
(:import [java.util.concurrent Executors])
(:require [clojure.string :as string]))
(defn foo
\"pretty long docsting that will be affected by `fill-paragraph` function\"
[x]
x)"
:after
"(ns some-namespace.core
:after
"(ns some-namespace.core
(:import [java.util.concurrent Executors])
(:require [clojure.string :as string]))
Expand All @@ -88,7 +88,7 @@
function\"
[x]
x)"
:commands (((:lineNo 6 :column 4) fill-paragraph)))))
:commands (((:lineNo 6 :column 4) fill-paragraph)))))
(should
(string=
(simulate-parinfer-in-another-buffer--with-commands (plist-get test :before)
Expand All @@ -102,8 +102,7 @@
(ert-deftest use-paredit-barf-sexp ()
(let ((test
'(:setup
(clojure-mode paredit-mode
)
(clojure-mode paredit-mode)
:before
"(foo- _foo [foo foo]
(foo/foo foo {:foo foo-foo
Expand Down Expand Up @@ -166,21 +165,21 @@
(add-to-list 'parinfer-rust-treat-command-as '(indent-buffer . "paren")))
(let ((test
'(:setup (clojure-mode add-func-to-treat-command-as)
:before
" (defn vaiv []
:before
" (defn vaiv []
\"I am incorrect\"
(let
[a 1
b 2]
(+ a b)))"
:after
"(defn vaiv []
:after
"(defn vaiv []
\"I am incorrect\"
(let
[a 1
b 2]
(+ a b)))"
:commands (((:lineNo 0 :column 0) indent-buffer)))))
:commands (((:lineNo 0 :column 0) indent-buffer)))))
(should
(string=
(simulate-parinfer-in-another-buffer--with-commands (plist-get test :before)
Expand Down Expand Up @@ -228,10 +227,10 @@
(ert-deftest doesnt-handles-utf-8 ()
(let ((test
'(:before
"(func 中)"
:after
"(func 中 )"
:commands (((:lineNo 0 :column 8) (lambda () (insert " ")))))))
"(func 中)"
:after
"(func 中 )"
:commands (((:lineNo 1 :column 8) (lambda () (insert " ")))))))
(should-not
(string=
(simulate-parinfer-in-another-buffer--with-commands (plist-get test :before)
Expand All @@ -249,6 +248,31 @@
"(map! \"] E\")"))
(should (equal (simulate-parinfer-in-another-buffer before "paren" changes)
after))))

(ert-deftest handles-deleting-whitespace-before-sexp ()
(let ((test
'(:before
"(thing
(defmacro foo nil
:a b
:b c
\"A doc comment\"))"
:after "(thing)
(defmacro foo nil
:a b
:baz bar
:version \"29.1\"
\"A doc comment\")"
:commands (((:lineNo 2 :column 1) (lambda () (delete-backward-char 1)))
((:lineNo 1 :column 5) newline-and-indent)
((:lineNo 2 :column 1) (lambda () (delete-backward-char 1)))))))
(should-not
(string=
(simulate-parinfer-in-another-buffer--with-commands (plist-get test :before)
"smart"
(plist-get test :commands)
(plist-get test :setup))
(plist-get test :after)))))
;;; Local Variables:
;;; lisp-indent-function: common-lisp-indent-function
;;; End:

0 comments on commit ef64716

Please sign in to comment.