summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/command_callback/test_dart_language_server_command_callback.vader8
-rw-r--r--test/handler/test_gitlint_handler.vader19
-rw-r--r--test/test_should_do_nothing_conditions.vader18
3 files changed, 44 insertions, 1 deletions
diff --git a/test/command_callback/test_dart_language_server_command_callback.vader b/test/command_callback/test_dart_language_server_command_callback.vader
new file mode 100644
index 00000000..5567f271
--- /dev/null
+++ b/test/command_callback/test_dart_language_server_command_callback.vader
@@ -0,0 +1,8 @@
+Before:
+ call ale#assert#SetUpLinterTest('dart', 'language_server')
+
+After:
+ call ale#assert#TearDownLinterTest()
+
+Execute(The default command should be correct):
+ AssertLinter 'dart_language_server', ale#Escape('dart_language_server')
diff --git a/test/handler/test_gitlint_handler.vader b/test/handler/test_gitlint_handler.vader
index 60d632a0..5c531664 100644
--- a/test/handler/test_gitlint_handler.vader
+++ b/test/handler/test_gitlint_handler.vader
@@ -61,6 +61,19 @@ Execute(Disabling trailing whitespace warnings should work):
\ '8: T2 Trailing whitespace',
\])
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 8,
+ \ 'type': 'E',
+ \ 'text': 'Trailing whitespace',
+ \ 'code': 'B2',
+ \ },
+ \ ],
+ \ ale_linters#gitcommit#gitlint#Handle(bufnr(''), [
+ \ '8: B2 Trailing whitespace',
+ \])
+
let b:ale_warn_about_trailing_whitespace = 0
AssertEqual
@@ -68,3 +81,9 @@ Execute(Disabling trailing whitespace warnings should work):
\ ale_linters#gitcommit#gitlint#Handle(bufnr(''), [
\ '8: T2 Trailing whitespace',
\ ])
+
+ AssertEqual
+ \ [],
+ \ ale_linters#gitcommit#gitlint#Handle(bufnr(''), [
+ \ '8: B2 Trailing whitespace',
+ \ ])
diff --git a/test/test_should_do_nothing_conditions.vader b/test/test_should_do_nothing_conditions.vader
index 062ab875..de2e2782 100644
--- a/test/test_should_do_nothing_conditions.vader
+++ b/test/test_should_do_nothing_conditions.vader
@@ -4,10 +4,18 @@ Before:
Save g:ale_enabled
Save &l:statusline
+ let b:fake_mode = 'n'
+
call ale#test#SetDirectory('/testplugin/test')
let b:funky_command_created = 0
+ runtime autoload/ale/util.vim
+
+ function! ale#util#Mode(...) abort
+ return b:fake_mode
+ endfunction
+
" We will test for the existence of this command, so create one if needed.
if !exists(':CtrlPFunky')
command CtrlPFunky echo
@@ -25,6 +33,9 @@ After:
endif
unlet! b:funky_command_created
+ unlet! b:fake_mode
+
+ runtime autoload/ale/util.vim
Given foobar(An empty file):
Execute(ALE shouldn't do much of anything for ctrlp-funky buffers):
@@ -44,7 +55,7 @@ Execute(ALE shouldn't try to check buffers with '.' as the filename):
Assert ale#ShouldDoNothing(bufnr(''))
-Execute(DoNothing should return 0 when the filetype is empty):
+Execute(DoNothing should return 1 when the filetype is empty):
AssertEqual
\ 0,
\ ale#ShouldDoNothing(bufnr('')),
@@ -54,6 +65,11 @@ Execute(DoNothing should return 0 when the filetype is empty):
AssertEqual 1, ale#ShouldDoNothing(bufnr(''))
+Execute(DoNothing should return 1 when an operator is pending):
+ let b:fake_mode = 'no'
+
+ AssertEqual 1, ale#ShouldDoNothing(bufnr(''))
+
Execute(The DoNothing check should work if the ALE globals aren't defined):
unlet! g:ale_filetype_blacklist
unlet! g:ale_maximum_file_size