summaryrefslogtreecommitdiff
path: root/test.el
diff options
context:
space:
mode:
authorTaylor R Campbell <campbell+paredit@mumble.net>2022-11-24 19:05:29 +0000
committerTaylor R Campbell <campbell+paredit@mumble.net>2022-11-24 19:05:46 +0000
commit5615023023aea50683f5725284fb9bc6cbbd64ec (patch)
tree704c9b2a0dddf1580210b0657398f89e8f903722 /test.el
parent153b5d80f75b1d66d1080bc590885a9c4f0782e1 (diff)
Work around Electric Indent Mode brokenness in newline keys.
Diffstat (limited to 'test.el')
-rw-r--r--test.el32
1 files changed, 25 insertions, 7 deletions
diff --git a/test.el b/test.el
index bd8ae37..8e6ebe9 100644
--- a/test.el
+++ b/test.el
@@ -220,13 +220,31 @@ Four arguments: the paredit command, the text of the buffer
(paredit-test 'paredit-wrap-sexp
'(("(foo |bar baz)" "(foo (|bar baz))"))))
-(paredit-test 'paredit-newline
- '(("\"foo|bar\"" "\"foo\n|bar\"")
- ("(frob grovel ;full |(lexical)\n mumble)"
- "(frob grovel ;full\n |(lexical)\n mumble)")
- ("(frob grovel ;full (|lexical)\n mumble)"
- "(frob grovel ;full (\n ;|lexical)\n mumble)")
- ("#\\|(" "#\\(\n|")))
+(let ((plain-newline-tests
+ '(("\"foo|bar\"" "\"foo\n|bar\"")
+ ("(frob grovel ;full |(lexical)\n mumble)"
+ "(frob grovel ;full \n|(lexical)\n mumble)")
+ ("(frob grovel ;full (|lexical)\n mumble)"
+ "(frob grovel ;full (\n|lexical)\n mumble)")
+ ("#\\|(" "#\\\n|(")))
+ (indented-newline-tests
+ '(("\"foo|bar\"" "\"foo\n|bar\"")
+ ("(frob grovel ;full |(lexical)\n mumble)"
+ "(frob grovel ;full\n |(lexical)\n mumble)")
+ ("(frob grovel ;full (|lexical)\n mumble)"
+ "(frob grovel ;full (\n ;|lexical)\n mumble)")
+ ("#\\|(" "#\\(\n|"))))
+ (if (boundp 'electric-indent-mode)
+ (progn
+ (let ((electric-indent-mode t))
+ (paredit-test 'paredit-RET indented-newline-tests)
+ (paredit-test 'paredit-C-j plain-newline-tests))
+ (let ((electric-indent-mode nil))
+ (paredit-test 'paredit-RET plain-newline-tests)
+ (paredit-test 'paredit-C-j indented-newline-tests)))
+ (paredit-test 'paredit-RET plain-newline-tests)
+ (paredit-test 'paredit-C-j indented-newline-tests))
+ (paredit-test 'paredit-newline indented-newline-tests))
(paredit-test 'paredit-reindent-defun
;++ Test filling paragraphs in comments and strings.