Skip to content

Test snippet format matches a directory it is in #1097

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 14, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 33 additions & 11 deletions tests.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,37 @@
#!/usr/bin/env bash

SPACED=$(grep -REn '^ .+' --include '*.snippets' snippets)

if [[ $? -ne 1 ]]; then
echo These snippet lines are indented with spaces:
echo
echo "$SPACED"
echo
echo Tests failed!
check=0

function test_space_indented {
local spaced
spaced=$(grep -REn '^ ' --include '*.snippets' snippets)

if [[ $? -ne 1 ]]; then
echo "These snippet lines are indented with spaces:"
echo "$spaced"
echo
(( check++ ))
fi
}

function test_snipmate_format {
local ultisnips_in_snipmate
ultisnips_in_snipmate=$(grep -REn 'endsnippet' --include '*.snippets' snippets)
if [[ $? -ne 1 ]]; then
echo "These snippet definitions are probably in UltiSnips format but stored in the snipmate directory"
echo "$ultisnips_in_snipmate"
echo
(( check++ ))
fi
}

test_space_indented
test_snipmate_format

if [ $check -eq 0 ]; then
echo "Tests passed!"
exit 0
else
echo "$check test(s) failed out of 2!"
exit 1
fi

echo Tests passed!
exit 0