Clean up tests to stop people copy and pasting the wrong examples

This commit is contained in:
w0rp 2017-11-15 17:21:17 +00:00
parent e721f851b4
commit b14377915b
35 changed files with 133 additions and 104 deletions

View File

@ -9,8 +9,6 @@ After:
call ale#linter#Reset()
Execute(The default command should be correct):
AssertEqual
\ 'protoc' . ' -I ' . ale#Escape(getcwd()) . ' --lint_out=. ' . '%s',
\ ale_linters#proto#protoc_gen_lint#GetCommand(bufnr(''))

View File

@ -1,13 +1,15 @@
Before:
Save g:ale_python_pycodestyle_executable
Save g:ale_python_pycodestyle_options
Save g:ale_python_pycodestyle_use_global
runtime ale_linters/python/pycodestyle.vim
Save g:ale_python_pycodestyle_executable,
\ g:ale_python_pycodestyle_options,
\ g:ale_python_pycodestyle_use_global
After:
call ale#linter#Reset()
Restore
call ale#linter#Reset()
Execute(The pycodestyle command callback should return default string):
AssertEqual ale#Escape('pycodestyle') . ' -',
\ ale_linters#python#pycodestyle#GetCommand(bufnr(''))

View File

@ -1,12 +1,14 @@
Before:
runtime ale_linters/yaml/swaglint.vim
call ale#test#SetDirectory('/testplugin/test/command_callback')
After:
call ale#linter#Reset()
let g:ale_yaml_swaglint_executable = 'swaglint'
let g:ale_yaml_swaglint_use_global = 0
call ale#linter#Reset()
Execute(The yaml swaglint command callback should return the correct default string):
AssertEqual 'swaglint',
\ ale_linters#yaml#swaglint#GetExecutable(bufnr(''))

View File

@ -1,15 +1,13 @@
Before:
Save g:ale_terraform_tflint_executable
Save g:ale_terraform_tflint_options
runtime ale_linters/terraform/tflint.vim
After:
Restore
call ale#linter#Reset()
call ale#linter#Reset()
Execute(The default executable should be configurable):
AssertEqual 'tflint', ale_linters#terraform#tflint#GetExecutable(bufnr(''))

View File

@ -28,6 +28,7 @@ Before:
After:
Restore
delfunction GetCommand
unlet! b:ale_thrift_thrift_executable
unlet! b:ale_thrift_thrift_generators

View File

