0
0
mirror of https://github.com/vim/vim.git synced 2025-10-27 09:24:23 -04:00

patch 9.1.0935: SpotBugs compiler can be improved

Problem:  SpotBugs compiler can be improved
Solution: runtime(compiler): Improve defaults and error handling for
          SpotBugs; update test_compiler.vim (Aliaksei Budavei)

runtime(compiler): Improve defaults and error handling for SpotBugs

* Keep "spotbugs#DefaultPreCompilerTestAction()" defined but
  do not assign its Funcref to the "PreCompilerTestAction"
  key of "g:spotbugs_properties": there are no default and
  there can only be introduced arbitrary "*sourceDirPath"
  entries; therefore, this assignment is confusing at best,
  given that the function's implementation delegates to
  whatever "PreCompilerAction" is.

* Allow for the possibility of relative source pathnames
  passed as arguments to Vim for the Javac default actions,
  and the necessity to have them properly reconciled when
  the current working directory is changed.

* Do not expect users to remember or know that new source
  files ‘must be’ ":argadd"'d to be then known to the Javac
  default actions; so collect the names of Java-file buffers
  and Java-file Vim arguments; and let users providing the
  "@sources" file-lists in the "g:javac_makeprg_params"
  variable update these file-lists themselves.

* Strive to not leave behind a fire-once Syntax ":autocmd"
  for a Java buffer whenever an arbitrary pre-compile action
  errors out.

* Only attempt to run a post-compiler action in the absence
  of failures for a pre-compiler action.  Note that warnings
  and failures are treated alike (?!) by the Javac compiler,
  so when previews are tried out with "--enable-preview",
  remember about passing "-Xlint:-preview" too to also let
  SpotBugs have a go.

* Properly group conditional operators when testing for key
  entries in a user-defined variable.

* Also test whether "javaExternal" is defined when choosing
  an implementation for source-file parsing.

* Two commands are provided to toggle actions for buffer-local
  autocommands:
  - SpotBugsRemoveBufferAutocmd;
  - SpotBugsDefineBufferAutocmd.

For example, try this from "~/.vim/after/ftplugin/java.vim":
------------------------------------------------------------
if exists(':SpotBugsDefineBufferAutocmd') == 2
	SpotBugsDefineBufferAutocmd BufWritePost SigUSR1
endif
------------------------------------------------------------

And ":doautocmd java_spotbugs User" can be manually used at will.

closes: #16140

Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Aliaksei Budavei
2024-12-16 21:37:54 +01:00
committed by Christian Brabandt
parent a2a2fe841e
commit 368ef5a48c
6 changed files with 875 additions and 174 deletions

View File

