[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/clojure-mode 7e4aa06aa7 2/3: Add and modify tests for chec
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/clojure-mode 7e4aa06aa7 2/3: Add and modify tests for checking multiple forms on same line |
Date: |
Wed, 6 Sep 2023 15:59:23 -0400 (EDT) |
branch: elpa/clojure-mode
commit 7e4aa06aa74512d21e01c1540c83964b0aa6b9e7
Author: p4v4n <pavan.mantha99@gmail.com>
Commit: Bozhidar Batsov <bozhidar@batsov.dev>
Add and modify tests for checking multiple forms on same line
---
test/clojure-mode-refactor-threading-test.el | 13 +++++++++++--
test/clojure-mode-sexp-test.el | 21 ++++++++++++++-------
2 files changed, 25 insertions(+), 9 deletions(-)
diff --git a/test/clojure-mode-refactor-threading-test.el
b/test/clojure-mode-refactor-threading-test.el
index 61ad59833a..efd7eb1a47 100644
--- a/test/clojure-mode-refactor-threading-test.el
+++ b/test/clojure-mode-refactor-threading-test.el
@@ -247,6 +247,16 @@
(clojure-unwind '(4)))
+ (when-refactoring-it "should unwind correctly when multiple ->> are present
on same line"
+ "(->> 1 inc) (->> [1 2 3 4 5]
+ (filter even?)
+ (map square))"
+
+ "(->> 1 inc) (->> (map square (filter even? [1 2 3 4 5])))"
+
+ (clojure-unwind)
+ (clojure-unwind))
+
(when-refactoring-it "should unwind with function name"
"(->> [1 2 3 4 5]
sum
@@ -299,8 +309,7 @@
(when-refactoring-it "should unwind some->>"
"(some->> :b
- (find {:a 1})
- val
+ (find {:a 1}) val
(+ 5))"
"(some->> (+ 5 (val (find {:a 1} :b))))"
diff --git a/test/clojure-mode-sexp-test.el b/test/clojure-mode-sexp-test.el
index 1db0e708c3..aaeb798d43 100644
--- a/test/clojure-mode-sexp-test.el
+++ b/test/clojure-mode-sexp-test.el
@@ -31,30 +31,37 @@
(wrong))"
;; make this use the native beginning of defun since this is used to
;; determine whether to use the comment aware version or not.
+ (expect (let ((beginning-of-defun-function nil))
+ (clojure-top-level-form-p "comment")))))
+ (it "should return true when multiple forms are present"
+ (with-clojure-buffer-point
+ "(+ 1 2) (comment
+ (wrong)
+ (rig|ht)
+ (wrong))"
(expect (let ((beginning-of-defun-function nil))
(clojure-top-level-form-p "comment"))))))
(describe "clojure-beginning-of-defun-function"
(it "should go to top level form"
(with-clojure-buffer-point
- "(comment
+ " (comment
(wrong)
(wrong)
(rig|ht)
(wrong))"
- (beginning-of-defun)
+ (clojure-beginning-of-defun-function)
(expect (looking-at-p "(comment"))))
(it "should eval top level forms inside comment forms when
clojure-toplevel-inside-comment-form set to true"
(with-clojure-buffer-point
- "(comment
- (wrong)
+ "(+ inc 1) (comment
(wrong)
- (rig|ht)
+ (wrong) (rig|ht)
(wrong))"
(let ((clojure-toplevel-inside-comment-form t))
- (beginning-of-defun))
- (expect (looking-at-p "[[:space:]]*(right)"))))
+ (clojure-beginning-of-defun-function))
+ (expect (looking-at-p "(right)"))))
(it "should go to beginning of previous top level form"
(with-clojure-buffer-point