summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorw0rp <w0rp@users.noreply.github.com>2019-04-13 12:35:52 +0100
committerGitHub <noreply@github.com>2019-04-13 12:35:52 +0100
commit784d1a9a622a0c30c26a17a835943593d036a4cd (patch)
tree0451624ea50fc92d6f8efbd9ef33484ccde2646f /test
parent6428162f792c4ed5905cc316b4099824c1af2fb2 (diff)
parent4b6691f602e8574fb41b8e63d8d95f7c0ecbb878 (diff)
downloadale-784d1a9a622a0c30c26a17a835943593d036a4cd.zip
Merge pull request #2394 from harttle/master
feat: fecs support for js/html/css lint and format
Diffstat (limited to 'test')
-rwxr-xr-xtest/command_callback/fecs_paths/fecs0
-rwxr-xr-xtest/command_callback/fecs_paths/fecs.exe0
-rw-r--r--test/command_callback/test_fecs_command_callback.vader8
-rw-r--r--test/fixers/test_fecs_fixer_callback.vader26
-rw-r--r--test/handler/test_fecs_handler.vader35
5 files changed, 69 insertions, 0 deletions
diff --git a/test/command_callback/fecs_paths/fecs b/test/command_callback/fecs_paths/fecs
new file mode 100755
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/fecs_paths/fecs
diff --git a/test/command_callback/fecs_paths/fecs.exe b/test/command_callback/fecs_paths/fecs.exe
new file mode 100755
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/fecs_paths/fecs.exe
diff --git a/test/command_callback/test_fecs_command_callback.vader b/test/command_callback/test_fecs_command_callback.vader
new file mode 100644
index 00000000..f70ad084
--- /dev/null
+++ b/test/command_callback/test_fecs_command_callback.vader
@@ -0,0 +1,8 @@
+Before:
+ call ale#assert#SetUpLinterTest('javascript', 'fecs')
+
+After:
+ call ale#assert#TearDownLinterTest()
+
+Execute(The default command should be correct):
+ AssertLinter 'fecs', ale#Escape('fecs') . ' check --colors=false --rule=true %t'
diff --git a/test/fixers/test_fecs_fixer_callback.vader b/test/fixers/test_fecs_fixer_callback.vader
new file mode 100644
index 00000000..809b4d46
--- /dev/null
+++ b/test/fixers/test_fecs_fixer_callback.vader
@@ -0,0 +1,26 @@
+Before:
+ call ale#assert#SetUpFixerTest('javascript', 'fecs')
+ runtime autoload/ale/handlers/fecs.vim
+
+After:
+ call ale#assert#TearDownFixerTest()
+
+Execute(The fecs fixer should respect to g:ale_javascript_fecs_executable):
+ let g:ale_javascript_fecs_executable = 'fecs_paths/fecs'
+ let g:ale_javascript_fecs_use_global = 1
+ silent cd ../command_callback
+ let g:dir = getcwd()
+
+ AssertEqual
+ \ {
+ \ 'command': ale#Escape(g:ale_javascript_fecs_executable) . ' format --replace=true %t',
+ \ 'read_temporary_file': 1,
+ \ },
+ \ ale#fixers#fecs#Fix(bufnr(''))
+
+Execute(The fecs fixer should return 0 when executable not found):
+ let g:ale_javascript_fecs_executable = 'fecs-invalid'
+ let g:ale_javascript_fecs_use_global = 1
+ AssertEqual
+ \ 0,
+ \ ale#fixers#fecs#Fix(bufnr(''))
diff --git a/test/handler/test_fecs_handler.vader b/test/handler/test_fecs_handler.vader
new file mode 100644
index 00000000..7c216b8d
--- /dev/null
+++ b/test/handler/test_fecs_handler.vader
@@ -0,0 +1,35 @@
+Before:
+ runtime autoload/ale/handlers/fecs.vim
+
+After:
+ call ale#linter#Reset()
+
+Execute(fecs should parse lines correctly):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 20,
+ \ 'col': 25,
+ \ 'text': 'Unexpected console statement.',
+ \ 'code': 'no-console',
+ \ 'type': 'W',
+ \ },
+ \ {
+ \ 'lnum': 24,
+ \ 'col': 36,
+ \ 'text': 'Missing radix parameter.',
+ \ 'code': 'radix',
+ \ 'type': 'E',
+ \ },
+ \ {
+ \ 'lnum': 25,
+ \ 'col': 6,
+ \ 'text': 'Missing static property value.',
+ \ 'type': 'E',
+ \ },
+ \ ],
+ \ ale#handlers#fecs#Handle(347, [
+ \ 'fecs WARN → line 20, col 25: Unexpected console statement. (no-console)',
+ \ 'fecs ERROR → line 24, col 36: Missing radix parameter. (radix)',
+ \ 'fecs ERROR → line 25, col 6: Missing static property value.',
+ \ ])