@@ -15,6 +15,8 @@ func Test_compiler()
set noshellslash
e Xfoo.pl
" Play nice with other tests.
defer setqflist([])
compiler perl
call assert_equal('perl', b:current_compiler)
call assert_fails('let g:current_compiler', 'E121:')
@@ -97,6 +99,7 @@ func s:SpotBugsParseFilterMakePrg(dirname, makeprg)
endif
let offset += 1 + strlen('-sourcepath')
let result.sourcepath = matchstr(strpart(a:makeprg, offset), '.\{-}\ze[ \t]')
let offset += 1 + strlen(result.sourcepath)
" Get the class file arguments, dropping the pathname prefix.
let offset = stridx(a:makeprg, a:dirname, offset)
@@ -146,7 +149,8 @@ func Test_compiler_spotbugs_makeprg()
" THE EXPECTED RESULTS.
let results = {}
let results['Xspotbugs/src/tests/𐌂1.java'] = {
\ 'sourcepath': '%:p:h:S',
\ 'Sourcepath': {-> fnamemodify('Xspotbugs/src/tests/𐌂1.java',
\ ':p:h:S')},
\ 'classfiles': sort([
\ 'Xspotbugs/tests/𐌂1$1.class',
\ 'Xspotbugs/tests/𐌂1$1𐌉𐌉1.class',
@@ -159,11 +163,12 @@ func Test_compiler_spotbugs_makeprg()
\ }
" No class file for an empty source file even with "-Xpkginfo:always".
let results['Xspotbugs/src/tests/package-info.java'] = {
\ 'sourcepath': '',
\ 'Sourcepath': {-> ''},
\ 'classfiles': [],
\ }
let results['Xspotbugs/src/tests/α/𐌂1.java'] = {
\ 'sourcepath': '%:p:h:h:S',
\ 'Sourcepath': {-> fnamemodify('Xspotbugs/src/tests/α/𐌂1.java',
\ ':p:h:h:S')},
\ 'classfiles': sort([
\ 'Xspotbugs/tests/α/𐌂1$1.class',
\ 'Xspotbugs/tests/α/𐌂1$1𐌉𐌉1.class',
@@ -175,11 +180,13 @@ func Test_compiler_spotbugs_makeprg()
\ 'Xspotbugs/tests/α/𐌂2.class']),
\ }
let results['Xspotbugs/src/tests/α/package-info.java'] = {
\ 'sourcepath': '%:p:h:S',
\ 'Sourcepath': {-> fnamemodify('Xspotbugs/src/tests/α/package-info.java',
\ ':p:h:S')},
\ 'classfiles': ['Xspotbugs/tests/α/package-info.class'],
\ }
let results['Xspotbugs/src/tests/α/β/𐌂1.java'] = {
\ 'sourcepath': '%:p:h:h:h:S',
\ 'Sourcepath': {-> fnamemodify('Xspotbugs/src/tests/α/β/𐌂1.java',
\ ':p:h:h:h:S')},
\ 'classfiles': sort([
\ 'Xspotbugs/tests/α/β/𐌂1$1.class',
\ 'Xspotbugs/tests/α/β/𐌂1$1𐌉𐌉1.class',
@@ -191,11 +198,13 @@ func Test_compiler_spotbugs_makeprg()
\ 'Xspotbugs/tests/α/β/𐌂2.class']),
\ }
let results['Xspotbugs/src/tests/α/β/package-info.java'] = {
\ 'sourcepath': '%:p:h:S',
\ 'Sourcepath': {-> fnamemodify('Xspotbugs/src/tests/α/β/package-info.java',
\ ':p:h:S')},
\ 'classfiles': ['Xspotbugs/tests/α/β/package-info.class'],
\ }
let results['Xspotbugs/src/tests/α/β/γ/𐌂1.java'] = {
\ 'sourcepath': '%:p:h:h:h:h:S',
\ 'Sourcepath': {-> fnamemodify('Xspotbugs/src/tests/α/β/γ/𐌂1.java',
\ ':p:h:h:h:h:S')},
\ 'classfiles': sort([
\ 'Xspotbugs/tests/α/β/γ/𐌂1$1.class',
\ 'Xspotbugs/tests/α/β/γ/𐌂1$1𐌉𐌉1.class',
@@ -207,11 +216,13 @@ func Test_compiler_spotbugs_makeprg()
\ 'Xspotbugs/tests/α/β/γ/𐌂2.class']),
\ }
let results['Xspotbugs/src/tests/α/β/γ/package-info.java'] = {
\ 'sourcepath': '%:p:h:S',
\ 'Sourcepath': {-> fnamemodify('Xspotbugs/src/tests/α/β/γ/package-info.java',
\ ':p:h:S')},
\ 'classfiles': ['Xspotbugs/tests/α/β/γ/package-info.class'],
\ }
let results['Xspotbugs/src/tests/α/β/γ/δ/𐌂1.java'] = {
\ 'sourcepath': '%:p:h:h:h:h:h:S',
\ 'Sourcepath': {-> fnamemodify('Xspotbugs/src/tests/α/β/γ/δ/𐌂1.java',
\ ':p:h:h:h:h:h:S')},
\ 'classfiles': sort([
\ 'Xspotbugs/tests/α/β/γ/δ/𐌂1$1.class',
\ 'Xspotbugs/tests/α/β/γ/δ/𐌂1$1𐌉𐌉1.class',
@@ -223,14 +234,15 @@ func Test_compiler_spotbugs_makeprg()
\ 'Xspotbugs/tests/α/β/γ/δ/𐌂2.class']),
\ }
let results['Xspotbugs/src/tests/α/β/γ/δ/package-info.java'] = {
\ 'sourcepath': '%:p:h:S',
\ 'Sourcepath': {-> fnamemodify('Xspotbugs/src/tests/α/β/γ/δ/package-info.java',
\ ':p:h:S')},
\ 'classfiles': ['Xspotbugs/tests/α/β/γ/δ/package-info.class'],
\ }
" MAKE CLASS FILES DISCOVERABLE!
let g:spotbugs_properties = {
\ 'sourceDirPath': 'src/tests',
\ 'classDirPath': 'tests',
\ 'sourceDirPath': ['src/tests'],
\ 'classDirPath': ['tests'],
\ }
call assert_true(has_key(s:SpotBugsParseFilterMakePrg('Xspotbugs', ''), 'sourcepath'))
@@ -255,20 +267,22 @@ func Test_compiler_spotbugs_makeprg()
let package_file = src_dir .. 'package-info.java'
call writefile([package], src_dir .. 'package-info.java')
for s in ['on', 'off']
" Note that using "off" for the first _outer_ iteration is preferable
" because only then "hlexists()" may be 0 (see "compiler/spotbugs.vim").
for s in ['off', 'on']
execute 'syntax ' .. s
execute 'edit ' .. type_file
compiler spotbugs
let result = s:SpotBugsParseFilterMakePrg('Xspotbugs', &l:makeprg)
call assert_equal(results[type_file].sourcepath, result.sourcepath)
call assert_equal(results[type_file].Sourcepath(), result.sourcepath)
call assert_equal(results[type_file].classfiles, result.classfiles)
bwipeout
execute 'edit ' .. package_file
compiler spotbugs
let result = s:SpotBugsParseFilterMakePrg('Xspotbugs', &l:makeprg)
call assert_equal(results[package_file].sourcepath, result.sourcepath)
call assert_equal(results[package_file].Sourcepath(), result.sourcepath)
call assert_equal(results[package_file].classfiles, result.classfiles)
bwipeout
endfor
@@ -277,4 +291,360 @@ func Test_compiler_spotbugs_makeprg()
let &shellslash = save_shellslash
endfunc
func s:SpotBugsBeforeFileTypeTryPluginAndClearCache(state)
" Ponder over "extend(spotbugs#DefaultProperties(), g:spotbugs_properties)"
" in "ftplugin/java.vim".
let g:spotbugs#state = a:state
runtime autoload/spotbugs.vim
endfunc
func Test_compiler_spotbugs_properties()
let save_shellslash = &shellslash
set shellslash
setlocal makeprg=
filetype plugin on
call assert_true(mkdir('Xspotbugs/src', 'pR'))
call assert_true(mkdir('Xspotbugs/tests', 'pR'))
let type_file = 'Xspotbugs/src/𐌄.java'
let test_file = 'Xspotbugs/tests/𐌄$.java'
call writefile(['enum 𐌄{}'], type_file)
call writefile(['class 𐌄${}'], test_file)
" TEST INTEGRATION WITH A BOGUS COMPILER PLUGIN.
if !filereadable($VIMRUNTIME .. '/compiler/foo.vim') && !executable('foo')
let g:spotbugs_properties = {'compiler': 'foo'}
" XXX: In case this "if" block is no longer first.
call s:SpotBugsBeforeFileTypeTryPluginAndClearCache({
\ 'compiler': g:spotbugs_properties.compiler,
\ })
execute 'edit ' .. type_file
call assert_equal('java', &l:filetype)
" This variable will indefinitely keep the compiler name.
call assert_equal('foo', g:spotbugs#state.compiler)
" The "compiler" entry should be gone after FileType and default entries
" should only appear for a supported compiler.
call assert_false(has_key(g:spotbugs_properties, 'compiler'))
call assert_true(empty(g:spotbugs_properties))
" Query default implementations.
call assert_true(exists('*spotbugs#DefaultProperties'))
call assert_true(exists('*spotbugs#DefaultPreCompilerAction'))
call assert_true(exists('*spotbugs#DefaultPreCompilerTestAction'))
call assert_true(empty(spotbugs#DefaultProperties()))
" Get a ":message".
redir => out
call spotbugs#DefaultPreCompilerAction()
redir END
call assert_equal('Not supported: "foo"', out[stridx(out, 'Not') :])
" Get a ":message".
redir => out
call spotbugs#DefaultPreCompilerTestAction()
redir END
call assert_equal('Not supported: "foo"', out[stridx(out, 'Not') :])
" No ":autocmd"s without one of "PreCompiler*Action", "PostCompilerAction".
call assert_false(exists('#java_spotbugs'))
bwipeout
endif
let s:spotbugs_results = {
\ 'preActionDone': 0,
\ 'preTestActionDone': 0,
\ 'preTestLocalActionDone': 0,
\ 'postActionDone': 0,
\ 'preCommandArguments': '',
\ 'preTestCommandArguments': '',
\ 'postCommandArguments': '',
\ }
defer execute('unlet s:spotbugs_results')
func! g:SpotBugsPreAction() abort
let s:spotbugs_results.preActionDone = 1
" XXX: Notify the spotbugs compiler about success or failure.
cc
endfunc
defer execute('delfunction g:SpotBugsPreAction')
func! g:SpotBugsPreTestAction() abort
let s:spotbugs_results.preTestActionDone = 1
" XXX: Let see compilation fail.
throw 'Oops'
endfunc
defer execute('delfunction g:SpotBugsPreTestAction')
func! g:SpotBugsPreTestLocalAction() abort
let s:spotbugs_results.preTestLocalActionDone = 1
" XXX: Notify the spotbugs compiler about success or failure.
cc
endfunc
defer execute('delfunction g:SpotBugsPreTestLocalAction')
func! g:SpotBugsPostAction() abort
let s:spotbugs_results.postActionDone = 1
endfunc
defer execute('delfunction g:SpotBugsPostAction')
func! g:SpotBugsPreCommand(arguments) abort
let s:spotbugs_results.preActionDone = 1
let s:spotbugs_results.preCommandArguments = a:arguments
" XXX: Notify the spotbugs compiler about success or failure.
cc
endfunc
defer execute('delfunction g:SpotBugsPreCommand')
func! g:SpotBugsPreTestCommand(arguments) abort
let s:spotbugs_results.preTestActionDone = 1
let s:spotbugs_results.preTestCommandArguments = a:arguments
" XXX: Notify the spotbugs compiler about success or failure.
cc
endfunc
defer execute('delfunction g:SpotBugsPreTestCommand')
func! g:SpotBugsPostCommand(arguments) abort
let s:spotbugs_results.postActionDone = 1
let s:spotbugs_results.postCommandArguments = a:arguments
endfunc
defer execute('delfunction g:SpotBugsPostCommand')
" TEST INTEGRATION WITH A SUPPORTED COMPILER PLUGIN.
if filereadable($VIMRUNTIME .. '/compiler/maven.vim')
if !executable('mvn')
if has('win32')
" This is what ":help executable()" suggests.
call writefile([], 'Xspotbugs/mvn.exe')
else
let $PATH = 'Xspotbugs:' .. $PATH
call writefile([], 'Xspotbugs/mvn')
call setfperm('Xspotbugs/mvn', 'rwx------')
endif
endif
let g:spotbugs_properties = {
\ 'compiler': 'maven',
\ 'PreCompilerAction': function('g:SpotBugsPreAction'),
\ 'PreCompilerTestAction': function('g:SpotBugsPreTestAction'),
\ 'PostCompilerAction': function('g:SpotBugsPostAction'),
\ }
" XXX: In case this is a runner-up ":edit".
call s:SpotBugsBeforeFileTypeTryPluginAndClearCache({
\ 'compiler': g:spotbugs_properties.compiler,
\ })
execute 'edit ' .. type_file
call assert_equal('java', &l:filetype)
call assert_equal('maven', g:spotbugs#state.compiler)
call assert_false(has_key(g:spotbugs_properties, 'compiler'))
call assert_false(empty(g:spotbugs_properties))
" Query default implementations.
call assert_true(exists('*spotbugs#DefaultProperties'))
call assert_equal(sort([
\ 'PreCompilerAction',
\ 'PreCompilerTestAction',
\ 'PostCompilerAction',
\ 'sourceDirPath',
\ 'classDirPath',
\ 'testSourceDirPath',
\ 'testClassDirPath',
\ ]),
\ sort(keys(spotbugs#DefaultProperties())))
" Some ":autocmd"s with one of "PreCompiler*Action", "PostCompilerAction".
call assert_true(exists('#java_spotbugs'))
call assert_true(exists('#java_spotbugs#Syntax'))
call assert_true(exists('#java_spotbugs#User'))
call assert_equal(2, exists(':SpotBugsDefineBufferAutocmd'))
SpotBugsDefineBufferAutocmd SigUSR1 User SigUSR1 User SigUSR1 User
call assert_true(exists('#java_spotbugs#SigUSR1'))
call assert_true(exists('#java_spotbugs#Syntax'))
call assert_true(exists('#java_spotbugs#User'))
call assert_equal(2, exists(':SpotBugsRemoveBufferAutocmd'))
SpotBugsRemoveBufferAutocmd SigUSR1 User SigUSR1 User UserGettingBored
call assert_false(exists('#java_spotbugs#SigUSR1'))
call assert_true(exists('#java_spotbugs#Syntax'))
call assert_true(exists('#java_spotbugs#User'))
let s:spotbugs_results.preActionDone = 0
let s:spotbugs_results.preTestActionDone = 0
let s:spotbugs_results.postActionDone = 0
doautocmd java_spotbugs Syntax
call assert_false(exists('#java_spotbugs#Syntax'))
" No match: "type_file !~# 'src/main/java'".
call assert_false(s:spotbugs_results.preActionDone)
" No match: "type_file !~# 'src/test/java'".
call assert_false(s:spotbugs_results.preTestActionDone)
" No pre-match, no post-action.
call assert_false(s:spotbugs_results.postActionDone)
" Without a match, confirm that ":compiler spotbugs" has NOT run.
call assert_true(empty(&l:makeprg))
let s:spotbugs_results.preActionDone = 0
let s:spotbugs_results.preTestActionDone = 0
let s:spotbugs_results.postActionDone = 0
" Update path entries. (Note that we cannot use just "src" because there
" is another "src" directory nearer the filesystem root directory, i.e.
" "vim/vim/src/testdir/Xspotbugs/src", and "s:DispatchAction()" (see
" "ftplugin/java.vim") will match "vim/vim/src/testdir/Xspotbugs/tests"
" against "src".)
let g:spotbugs_properties.sourceDirPath = ['Xspotbugs/src']
let g:spotbugs_properties.classDirPath = ['Xspotbugs/src']
let g:spotbugs_properties.testSourceDirPath = ['tests']
let g:spotbugs_properties.testClassDirPath = ['tests']
doautocmd java_spotbugs User
" No match: "type_file !~# 'src/main/java'" (with old "*DirPath" values
" cached).
call assert_false(s:spotbugs_results.preActionDone)
" No match: "type_file !~# 'src/test/java'" (with old "*DirPath" values
" cached).
call assert_false(s:spotbugs_results.preTestActionDone)
" No pre-match, no post-action.
call assert_false(s:spotbugs_results.postActionDone)
" Without a match, confirm that ":compiler spotbugs" has NOT run.
call assert_true(empty(&l:makeprg))
let s:spotbugs_results.preActionDone = 0
let s:spotbugs_results.preTestActionDone = 0
let s:spotbugs_results.postActionDone = 0
" XXX: Re-build ":autocmd"s from scratch with new values applied.
doautocmd FileType
call assert_true(exists('b:spotbugs_syntax_once'))
doautocmd java_spotbugs User
" A match: "type_file =~# 'Xspotbugs/src'" (with new "*DirPath" values
" cached).
call assert_true(s:spotbugs_results.preActionDone)
" No match: "type_file !~# 'tests'" (with new "*DirPath" values cached).
call assert_false(s:spotbugs_results.preTestActionDone)
" For a pre-match, a post-action.
call assert_true(s:spotbugs_results.postActionDone)
" With a match, confirm that ":compiler spotbugs" has run.
if has('win32')
call assert_match('^spotbugs\.bat\s', &l:makeprg)
else
call assert_match('^spotbugs\s', &l:makeprg)
endif
bwipeout
setlocal makeprg=
let s:spotbugs_results.preActionDone = 0
let s:spotbugs_results.preTestActionDone = 0
let s:spotbugs_results.preTestLocalActionDone = 0
let s:spotbugs_results.postActionDone = 0
execute 'edit ' .. test_file
" Prepare a buffer-local, incomplete variant of properties, relying on
" "ftplugin/java.vim" to take care of merging in unique entries, if any,
" from "g:spotbugs_properties".
let b:spotbugs_properties = {
\ 'PreCompilerTestAction': function('g:SpotBugsPreTestLocalAction'),
\ }
call assert_equal('java', &l:filetype)
call assert_true(exists('#java_spotbugs'))
call assert_true(exists('#java_spotbugs#Syntax'))
call assert_true(exists('#java_spotbugs#User'))
call assert_fails('doautocmd java_spotbugs Syntax', 'Oops')
call assert_false(exists('#java_spotbugs#Syntax'))
" No match: "test_file !~# 'Xspotbugs/src'".
call assert_false(s:spotbugs_results.preActionDone)
" A match: "test_file =~# 'tests'".
call assert_true(s:spotbugs_results.preTestActionDone)
call assert_false(s:spotbugs_results.preTestLocalActionDone)
" No action after pre-failure (the thrown "Oops" doesn't qualify for ":cc").
call assert_false(s:spotbugs_results.postActionDone)
" No ":compiler spotbugs" will be run after pre-failure.
call assert_true(empty(&l:makeprg))
let s:spotbugs_results.preActionDone = 0
let s:spotbugs_results.preTestActionDone = 0
let s:spotbugs_results.preTestLocalActionDone = 0
let s:spotbugs_results.postActionDone = 0
" XXX: Re-build ":autocmd"s from scratch with buffer-local values applied.
doautocmd FileType
call assert_true(exists('b:spotbugs_syntax_once'))
doautocmd java_spotbugs User
" No match: "test_file !~# 'Xspotbugs/src'".
call assert_false(s:spotbugs_results.preActionDone)
" A match: "test_file =~# 'tests'".
call assert_true(s:spotbugs_results.preTestLocalActionDone)
call assert_false(s:spotbugs_results.preTestActionDone)
" For a pre-match, a post-action.
call assert_true(s:spotbugs_results.postActionDone)
" With a match, confirm that ":compiler spotbugs" has run.
if has('win32')
call assert_match('^spotbugs\.bat\s', &l:makeprg)
else
call assert_match('^spotbugs\s', &l:makeprg)
endif
setlocal makeprg=
let s:spotbugs_results.preActionDone = 0
let s:spotbugs_results.preTestActionDone = 0
let s:spotbugs_results.preTestLocalActionDone = 0
let s:spotbugs_results.postActionDone = 0
let s:spotbugs_results.preCommandArguments = ''
let s:spotbugs_results.preTestCommandArguments = ''
let s:spotbugs_results.postCommandArguments = ''
" XXX: Compose the assigned "*Command"s with the default Maven "*Action"s.
let b:spotbugs_properties = {
\ 'compiler': 'maven',
\ 'DefaultPreCompilerTestCommand': function('g:SpotBugsPreTestCommand'),
\ 'DefaultPreCompilerCommand': function('g:SpotBugsPreCommand'),
\ 'DefaultPostCompilerCommand': function('g:SpotBugsPostCommand'),
\ 'sourceDirPath': ['Xspotbugs/src'],
\ 'classDirPath': ['Xspotbugs/src'],
\ 'testSourceDirPath': ['tests'],
\ 'testClassDirPath': ['tests'],
\ }
unlet g:spotbugs_properties
" XXX: Re-build ":autocmd"s from scratch with buffer-local values applied.
call s:SpotBugsBeforeFileTypeTryPluginAndClearCache({
\ 'compiler': b:spotbugs_properties.compiler,
\ 'commands': {
\ 'DefaultPreCompilerTestCommand':
\ b:spotbugs_properties.DefaultPreCompilerTestCommand,
\ 'DefaultPreCompilerCommand':
\ b:spotbugs_properties.DefaultPreCompilerCommand,
\ 'DefaultPostCompilerCommand':
\ b:spotbugs_properties.DefaultPostCompilerCommand,
\ },
\ })
doautocmd FileType
call assert_equal('maven', g:spotbugs#state.compiler)
call assert_equal(sort([
\ 'DefaultPreCompilerTestCommand',
\ 'DefaultPreCompilerCommand',
\ 'DefaultPostCompilerCommand',
\ ]),
\ sort(keys(g:spotbugs#state.commands)))
call assert_true(exists('b:spotbugs_syntax_once'))
doautocmd java_spotbugs User
" No match: "test_file !~# 'Xspotbugs/src'".
call assert_false(s:spotbugs_results.preActionDone)
call assert_true(empty(s:spotbugs_results.preCommandArguments))
" A match: "test_file =~# 'tests'".
call assert_true(s:spotbugs_results.preTestActionDone)
call assert_equal('test-compile', s:spotbugs_results.preTestCommandArguments)
" For a pre-match, a post-action.
call assert_true(s:spotbugs_results.postActionDone)
call assert_equal('%:S', s:spotbugs_results.postCommandArguments)
" With a match, confirm that ":compiler spotbugs" has run.
if has('win32')
call assert_match('^spotbugs\.bat\s', &l:makeprg)
else
call assert_match('^spotbugs\s', &l:makeprg)
endif
bwipeout
setlocal makeprg=
endif
filetype plugin off
setlocal makeprg=
let &shellslash = save_shellslash
endfunc
" vim: shiftwidth=2 sts=2 expandtab