Skip to content

Commit b21188c

Browse files
authored
Rewrite indentation testing code (#26)
Benefits of new solution: 1. Faster (runs indentation tests in parallel) - On GitHub Actions, the tests now finish >10 seconds quicker, but we will see a greater benefit when I add more indentation tests (hopefully soon). 2. Less code 3. Adding new indentation test cases doesn't require editing the indent_test.clj Clojure file anymore 4. Fixed issues with the test vimrc so tests now work on newer Vim versions (previously they only worked on Vim 8.1 and below) 5. Can now set different config options per-test 6. Indentation tests now all pass on my computer Now we're in a good position to start adding more indentation tests.
1 parent 61c73fc commit b21188c

File tree

22 files changed

+94
-129
lines changed

22 files changed

+94
-129
lines changed

.github/workflows/clojure.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
env:
3030
cache-name: cache-m2
3131
with:
32-
path: ~/.m2
32+
path: ~/.m2/repository
3333
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/project.clj') }}
3434
restore-keys: |
3535
${{ runner.os }}-build-${{ env.cache-name }}-

clj/.clj-kondo/config.edn

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
{:lint-as {vim.test/with-tempfile clojure.core/fn
2-
vim.test/defpredicates clojure.core/def
1+
{:lint-as {vim.test/defpredicates clojure.core/def
32
vim.test/defsyntaxtest clojure.core/def}}

clj/resources/indent-test-cases/test-basic-sexp-indent.txt renamed to clj/resources/indent-test-cases/basic-sexp/in.clj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,3 @@
33
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
44
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
55
consequat.")
6-
7-
;; vim:ft=clojure:
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
(ns test-basic-sexp-indent
2+
"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
3+
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
4+
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
5+
consequat.")

clj/resources/indent-test-cases/test-dispatch-macro-indent.in renamed to clj/resources/indent-test-cases/dispach-macro/in.clj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,3 @@ bar))
2727

2828
(#_(foo bar)
2929
a)
30-
31-
;; vim:ft=clojure:

clj/resources/indent-test-cases/test-dispatch-macro-indent.out renamed to clj/resources/indent-test-cases/dispach-macro/out.clj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,3 @@
2727

2828
(#_(foo bar)
2929
a)
30-
31-
;; vim:ft=clojure:
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{:indent? false
2+
:extra-cmds ["normal! gg"
3+
"exec \"normal! /α\\<CR>s\\<C-O>Oa\\<Esc>/β\\<CR>s\\<CR>\\<CR>\\<C-H>\\<C-H>\\<C-H>\\<C-H>\\<C-H>\\<C-H>\\<C-H>b\\<CR>c\\<CR>\\<CR>d\\<Esc>\""]}

clj/resources/indent-test-cases/test-special-case-indent.in renamed to clj/resources/indent-test-cases/letfn/in.clj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,3 @@
3535
(six-times [y]
3636
(* (twice y) 3))]
3737
(foo #{:foo :bar :biz} :foo))
38-
39-
;; vim:ft=clojure:

0 commit comments

Comments
 (0)