summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorw0rp <w0rp@users.noreply.github.com>2019-03-25 22:05:28 +0000
committerGitHub <noreply@github.com>2019-03-25 22:05:28 +0000
commit32c8bd1fa4629d52df27103fcf18d59c5d16b343 (patch)
tree7b6d11ddc86436118c6f30f75bc075e3b27dc82e /test
parent8768a309b8ef1c2e819dcb6f4630f73acab59792 (diff)
parentdfff73795a8ab4f8eeb31e0165cb9b63af3c8cf2 (diff)
downloadale-32c8bd1fa4629d52df27103fcf18d59c5d16b343.zip
Merge pull request #2363 from davidsierradz/master
support jsonlint local executable
Diffstat (limited to 'test')
-rw-r--r--test/jsonlint-test-files/app-without-jsonlint/src/app.json0
-rw-r--r--test/jsonlint-test-files/app/node_modules/.bin/jsonlint0
-rw-r--r--test/jsonlint-test-files/app/src/app.json0
-rw-r--r--test/jsonlint-test-files/node_modules/jsonlint/lib/cli.js0
-rw-r--r--test/test_jsonlint_executable_detection.vader46
5 files changed, 46 insertions, 0 deletions
diff --git a/test/jsonlint-test-files/app-without-jsonlint/src/app.json b/test/jsonlint-test-files/app-without-jsonlint/src/app.json
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/jsonlint-test-files/app-without-jsonlint/src/app.json
diff --git a/test/jsonlint-test-files/app/node_modules/.bin/jsonlint b/test/jsonlint-test-files/app/node_modules/.bin/jsonlint
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/jsonlint-test-files/app/node_modules/.bin/jsonlint
diff --git a/test/jsonlint-test-files/app/src/app.json b/test/jsonlint-test-files/app/src/app.json
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/jsonlint-test-files/app/src/app.json
diff --git a/test/jsonlint-test-files/node_modules/jsonlint/lib/cli.js b/test/jsonlint-test-files/node_modules/jsonlint/lib/cli.js
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/jsonlint-test-files/node_modules/jsonlint/lib/cli.js
diff --git a/test/test_jsonlint_executable_detection.vader b/test/test_jsonlint_executable_detection.vader
new file mode 100644
index 00000000..bd391b47
--- /dev/null
+++ b/test/test_jsonlint_executable_detection.vader
@@ -0,0 +1,46 @@
+Before:
+ call ale#test#SetDirectory('/testplugin/test')
+
+ runtime ale_linters/json/jsonlint.vim
+
+After:
+ let g:ale_has_override = {}
+ let g:ale_json_jsonlint_executable = 'jsonlint'
+ let g:ale_json_jsonlint_use_global = 0
+
+ call ale#test#RestoreDirectory()
+ call ale#linter#Reset()
+
+Execute(local executable should be detected correctly):
+ call ale#test#SetFilename('jsonlint-test-files/app/src/app.json')
+
+ AssertEqual
+ \ ale#path#Simplify(g:dir . '/jsonlint-test-files/app/node_modules/.bin/jsonlint'),
+ \ ale_linters#json#jsonlint#GetExecutable(bufnr(''))
+
+Execute(recursively executable should be detected correctly):
+ call ale#test#SetFilename('jsonlint-test-files/app-without-jsonlint/src/app.json')
+
+ AssertEqual
+ \ ale#path#Simplify(g:dir . '/jsonlint-test-files/node_modules/jsonlint/lib/cli.js'),
+ \ ale_linters#json#jsonlint#GetExecutable(bufnr(''))
+
+Execute(use_global should override project executable):
+ let g:ale_json_jsonlint_use_global = 1
+
+ call ale#test#SetFilename('jsonlint-test-files/app/src/app.json')
+
+ AssertEqual
+ \ 'jsonlint',
+ \ ale_linters#json#jsonlint#GetExecutable(bufnr(''))
+
+Execute(manually defined should override default executable):
+ let g:ale_json_jsonlint_use_global = 1
+ let g:ale_json_jsonlint_executable = 'custom_jsonlint'
+
+ call ale#test#SetFilename('jsonlint-test-files/app/src/app.json')
+
+ AssertEqual
+ \ 'custom_jsonlint',
+ \ ale_linters#json#jsonlint#GetExecutable(bufnr(''))
+