Files
ale/test/linter/test_tex_chktex.vader
T
Cyril RoelandtandGitHub 94a8a88f0d chktex: always use the right format and grab the error code (#5146)
Using -v0 works out of the box, but chktex grabs the "v0 format" from
its configuration file:

    OutFormat
    {
        # -v0; silent mode
        %f%b%l%b%c%b%n%b%m!n
        # -v1; normal mode
        ...
    }

Should the user modify the definition of v0, then the linter would no
longer work. We therefore use "--format" to force the output format.

Also grab the error code so it is correctly displayed.

Closes: #3856
2026-07-25 22:24:26 +09:00

51 lines
1.4 KiB
Plaintext

Before:
call ale#assert#SetUpLinterTest('tex', 'chktex')
GivenCommandOutput ['ChkTeX v1.7.6 - Copyright 1995-96 Jens T. Berger Thielemann']
After:
call ale#assert#TearDownLinterTest()
Execute(The default command should be correct):
AssertLinter 'chktex', [
\ ale#Escape('chktex') . ' --version',
\ ale#Escape('chktex')
\ . " --format $'%f%b%l%b%c%b%n%b%m\n' -p stdin -q"
\ . ' -I',
\]
" The version check should be cached.
GivenCommandOutput []
AssertLinter 'chktex', [
\ ale#Escape('chktex')
\ . " --format $'%f%b%l%b%c%b%n%b%m\n' -p stdin -q"
\ . ' -I',
\]
" Try newer version
call ale#semver#ResetVersionCache()
GivenCommandOutput ['ChkTeX v1.7.8 - Copyright 1995-96 Jens T. Berger Thielemann']
AssertLinter 'chktex', [
\ ale#Escape('chktex') . ' --version',
\ ale#Escape('chktex')
\ . " --format $'%f%b%l%b%c%b%n%b%m\n' -p stdin -q"
\ . ' -S TabSize=1'
\ . ' -I',
\]
Execute(The executable should be configurable):
let g:ale_tex_chktex_executable = 'bin/foo'
AssertLinter 'bin/foo',
\ ale#Escape('bin/foo')
\ . " --format $'%f%b%l%b%c%b%n%b%m\n' -p stdin -q"
\ . ' -I'
Execute(The options should be configurable):
let b:ale_tex_chktex_options = '--something'
AssertLinter 'chktex',
\ ale#Escape('chktex')
\ . " --format $'%f%b%l%b%c%b%n%b%m\n' -p stdin -q"
\ . ' --something'