@ -2,10 +2,11 @@ Before:
runtime ale_linters/xml/xmllint.vim
After:
call ale#linter#Reset()
let g:ale_xml_xmllint_options = ''
let g:ale_xml_xmllint_executable = 'xmllint'
call ale#linter#Reset()
Execute(The xml xmllint command callback should return the correct default string):
AssertEqual ale#Escape('xmllint') . ' --noout -',
\ join(split(ale_linters#xml#xmllint#GetCommand(1)))
@ -22,4 +23,3 @@ Execute(The xmllint executable should be configurable):
AssertEqual '~/.local/bin/xmllint', ale_linters#xml#xmllint#GetExecutable(1)
AssertEqual ale#Escape('~/.local/bin/xmllint') . ' --noout -',
\ join(split(ale_linters#xml#xmllint#GetCommand(1)))

View File

@ -1,6 +1,11 @@
Execute(The asm GCC handler should parse lines from GCC 6.3.1 correctly):
Before:
runtime ale_linters/asm/gcc.vim
After:
call ale#linter#Reset()
Execute(The asm GCC handler should parse lines from GCC 6.3.1 correctly):
AssertEqual
\ [
\ {
@ -19,6 +24,3 @@ Execute(The asm GCC handler should parse lines from GCC 6.3.1 correctly):
\ "{standard_input}:38: Error: too many memory references for `mov'",
\ "{standard input}:42: Error: incorrect register `%ax' used with `l' suffix",
\ ])
After:
call ale#linter#Reset()

View File

@ -1,5 +1,10 @@
Execute(Parsing checkmake errors should work):
Before:
runtime ale_linters/make/checkmake.vim
After:
call ale#linter#Reset()
Execute(Parsing checkmake errors should work):
silent file Makefile
AssertEqual
@ -15,5 +20,3 @@ Execute(Parsing checkmake errors should work):
\ 'This shouldnt match',
\ '1:woops:an error has occurred',
\ ])
After:
call ale#linter#Reset()

View File

@ -1,6 +1,11 @@
Execute(The coffeelint handler should parse lines correctly):
Before:
runtime ale_linters/coffee/coffeelint.vim
After:
call ale#linter#Reset()
Execute(The coffeelint handler should parse lines correctly):
AssertEqual
\ [
\ {
@ -13,6 +18,3 @@ Execute(The coffeelint handler should parse lines correctly):
\ "path,lineNumber,lineNumberEnd,level,message",
\ "stdin,125,,error,Line exceeds maximum allowed length Length is 122, max is 120.",
\ ])
After:
call ale#linter#Reset()

View File

@ -1,6 +1,10 @@
Execute(The credo handler should parse lines correctly):
Before:
runtime ale_linters/elixir/credo.vim
After:
call ale#linter#Reset()
Execute(The credo handler should parse lines correctly):
AssertEqual
\ [
\ {
@ -23,7 +27,3 @@ Execute(The credo handler should parse lines correctly):
\ 'lib/filename.ex:1:4: C: There is no whitespace around parentheses/brackets most of the time, but here there is.',
\ 'lib/phoenix/channel.ex:26: R: If/else blocks should not have a negated condition in `if`.',
\ ])
After:
call ale#linter#Reset()

View File

@ -1,5 +1,10 @@
Execute(The crystal handler should parse lines correctly and add the column if it can):
Before:
runtime ale_linters/crystal/crystal.vim
After:
call ale#linter#Reset()
Execute(The crystal handler should parse lines correctly and add the column if it can):
AssertEqual
\ [
\ {
@ -11,6 +16,3 @@ Execute(The crystal handler should parse lines correctly and add the column if i
\ ale_linters#crystal#crystal#Handle(255, [
\ '[{"file":"/tmp/test.cr","line":2,"column":1,"size":null,"message":"unexpected token: EOF"}]'
\ ])
After:
call ale#linter#Reset()

View File

@ -1,5 +1,10 @@
Execute(The Dafny handler should parse output correctly):
Before:
runtime ale_linters/dafny/dafny.vim
After:
call ale#linter#Reset()
Execute(The Dafny handler should parse output correctly):
AssertEqual
\ [
\ {
@ -21,6 +26,3 @@ Execute(The Dafny handler should parse output correctly):
\ 'File.dfy(123,45): Error BP5002: A precondition for this call might not hold.',
\ 'File.dfy(678,90): Related location: This is the precondition that might not hold.'
\ ])
After:
call ale#linter#Reset()

View File

@ -1,6 +1,11 @@
Execute(The dogma handler should parse lines correctly):
Before:
runtime ale_linters/elixir/dogma.vim
After:
call ale#linter#Reset()
Execute(The dogma handler should parse lines correctly):
AssertEqual
\ [
\ {
@ -23,6 +28,3 @@ Execute(The dogma handler should parse lines correctly):
\ 'lib/filename.ex:18:5: C: Some error',
\ 'lib/filename.ex:19:7: R: Some warning',
\ ])
After:
call ale#linter#Reset()

View File

@ -1,8 +1,10 @@
" Author: Adrian Zalewski <aazalewski@hotmail.com>
Before:
runtime ale_linters/handlebars/embertemplatelint.vim
After:
call ale#linter#Reset()
Execute(The ember-template-lint handler should parse lines correctly):
let input_lines = split('{
\ "/ember-project/app/templates/application.hbs": [
@ -80,6 +82,3 @@ Execute(The ember-template-lint handler should handle no lint errors/warnings):
AssertEqual
\ [],
\ ale_linters#handlebars#embertemplatelint#Handle(347, ['{}'])
After:
call ale#linter#Reset()

View File

@ -1,6 +1,10 @@
Execute(The fortran handler should parse lines from GCC 4.1.2 correctly):
Before:
runtime ale_linters/fortran/gcc.vim
After:
call ale#linter#Reset()
Execute(The fortran handler should parse lines from GCC 4.1.2 correctly):
AssertEqual
\ [
\ {
@ -31,13 +35,8 @@ Execute(The fortran handler should parse lines from GCC 4.1.2 correctly):
\ "Error: Symbol a at (1) has no IMPLICIT type",
\ ])
After:
call ale#linter#Reset()
Execute(The fortran handler should parse lines from GCC 4.9.3 correctly):
runtime ale_linters/fortran/gcc.vim
AssertEqual
\ [
\ {
@ -68,14 +67,7 @@ Execute(The fortran handler should parse lines from GCC 4.9.3 correctly):
\ "Error: Symbol b at (1) has no IMPLICIT type",
\ ])
After:
call ale#linter#Reset()
Execute(The fortran handler should parse lines from GCC 6.3.1 correctly):
runtime ale_linters/fortran/gcc.vim
AssertEqual
\ [
\ {
@ -101,6 +93,3 @@ Execute(The fortran handler should parse lines from GCC 6.3.1 correctly):
\ "",
\ "Error: Symbol b at (1) has no IMPLICIT type",
\ ])
After:
call ale#linter#Reset()

View File

@ -1,6 +1,9 @@
Before:
runtime! ale_linters/llvm/llc.vim
After:
call ale#linter#Reset()
Execute(llc handler should parse errors output for STDIN):
AssertEqual
\ [
@ -53,4 +56,3 @@ Execute(llc handler should parse errors output for some file):
\ 'call void @foo(i64 %0)',
\ ' ^',
\ ])

View File

@ -1,13 +1,13 @@
Before:
Save g:ale_warn_about_trailing_whitespace
runtime ale_linters/lua/luacheck.vim
After:
Restore
call ale#linter#Reset()
Execute(The luacheck handler should parse lines correctly):
runtime ale_linters/lua/luacheck.vim
AssertEqual
\ [
\ {
@ -36,8 +36,6 @@ Execute(The luacheck handler should parse lines correctly):
\ ])
Execute(The luacheck handler should respect the warn_about_trailing_whitespace option):
runtime ale_linters/lua/luacheck.vim
let g:ale_warn_about_trailing_whitespace = 0
AssertEqual

View File

@ -1,6 +1,9 @@
Before:
runtime ale_linters/tcl/nagelfar.vim
After:
call ale#linter#Reset()
Execute(The nagelfar handler should parse lines correctly):
AssertEqual
\ [

View File

@ -1,5 +1,10 @@
Execute(Parsing nim errors should work):
Before:
runtime ale_linters/nim/nimcheck.vim
After:
call ale#linter#Reset()
Execute(Parsing nim errors should work):
silent file foobar.nim
AssertEqual

View File

@ -1,6 +1,10 @@
Execute(The nix handler should parse nix-instantiate error messages correctly):
Before:
runtime ale_linters/nix/nix.vim
After:
call ale#linter#Reset()
Execute(The nix handler should parse nix-instantiate error messages correctly):
AssertEqual
\ [
\ {
@ -22,6 +26,3 @@ Execute(The nix handler should parse nix-instantiate error messages correctly):
\ 'error: syntax error, unexpected IN, at /path/to/filename.nix:23:14',
\ 'error: syntax error, unexpected ''='', expecting '';'', at /path/to/filename.nix:3:12',
\ ])
After:
call ale#linter#Reset()

View File

@ -1,6 +1,9 @@
Before:
runtime ale_linters/php/php.vim
After:
call ale#linter#Reset()
Given (Some invalid lines of PHP):
[foo;]
class Foo { / }
@ -76,6 +79,3 @@ Execute (The php handler should parse lines without column indication):
\ "Parse error: syntax error, unexpected end of file in - on line 21",
\ "Parse error: Invalid numeric literal in - on line 47",
\ ])
After:
call ale#linter#Reset()

View File

@ -1,6 +1,9 @@
Before:
runtime ale_linters/php/phan.vim
After:
call ale#linter#Reset()
Execute(The php static analyzer handler should parse errors from phan):
AssertEqual
\ [
@ -19,6 +22,3 @@ Execute(The php static analyzer handler should parse errors from phan):
\ "example.php:25 PhanUndeclaredTypeReturnType Return type of getValidator is undeclared type \\Respect\\Validation\\Validator",
\ "example.php:66 PhanUndeclaredClassMethod Call to method string from undeclared class \\Respect\\Validation\\Validator",
\ ])
After:
call ale#linter#Reset()

View File

@ -1,6 +1,9 @@
Before:
runtime ale_linters/php/phpmd.vim
After:
call ale#linter#Reset()
Execute(The php static analyzer handler should parse errors from phpmd):
AssertEqual
\ [
@ -19,6 +22,3 @@ Execute(The php static analyzer handler should parse errors from phpmd):
\ "example.php:22 Avoid unused local variables such as '$response'.",
\ "example.php:14 The method test uses an else expression. Else is never necessary and you can simplify the code to work without else.",
\ ])
After:
call ale#linter#Reset()

View File

@ -1,6 +1,9 @@
Before:
runtime ale_linters/markdown/remark_lint.vim
After:
call ale#linter#Reset()
Execute(Warning and error messages should be handled correctly):
AssertEqual
\ [

View File

@ -1,6 +1,10 @@
Execute(The rpmlint handler should parse error messages correctly):
Before:
runtime ale_linters/spec/rpmlint.vim
After:
call ale#linter#Reset()
Execute(The rpmlint handler should parse error messages correctly):
AssertEqual
\ [
\ {

View File

@ -1,6 +1,9 @@
Before:
runtime ale_linters/rstcheck/rstcheck.vim
After:
call ale#linter#Reset()
Execute(Warning and error messages should be handled correctly):
AssertEqual
\ [

View File

@ -1,5 +1,10 @@
Execute(The ruby handler should parse lines correctly and add the column if it can):
Before:
runtime ale_linters/ruby/ruby.vim
After:
call ale#linter#Reset()
Execute(The ruby handler should parse lines correctly and add the column if it can):
" Point Error
" Warning
" Line Error
@ -31,6 +36,3 @@ Execute(The ruby handler should parse lines correctly and add the column if it c
\ "test.rb:9: warning: statement not reached",
\ "test.rb:12: syntax error, unexpected end-of-input, expecting keyword_end",
\ ])
After:
call ale#linter#Reset()

View File

@ -1,8 +1,8 @@
Before:
runtime ale_linters/scala/scalac.vim
runtime ale_linters/scala/scalac.vim
After:
call ale#linter#Reset()
call ale#linter#Reset()
Given scala(An empty Scala file):

View File

@ -1,9 +1,10 @@
Before:
runtime ale_linters/sh/shell.vim
After:
call ale#linter#Reset()
Execute(The shell handler should parse lines correctly):
runtime ale_linters/sh/shell.vim
AssertEqual
\ [
\ {

View File

@ -1,7 +1,11 @@
" Author: Markus Doits <markus.doits@googlemail.com>
Before:
runtime ale_linters/slim/slimlint.vim
After:
call ale#linter#Reset()
Execute(The slim handler should parse lines correctly):
runtime ale_linters/slim/slimlint.vim
AssertEqual
\ [
@ -26,6 +30,3 @@ Execute(The slim handler should parse lines correctly):
\ 'inv.slim:2 [W] LineLength: Line is too long. [136/80]',
\ 'inv.slim:3 [E] Invalid syntax',
\ ])
After:
call ale#linter#Reset()

View File

@ -85,4 +85,3 @@ Execute (Testing a warning):
\ "val f = fn : int -> int",
\ "-",
\])

View File

@ -1,6 +1,10 @@
Execute(The sqlint handler should parse lines correctly):
Before:
runtime! ale_linters/sql/sqlint.vim
After:
call ale#linter#Reset()
Execute(The sqlint handler should parse lines correctly):
AssertEqual
\ [
\ {
@ -28,6 +32,3 @@ Execute(The sqlint handler should parse lines correctly):
\ 'stdin:47:11:ERROR unterminated quoted string at or near "''',
\ 'stdin:50:12:WARNING some warning at end of input',
\ ])
After:
call ale#linter#Reset()

View File

@ -1,6 +1,9 @@
Before:
runtime ale_linters/yaml/swaglint.vim
After:
call ale#linter#Reset()
Execute(The swaglint handler should parse lines correctly):
AssertEqual
\ [

View File

@ -1,6 +1,10 @@
Execute(The typecheck handler should parse lines correctly):
Before:
runtime ale_linters/typescript/typecheck.vim
After:
call ale#linter#Reset()
Execute(The typecheck handler should parse lines correctly):
AssertEqual
\ [
\ {
@ -18,6 +22,3 @@ Execute(The typecheck handler should parse lines correctly):
\ "somets.ts[16, 7]: Type 'A' is not assignable to type 'B'",
\ "somets.ts[7, 41]: Property 'a' does not exist on type 'A'",
\ ])
After:
call ale#linter#Reset()

View File

@ -1,6 +1,9 @@
Before:
runtime ale_linters/xml/xmllint.vim
After:
call ale#linter#Reset()
Execute(The xmllint handler should parse error messages correctly):
AssertEqual
\ [
@ -25,6 +28,3 @@ Execute(The xmllint handler should parse error messages correctly):
\ 'blahblah>',
\ '^'
\ ])
After:
call ale#linter#Reset()