Skip to content

Commit 869790b

Browse files
kommenbbatsov
authored andcommitted
Add tests for indentation of forms with metadata
1 parent d824fcd commit 869790b

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

test/clojure-ts-mode-indentation-test.el

+29-1
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,32 @@ DESCRIPTION is a string with the description of the spec."
107107
"
108108
{\"1\" 2
109109
*3 4}")
110-
)
110+
111+
(when-indenting-it "should have no indentation at top level lists with metadata"
112+
"
113+
^{:foo true}
114+
(def b 2)")
115+
116+
(when-indenting-it "should have no indentation at top level vectors with metadata"
117+
"
118+
^{:foo true}
119+
[1 2]")
120+
121+
(when-indenting-it "should have no indentation at top level maps with metadata"
122+
"
123+
^{:foo true}
124+
{:a 1}")
125+
126+
(when-indenting-it "should have no indentation with metadata inside comment"
127+
"
128+
(comment
129+
^{:a 1}
130+
(def a 2))")
131+
132+
(when-indenting-it "should have params, docstring and body correctly indented in presence of metadata"
133+
"
134+
^{:foo true}
135+
(defn c
136+
\"hello\"
137+
[_foo]
138+
(+ 1 1))"))

test/samples/indentation.clj

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,4 +142,4 @@
142142
(defn c
143143
"hello"
144144
[_foo]
145-
(+ 1 1))
145+
(+ 1 1))

0 commit comments

Comments
 (0)