]> git.madduck.net Git - etc/vim.git/blobdiff - .vim/bundle/ale/test/fixers/test_djlint_fixer_callback.vader

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Merge commit '76265755a1add77121c8f9dabb3e9bb70fe9a972' as '.vim/bundle/ale'
[etc/vim.git] / .vim / bundle / ale / test / fixers / test_djlint_fixer_callback.vader
diff --git a/.vim/bundle/ale/test/fixers/test_djlint_fixer_callback.vader b/.vim/bundle/ale/test/fixers/test_djlint_fixer_callback.vader
new file mode 100644 (file)
index 0000000..1722469
--- /dev/null
@@ -0,0 +1,98 @@
+Before:
+  call ale#assert#SetUpFixerTest('html', 'djlint', 'djlint')
+
+After:
+  Restore
+
+  call ale#assert#TearDownFixerTest()
+
+Execute(The djlint callback should return the correct default command):
+  AssertEqual
+  \ {'command': ale#Escape('djlint') . ' --reformat  -'},
+  \ ale#fixers#djlint#Fix(bufnr(''))
+
+Execute(The --profile option should not be overridden):
+  call ale#test#SetFilename('../test-files/djlint/testfile.html')
+
+  set filetype=htmldjango
+  let g:ale_html_djlint_options = '--profile jinja'
+
+  AssertFixer
+  \ { 'command': ale#Escape(g:ale_html_djlint_executable)
+  \     . ' --reformat'
+  \     . ' --profile jinja'
+  \     . ' -',
+  \ }
+
+
+Execute(Should set --profile for experimental language, Handlebars):
+  call ale#test#SetFilename('../test-files/djlint/testfile.hbs')
+
+  set filetype=handlebars
+
+  AssertFixer
+  \ { 'command': ale#Escape(g:ale_html_djlint_executable)
+  \     . ' --reformat'
+  \     . ' --profile handlebars'
+  \     . ' -',
+  \ }
+
+Execute(Should set --profile for htmldjango, Django templates):
+  call ale#test#SetFilename('../test-files/djlint/testfile.html')
+
+  set filetype=htmldjango
+
+  AssertFixer
+  \ { 'command': ale#Escape(g:ale_html_djlint_executable)
+  \     . ' --reformat'
+  \     . ' --profile django'
+  \     . ' -',
+  \ }
+
+Execute(Should set --profile for htmlangular):
+  call ale#test#SetFilename('../test-files/djlint/testfile.html')
+
+  set filetype=htmlangular
+
+  AssertFixer
+  \ { 'command': ale#Escape(g:ale_html_djlint_executable)
+  \     . ' --reformat'
+  \     . ' --profile angular'
+  \     . ' -',
+  \ }
+
+Execute(Should set --profile for jinja):
+  call ale#test#SetFilename('../test-files/djlint/testfile.jinja2')
+
+  set filetype=jinja
+
+  AssertFixer
+  \ { 'command': ale#Escape(g:ale_html_djlint_executable)
+  \     . ' --reformat'
+  \     . ' --profile jinja'
+  \     . ' -',
+  \ }
+
+Execute(Should set --profile for nunjucks):
+  call ale#test#SetFilename('../test-files/djlint/testfile.njk')
+
+  set filetype=nunjucks
+
+  AssertFixer
+  \ { 'command': ale#Escape(g:ale_html_djlint_executable)
+  \     . ' --reformat'
+  \     . ' --profile nunjucks'
+  \     . ' -',
+  \ }
+
+Execute(Should set --profile for Go HTML templates):
+  call ale#test#SetFilename('../test-files/djlint/testfile.html')
+
+  set filetype=gohtmltmpl
+
+  AssertFixer
+  \ { 'command': ale#Escape(g:ale_html_djlint_executable)
+  \     . ' --reformat'
+  \     . ' --profile golang'
+  \     . ' -',
+  \ }