]> git.madduck.net Git - etc/vim.git/blobdiff - .vim/bundle/ale/test/fixers/test_prettier_eslint_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_prettier_eslint_fixer.callback.vader
diff --git a/.vim/bundle/ale/test/fixers/test_prettier_eslint_fixer.callback.vader b/.vim/bundle/ale/test/fixers/test_prettier_eslint_fixer.callback.vader
new file mode 100644 (file)
index 0000000..cfdd1c7
--- /dev/null
@@ -0,0 +1,97 @@
+Before:
+  call ale#assert#SetUpFixerTest('javascript', 'prettier_eslint')
+  Save g:ale_command_wrapper
+
+  let g:ale_command_wrapper = ''
+
+After:
+  call ale#assert#TearDownFixerTest()
+
+Execute(The default command should be correct):
+  AssertFixer
+  \ {
+  \   'read_temporary_file': 1,
+  \   'command':
+  \     ale#Escape('prettier-eslint')
+  \     . ' %t'
+  \     . ' --write'
+  \ }
+
+Execute(Additional options should be used when set):
+  let b:ale_javascript_prettier_eslint_options = '--foobar'
+
+  AssertFixer
+  \ {
+  \   'read_temporary_file': 1,
+  \   'command':
+  \     ale#Escape('prettier-eslint')
+  \     . ' %t'
+  \     . ' --foobar --write'
+  \ }
+
+Execute(--eslint-config-path should be set for 4.2.0 and up):
+  call ale#test#SetFilename('../test-files/eslint/react-app/foo/bar.js')
+
+  GivenCommandOutput ['4.2.0']
+  AssertFixer
+  \ {
+  \   'read_temporary_file': 1,
+  \   'command':
+  \     ale#Escape('prettier-eslint')
+  \     . ' %t'
+  \     . ' --eslint-config-path ' . ale#Escape(ale#test#GetFilename('../test-files/eslint/react-app/.eslintrc.js'))
+  \     . ' --write'
+  \ }
+
+Execute(--eslint-config-path shouldn't be used for older versions):
+  call ale#test#SetFilename('../test-files/eslint/react-app/foo/bar.js')
+
+  AssertFixer
+  \ {
+  \   'read_temporary_file': 1,
+  \   'command':
+  \     ale#Escape('prettier-eslint')
+  \     . ' %t'
+  \     . ' --write'
+  \ }
+
+Execute(The version check should be correct):
+  AssertFixer [
+  \ ale#Escape('prettier-eslint') . ' --version',
+  \ {
+  \   'read_temporary_file': 1,
+  \   'command':
+  \     ale#Escape('prettier-eslint')
+  \     . ' %t'
+  \     . ' --write'
+  \ }
+  \]
+
+Execute(The new --stdin-filepath option should be used when the version is new enough):
+  call ale#test#SetFilename('../test-files/eslint/react-app/foo/bar.js')
+
+  GivenCommandOutput ['4.4.0']
+  AssertFixer
+  \ {
+  \   'cwd': '%s:h',
+  \   'command': ale#Escape('prettier-eslint')
+  \     . ' --eslint-config-path ' . ale#Escape(ale#test#GetFilename('../test-files/eslint/react-app/.eslintrc.js'))
+  \     . ' --stdin-filepath %s --stdin',
+  \ }
+
+Execute(The version number should be cached):
+  GivenCommandOutput ['4.4.0']
+  AssertFixer
+  \ {
+  \   'cwd': '%s:h',
+  \   'command': ale#Escape('prettier-eslint')
+  \     . ' --stdin-filepath %s --stdin',
+  \ }
+
+  GivenCommandOutput []
+  AssertFixer
+  \ {
+  \   'cwd': '%s:h',
+  \   'command': ale#Escape('prettier-eslint')
+  \     . ' --stdin-filepath %s --stdin',
+  \ }