diff options
author | w0rp <devw0rp@gmail.com> | 2018-07-15 18:24:53 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2018-07-15 18:28:28 +0100 |
commit | a42999a639b2916b769a85f37d037be314d9d61b (patch) | |
tree | 5ebfb4d357dc673efa93fd32a66b489c4510de40 /test/command_callback/test_gobuild_command_callback.vader | |
parent | 5155a35a80fe3b20659eb0f28cc6cc720532dd3f (diff) | |
download | ale-a42999a639b2916b769a85f37d037be314d9d61b.zip |
Massively reduce the amount of code needed for linter tests
Diffstat (limited to 'test/command_callback/test_gobuild_command_callback.vader')
-rw-r--r-- | test/command_callback/test_gobuild_command_callback.vader | 44 |
1 files changed, 14 insertions, 30 deletions
diff --git a/test/command_callback/test_gobuild_command_callback.vader b/test/command_callback/test_gobuild_command_callback.vader index 240f29c6..86113728 100644 --- a/test/command_callback/test_gobuild_command_callback.vader +++ b/test/command_callback/test_gobuild_command_callback.vader @@ -1,52 +1,36 @@ Before: - Save g:ale_go_gobuild_options - - unlet! g:ale_go_gobuild_options + call ale#assert#SetUpLinterTest('go', 'gobuild') let g:env_prefix = has('win32') \ ? 'set GOPATH=' . ale#Escape('/foo/bar') . ' && ' \ : 'GOPATH=' . ale#Escape('/foo/bar') . ' ' - - runtime ale_linters/go/gobuild.vim - - call ale#test#SetDirectory('/testplugin/test/command_callback') - call ale_linters#go#gobuild#ResetEnv() -After: - Restore + WithChainResults ['/foo/bar', '/foo/baz'] +After: unlet! g:env_prefix + call ale#assert#TearDownLinterTest() - call ale#linter#Reset() - call ale#test#RestoreDirectory() - -Execute(The default gobuild command should be correct): - AssertEqual - \ ale_linters#go#gobuild#GetCommand(bufnr(''), ['/foo/bar', '/foo/baz']), +Execute(The default commands should be correct): + AssertLinter 'go', [ + \ 'go env GOPATH GOROOT', \ g:env_prefix . 'cd ' . ale#Escape(expand('%:p:h')) . ' && ' \ . 'go test -c -o /dev/null ./' - -Execute(The command for getting GOPATH should be correct): - AssertEqual ale_linters#go#gobuild#GoEnv(bufnr('')), 'go env GOPATH GOROOT' - - call ale_linters#go#gobuild#GetCommand(bufnr(''), ['/foo/bar', '/foo/baz']) + \] " We shouldn't run `go env` many times after we've got it. - AssertEqual ale_linters#go#gobuild#GoEnv(bufnr('')), '' - -Execute(The GOPATH output should be used after it has been read once): - call ale_linters#go#gobuild#GetCommand(bufnr(''), ['/foo/bar', '/foo/baz']) - - AssertEqual - \ ale_linters#go#gobuild#GetCommand(bufnr(''), []), + AssertLinter 'go', [ + \ '', \ g:env_prefix . 'cd ' . ale#Escape(expand('%:p:h')) . ' && ' \ . 'go test -c -o /dev/null ./' + \] Execute(Extra options should be supported): let g:ale_go_gobuild_options = '--foo-bar' - AssertEqual - \ ale_linters#go#gobuild#GetCommand(bufnr(''), ['/foo/bar', '/foo/baz']), + AssertLinter 'go', [ + \ 'go env GOPATH GOROOT', \ g:env_prefix . 'cd ' . ale#Escape(expand('%:p:h')) . ' && ' \ . 'go test --foo-bar -c -o /dev/null ./' + \] |