mirror of
https://github.com/dense-analysis/ale.git
synced 2026-03-04 22:31:32 +08:00
tests
This commit is contained in:
27
test/fixers/test_dhall_format_fixer_callback.vader
Normal file
27
test/fixers/test_dhall_format_fixer_callback.vader
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
Before:
|
||||||
|
Save g:ale_dhall_executable
|
||||||
|
Save g:ale_dhall_options
|
||||||
|
|
||||||
|
" Use an invalid global executable, so we don’t match it.
|
||||||
|
let g:ale_dhall_executable = 'odd-dhall'
|
||||||
|
let g:ale_dhall_options = '--ascii'
|
||||||
|
|
||||||
|
call ale#test#SetDirectory('/testplugin/test/dhall')
|
||||||
|
|
||||||
|
After:
|
||||||
|
Restore
|
||||||
|
|
||||||
|
call ale#test#RestoreDirectory()
|
||||||
|
|
||||||
|
Execute(The dhall-format callback should return the correct options):
|
||||||
|
call ale#test#SetFilename('../dhall_files/testfile.dhall')
|
||||||
|
|
||||||
|
AssertEqual
|
||||||
|
\ {
|
||||||
|
\ 'command': ale#Escape('odd-dhall')
|
||||||
|
\ . ' --ascii'
|
||||||
|
\ . ' format'
|
||||||
|
\ . ' --inplace %t',
|
||||||
|
\ 'read_temporary_file': 1,
|
||||||
|
\ },
|
||||||
|
\ ale#fixers#dhall_format#Fix(bufnr(''))
|
||||||
29
test/fixers/test_dhall_freeze_fixer_callback.vader
Normal file
29
test/fixers/test_dhall_freeze_fixer_callback.vader
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
Before:
|
||||||
|
Save g:ale_dhall_executable
|
||||||
|
Save g:ale_dhall_options
|
||||||
|
|
||||||
|
" Use an invalid global executable, so we don’t match it.
|
||||||
|
let g:ale_dhall_executable = 'odd-dhall'
|
||||||
|
let g:ale_dhall_options = '--ascii'
|
||||||
|
let g:ale_dhall_freeze_options = '--all'
|
||||||
|
|
||||||
|
call ale#test#SetDirectory('/testplugin/test/dhall')
|
||||||
|
|
||||||
|
After:
|
||||||
|
Restore
|
||||||
|
|
||||||
|
call ale#test#RestoreDirectory()
|
||||||
|
|
||||||
|
Execute(The dhall-freeze callback should return the correct options):
|
||||||
|
call ale#test#SetFilename('../dhall_files/testfile.dhall')
|
||||||
|
|
||||||
|
AssertEqual
|
||||||
|
\ {
|
||||||
|
\ 'command': ale#Escape('odd-dhall')
|
||||||
|
\ . ' --ascii'
|
||||||
|
\ . ' freeze'
|
||||||
|
\ . ' --all'
|
||||||
|
\ . ' --inplace %t',
|
||||||
|
\ 'read_temporary_file': 1,
|
||||||
|
\ },
|
||||||
|
\ ale#fixers#dhall_freeze#Freeze(bufnr(''))
|
||||||
27
test/fixers/test_dhall_lint_fixer_callback.vader
Normal file
27
test/fixers/test_dhall_lint_fixer_callback.vader
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
Before:
|
||||||
|
Save g:ale_dhall_executable
|
||||||
|
Save g:ale_dhall_options
|
||||||
|
|
||||||
|
" Use an invalid global executable, so we don’t match it.
|
||||||
|
let g:ale_dhall_executable = 'odd-dhall'
|
||||||
|
let g:ale_dhall_options = '--ascii'
|
||||||
|
|
||||||
|
call ale#test#SetDirectory('/testplugin/test/dhall')
|
||||||
|
|
||||||
|
After:
|
||||||
|
Restore
|
||||||
|
|
||||||
|
call ale#test#RestoreDirectory()
|
||||||
|
|
||||||
|
Execute(The dhall-lint callback should return the correct options):
|
||||||
|
call ale#test#SetFilename('../dhall_files/testfile.dhall')
|
||||||
|
|
||||||
|
AssertEqual
|
||||||
|
\ {
|
||||||
|
\ 'command': ale#Escape('odd-dhall')
|
||||||
|
\ . ' --ascii'
|
||||||
|
\ . ' lint'
|
||||||
|
\ . ' --inplace %t',
|
||||||
|
\ 'read_temporary_file': 1,
|
||||||
|
\ },
|
||||||
|
\ ale#fixers#dhall_lint#Fix(bufnr(''))
|
||||||
Reference in New Issue
Block a user