summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCharles B Johnson <mail@cbjohnson.info>2020-04-08 22:59:54 -0500
committerCharles B Johnson <mail@cbjohnson.info>2021-01-22 09:23:53 -0600
commit8ffde14039bdc0c12d1edf961461245eb15858e9 (patch)
treea352870d863400b9161b431d3a6829149cf854d3 /test
parente75ac9f4975be35e4f33b955f473ba5e336c9ca0 (diff)
downloadale-8ffde14039bdc0c12d1edf961461245eb15858e9.zip
fixers/xo: support stdin relative to the fixed file
Diffstat (limited to 'test')
-rw-r--r--test/fixers/test_xo_fixer_callback.vader15
-rw-r--r--test/fixers/test_xots_fixer_callback.vader15
2 files changed, 30 insertions, 0 deletions
diff --git a/test/fixers/test_xo_fixer_callback.vader b/test/fixers/test_xo_fixer_callback.vader
index d36fe74c..ffbecb6c 100644
--- a/test/fixers/test_xo_fixer_callback.vader
+++ b/test/fixers/test_xo_fixer_callback.vader
@@ -29,3 +29,18 @@ Execute(The xo callback should include custom xo options):
\ . ' --fix %t'
\ . ' --space',
\ }
+
+Execute(--stdin should be used when xo is new enough):
+ let g:ale_javascript_xo_options = '--space'
+ call ale#test#SetFilename('../eslint-test-files/react-app/subdir/testfile.js')
+
+ GivenCommandOutput ['0.30.0']
+ AssertFixer
+ \ {
+ \ 'command': ale#path#CdString(ale#path#Simplify(g:dir . '/../eslint-test-files'))
+ \ . (has('win32') ? 'node.exe ' : '')
+ \ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/node_modules/xo/cli.js'))
+ \ . ' --stdin --stdin-filename %s'
+ \ . ' --fix'
+ \ . ' --space',
+ \ }
diff --git a/test/fixers/test_xots_fixer_callback.vader b/test/fixers/test_xots_fixer_callback.vader
index 1ef6a6dd..a26ec03c 100644
--- a/test/fixers/test_xots_fixer_callback.vader
+++ b/test/fixers/test_xots_fixer_callback.vader
@@ -29,3 +29,18 @@ Execute(The xo callback should include custom xo options):
\ . ' --fix %t'
\ . ' --space',
\ }
+
+Execute(--stdin should be used when xo is new enough):
+ let g:ale_typescript_xo_options = '--space'
+ call ale#test#SetFilename('../eslint-test-files/react-app/subdir/testfile.ts')
+
+ GivenCommandOutput ['0.30.0']
+ AssertFixer
+ \ {
+ \ 'command': ale#path#CdString(ale#path#Simplify(g:dir . '/../eslint-test-files'))
+ \ . (has('win32') ? 'node.exe ' : '')
+ \ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/node_modules/xo/cli.js'))
+ \ . ' --stdin --stdin-filename %s'
+ \ . ' --fix'
+ \ . ' --space',
+ \ }