-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
48 changed files
with
121 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Indent | ||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
vim-latest: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Fetch source | ||
uses: actions/checkout@v3 | ||
- name: Install Vim | ||
uses: rhysd/action-setup-vim@v1 | ||
with: { version: stable } | ||
- name: Run indentation tests | ||
run: EDITOR=vim do/test-indent | ||
working-directory: ./dev | ||
|
||
neovim-latest: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Fetch source | ||
uses: actions/checkout@v3 | ||
- name: Install Neovim | ||
uses: rhysd/action-setup-vim@v1 | ||
with: { neovim: true, version: stable } | ||
- name: Run indentation tests | ||
run: EDITOR=nvim do/test-indent | ||
working-directory: ./dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 0 additions & 4 deletions
4
clj/resources/indent-test-cases/multi-line_strings_pretty/config.edn
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
clj/resources/indent-test-cases/multi-line_strings_standard/config.edn
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
clj/resources/indent-test-cases/multi-line_strings_traditional/config.edn
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Run Clojure.vim indentation tests | ||
|
||
# TODO: colour messages? | ||
|
||
if [ "$EDITOR" != 'vim' ] && [ "$EDITOR" != 'nvim' ]; then | ||
echo 'ERROR: Set the "EDITOR" environment variable to "vim" or "nvim" and run again.' | ||
exit 1 | ||
fi | ||
|
||
PASSED=() | ||
FAILED=() | ||
SKIPPED=() | ||
|
||
tmp_base_dir='/tmp/clojure.vim/indent' | ||
mkdir -p "$tmp_base_dir" | ||
tmp_dir="$(mktemp --directory "$tmp_base_dir/XXXXXX")" | ||
test_case_dir='tests' | ||
|
||
test_pass() { PASSED+=("$1"); } | ||
test_fail() { | ||
FAILED+=("$1") | ||
echo "::error file=clj/indent-test/$test_case_dir/$1/out.clj::Failed indent test case." | ||
} | ||
test_skip() { | ||
SKIPPED+=("$1") | ||
echo "::warning file=clj/indent-test/$test_case_dir/$1/out.clj::Skipped indent test case." | ||
} | ||
|
||
run_test_case() { | ||
test_case="$1" | ||
in_file="$test_case_dir/$test_case/in.clj" | ||
expected_file="$test_case_dir/$test_case/out.clj" | ||
|
||
echo "::group::$EDITOR -- $test_case" | ||
|
||
if [ -f "$test_case_dir/$test_case/SKIP" ]; then | ||
test_skip "$test_case" | ||
else | ||
actual_file="$tmp_dir/$test_case.clj" | ||
cp "$in_file" "$actual_file" | ||
|
||
# Override the default test commands with a `test.vim` file. | ||
test_script="$test_case_dir/$test_case/test.vim" | ||
if [ -f "$test_script" ]; then | ||
test_cmd=('-S' "$test_script") | ||
else | ||
test_cmd=('+normal! gg=G') | ||
fi | ||
|
||
"$EDITOR" --clean -NXnu test-vimrc.vim "${test_cmd[@]}" '+xall!' -- "$actual_file" | ||
|
||
diff --color=always -u "$expected_file" "$actual_file" | ||
|
||
[ $? -eq 0 ] && test_pass "$test_case" || test_fail "$test_case" | ||
fi | ||
|
||
echo '::endgroup::' | ||
} | ||
|
||
for tcase in $test_case_dir/*/; do | ||
run_test_case "$(basename "$tcase")" | ||
done | ||
|
||
echo "passed: ${#PASSED[@]}, failed: ${#FAILED[@]}, skipped: ${#SKIPPED[@]}" | ||
exit ${#FAILED[@]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
let &rtp = getcwd() . '/..,' . &rtp | ||
filetype plugin indent on | ||
syntax enable |
File renamed without changes.
File renamed without changes.
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
let g:clojure_indent_multiline_strings = 'pretty' | ||
normal! gg=G | ||
normal! G | ||
exec "normal! o\<CR>test \"hello\<CR>world\"" | ||
exec "normal! o\<CR>regex #\"asdf\<CR>bar\"" |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
let g:clojure_indent_multiline_strings = 'standard' | ||
normal! gg=G | ||
normal! G | ||
exec "normal! o\<CR>test \"hello\<CR>world\"" | ||
exec "normal! o\<CR>regex #\"asdf\<CR>bar\"" |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
let g:clojure_indent_multiline_strings = 'traditional' | ||
normal! gg=G | ||
normal! G | ||
exec "normal! o\<CR>test \"hello\<CR>world\"" | ||
exec "normal! o\<CR>regex #\"asdf\<CR>bar\"" |
File renamed without changes.
File renamed without changes.
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
let g:clojure_indent_style = 'traditional' | ||
normal! gg=G |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
let g:clojure_indent_style = 'uniform' | ||
normal! gg=G |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.