From 1a73e939319b2094fe55813c924c1d5c710174a3 Mon Sep 17 00:00:00 2001 From: Dieter Komendera Date: Mon, 28 Oct 2024 22:26:47 +0100 Subject: [PATCH] Add tests for indentation of forms with metadata --- test/clojure-ts-mode-indentation-test.el | 30 +++++++++++++++++++++++- test/samples/indentation.clj | 2 +- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/test/clojure-ts-mode-indentation-test.el b/test/clojure-ts-mode-indentation-test.el index e23bd17..be77588 100644 --- a/test/clojure-ts-mode-indentation-test.el +++ b/test/clojure-ts-mode-indentation-test.el @@ -107,4 +107,32 @@ DESCRIPTION is a string with the description of the spec." " {\"1\" 2 *3 4}") -) + + (when-indenting-it "should have no indentation at top level lists with metadata" + " +^{:foo true} +(def b 2)") + + (when-indenting-it "should have no indentation at top level vectors with metadata" + " +^{:foo true} +[1 2]") + + (when-indenting-it "should have no indentation at top level maps with metadata" + " +^{:foo true} +{:a 1}") + + (when-indenting-it "should have no indentation with metadata inside comment" + " +(comment + ^{:a 1} + (def a 2))") + + (when-indenting-it "should have params, docstring and body correctly indented in presence of metadata" + " +^{:foo true} +(defn c + \"hello\" + [_foo] + (+ 1 1))")) diff --git a/test/samples/indentation.clj b/test/samples/indentation.clj index e655384..2996229 100644 --- a/test/samples/indentation.clj +++ b/test/samples/indentation.clj @@ -142,4 +142,4 @@ (defn c "hello" [_foo] - (+ 1 1)) + (+ 1 1))