summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/command_callback/go_paths/go1/prj1/file.go0
-rw-r--r--test/command_callback/go_paths/go2/prj2/file.go0
-rw-r--r--test/command_callback/test_golangci_lint_command_callback.vader38
-rw-r--r--test/command_callback/test_golangserver_command_callback.vader67
-rw-r--r--test/command_callback/test_ruby_solargraph.vader7
-rw-r--r--test/completion/test_completion_prefixes.vader20
-rw-r--r--test/handler/test_golangci_lint_handler.vader55
-rw-r--r--test/handler/test_perl_handler.vader5
-rw-r--r--test/ruby_fixtures/valid_ruby_app3/.solargraph.yml0
-rw-r--r--test/ruby_fixtures/valid_ruby_app3/lib/file.rb0
10 files changed, 192 insertions, 0 deletions
diff --git a/test/command_callback/go_paths/go1/prj1/file.go b/test/command_callback/go_paths/go1/prj1/file.go
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/go_paths/go1/prj1/file.go
diff --git a/test/command_callback/go_paths/go2/prj2/file.go b/test/command_callback/go_paths/go2/prj2/file.go
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/go_paths/go2/prj2/file.go
diff --git a/test/command_callback/test_golangci_lint_command_callback.vader b/test/command_callback/test_golangci_lint_command_callback.vader
new file mode 100644
index 00000000..6cb73246
--- /dev/null
+++ b/test/command_callback/test_golangci_lint_command_callback.vader
@@ -0,0 +1,38 @@
+Before:
+ call ale#assert#SetUpLinterTest('go', 'golangci_lint')
+ call ale#test#SetFilename('test.go')
+
+After:
+ call ale#assert#TearDownLinterTest()
+
+Execute(The golangci-lint defaults should be correct):
+ AssertLinter 'golangci-lint',
+ \ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
+ \ . ale#Escape('golangci-lint')
+ \ . ' run ' . ale#util#EscapePCRE(expand('%' . ':t'))
+ \ . ' --enable-all'
+
+Execute(The golangci-lint callback should use a configured executable):
+ let b:ale_go_golangci_lint_executable = 'something else'
+
+ AssertLinter 'something else',
+ \ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
+ \ . ale#Escape('something else')
+ \ . ' run ' . ale#util#EscapePCRE(expand('%' . ':t'))
+ \ . ' --enable-all'
+
+Execute(The golangci-lint callback should use configured options):
+ let b:ale_go_golangci_lint_options = '--foobar'
+
+ AssertLinter 'golangci-lint',
+ \ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
+ \ . ale#Escape('golangci-lint')
+ \ . ' run ' . ale#util#EscapePCRE(expand('%' . ':t'))
+ \ . ' --foobar'
+
+Execute(The golangci-lint `lint_package` option should use the correct command):
+ let b:ale_go_golangci_lint_package = 1
+
+ AssertLinter 'golangci-lint',
+ \ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
+ \ . ale#Escape('golangci-lint') . ' run --enable-all'
diff --git a/test/command_callback/test_golangserver_command_callback.vader b/test/command_callback/test_golangserver_command_callback.vader
new file mode 100644
index 00000000..ee88e1a4
--- /dev/null
+++ b/test/command_callback/test_golangserver_command_callback.vader
@@ -0,0 +1,67 @@
+Before:
+ Save $GOPATH
+ Save g:ale_completion_enabled
+
+ let g:ale_completion_enabled = 0
+ let g:sep = has('win32') ? ';' : ':'
+
+ call ale#assert#SetUpLinterTest('go', 'langserver')
+ let $GOPATH = ale#path#Simplify(g:dir . '/go_paths/go1')
+ \ . g:sep
+ \ . ale#path#Simplify(g:dir . '/go_paths/go2')
+
+After:
+ Restore
+
+ unlet! b:ale_completion_enabled
+ unlet! g:sep
+
+ call ale#assert#TearDownLinterTest()
+
+Execute(should set correct defaults):
+ AssertLinter 'go-langserver', ale#Escape('go-langserver')
+
+Execute(should configure go-langserver callback executable):
+ let b:ale_go_langserver_executable = 'boo'
+
+ AssertLinter 'boo', ale#Escape('boo')
+
+Execute(should set go-langserver options):
+ call ale#test#SetFilename('go_paths/go1/prj1/file.go')
+ let b:ale_completion_enabled = 1
+ let b:ale_go_langserver_options = ''
+
+ AssertLinter 'go-langserver',
+ \ ale#Escape('go-langserver') . ' -gocodecompletion'
+
+ let b:ale_go_langserver_options = '-trace'
+
+ AssertLinter 'go-langserver',
+ \ ale#Escape('go-langserver') . ' -gocodecompletion -trace'
+
+Execute(should ignore go-langserver -gocodecompletion option):
+ call ale#test#SetFilename('go_paths/go1/prj1/file.go')
+
+ let b:ale_go_langserver_options = '-trace -gocodecompletion'
+ let b:ale_completion_enabled = 1
+
+ AssertLinter 'go-langserver',
+ \ ale#Escape('go-langserver') . ' -gocodecompletion -trace'
+
+ let b:ale_completion_enabled = 0
+
+ AssertLinter 'go-langserver', ale#Escape('go-langserver') . ' -trace'
+
+Execute(should set go-langserver for go app1):
+ call ale#test#SetFilename('go_paths/go1/prj1/file.go')
+
+ AssertLSPLanguage 'go'
+ AssertLSPOptions {}
+ AssertLSPProject ale#path#Simplify(g:dir . '/go_paths/go1')
+
+Execute(should set go-langserver for go app2):
+ call ale#test#SetFilename('go_paths/go2/prj1/file.go')
+
+ AssertLSPLanguage 'go'
+ AssertLSPOptions {}
+ AssertLSPProject ale#path#Simplify(g:dir . '/go_paths/go2')
diff --git a/test/command_callback/test_ruby_solargraph.vader b/test/command_callback/test_ruby_solargraph.vader
index a27cb62d..b9dd46d8 100644
--- a/test/command_callback/test_ruby_solargraph.vader
+++ b/test/command_callback/test_ruby_solargraph.vader
@@ -27,3 +27,10 @@ Execute(should set solargraph for ruby app2):
AssertLSPOptions {}
AssertLSPProject ale#path#Simplify(g:dir . 'command_callback/../ruby_fixtures/valid_ruby_app2')
AssertLSPAddress '127.0.0.1:7658'
+
+Execute(should set solargraph for ruby app3):
+ call ale#test#SetFilename('../ruby_fixtures/valid_ruby_app3/lib/file.rb')
+ AssertLSPLanguage 'ruby'
+ AssertLSPOptions {}
+ AssertLSPProject ale#path#Simplify(g:dir . 'command_callback/../ruby_fixtures/valid_ruby_app3')
+ AssertLSPAddress '127.0.0.1:7658'
diff --git a/test/completion/test_completion_prefixes.vader b/test/completion/test_completion_prefixes.vader
index 0b2cfeaf..3f2cab15 100644
--- a/test/completion/test_completion_prefixes.vader
+++ b/test/completion/test_completion_prefixes.vader
@@ -43,3 +43,23 @@ Execute(Completion should be done after words in parens in Rust):
Execute(Completion should not be done after parens in Rust):
AssertEqual '', ale#completion#GetPrefix(&filetype, 3, 15)
+
+Given lisp():
+ (minus-name
+ (full-name)
+
+Execute(Completion should be done for function names with minuses in Lisp):
+ AssertEqual 'minus-name', ale#completion#GetPrefix(&filetype, 1, 12)
+
+Execute(Completion should not be done after parens in Lisp):
+ AssertEqual '', ale#completion#GetPrefix(&filetype, 2, 12)
+
+Given clojure():
+ (minus-name
+ (full-name)
+
+Execute(Completion should be done for function names with minuses in Clojure):
+ AssertEqual 'minus-name', ale#completion#GetPrefix(&filetype, 1, 12)
+
+Execute(Completion should not be done after parens in Clojure):
+ AssertEqual '', ale#completion#GetPrefix(&filetype, 2, 12)
diff --git a/test/handler/test_golangci_lint_handler.vader b/test/handler/test_golangci_lint_handler.vader
new file mode 100644
index 00000000..fb6841f4
--- /dev/null
+++ b/test/handler/test_golangci_lint_handler.vader
@@ -0,0 +1,55 @@
+Before:
+ runtime ale_linters/go/golangci_lint.vim
+
+After:
+ call ale#linter#Reset()
+
+Execute (The golangci-lint handler should handle names with spaces):
+ " We can't test Windows paths with the path resovling on Linux, but we can
+ " test the regex.
+ AssertEqual
+ \ [
+ \ [
+ \ 'C:\something\file with spaces.go',
+ \ '12',
+ \ '3',
+ \ 'expected ''package'', found ''IDENT'' gibberish (staticcheck)',
+ \ ],
+ \ [
+ \ 'C:\something\file with spaces.go',
+ \ '37',
+ \ '5',
+ \ 'expected ''package'', found ''IDENT'' gibberish (golint)',
+ \ ],
+ \ ],
+ \ map(ale_linters#go#golangci_lint#GetMatches([
+ \ 'C:\something\file with spaces.go:12:3: expected ''package'', found ''IDENT'' gibberish (staticcheck)',
+ \ 'C:\something\file with spaces.go:37:5: expected ''package'', found ''IDENT'' gibberish (golint)',
+ \ ]), 'v:val[1:4]')
+
+Execute (The golangci-lint handler should handle paths correctly):
+ call ale#test#SetFilename('app/test.go')
+
+ let file = ale#path#GetAbsPath(expand('%:p:h'), 'test.go')
+
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 12,
+ \ 'col': 3,
+ \ 'text': 'expected ''package'', found ''IDENT'' gibberish (staticcheck)',
+ \ 'type': 'E',
+ \ 'filename': ale#path#Simplify(expand('%:p:h') . '/test.go'),
+ \ },
+ \ {
+ \ 'lnum': 37,
+ \ 'col': 5,
+ \ 'text': 'expected ''package'', found ''IDENT'' gibberish (golint)',
+ \ 'type': 'E',
+ \ 'filename': ale#path#Simplify(expand('%:p:h') . '/test.go'),
+ \ },
+ \ ],
+ \ ale_linters#go#golangci_lint#Handler(bufnr(''), [
+ \ file . ':12:3: expected ''package'', found ''IDENT'' gibberish (staticcheck)',
+ \ file . ':37:5: expected ''package'', found ''IDENT'' gibberish (golint)',
+ \ ])
diff --git a/test/handler/test_perl_handler.vader b/test/handler/test_perl_handler.vader
index c5791d76..e769550c 100644
--- a/test/handler/test_perl_handler.vader
+++ b/test/handler/test_perl_handler.vader
@@ -7,6 +7,11 @@ After:
call ale#test#RestoreDirectory()
call ale#linter#Reset()
+Execute(The Perl linter should handle empty output):
+ call ale#test#SetFilename('bar.pl')
+
+ AssertEqual [], ale_linters#perl#perl#Handle(bufnr(''), [])
+
Execute(The Perl linter should ignore errors from other files):
call ale#test#SetFilename('bar.pl')
diff --git a/test/ruby_fixtures/valid_ruby_app3/.solargraph.yml b/test/ruby_fixtures/valid_ruby_app3/.solargraph.yml
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/ruby_fixtures/valid_ruby_app3/.solargraph.yml
diff --git a/test/ruby_fixtures/valid_ruby_app3/lib/file.rb b/test/ruby_fixtures/valid_ruby_app3/lib/file.rb
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/ruby_fixtures/valid_ruby_app3/lib/file.rb