install.fairie/dotfiles/.vim/plugged/ale/test/fixers/test_fixjson_fixer_callback.vader
Git E2E Dev Test Username e149692cc9 git subrepo clone https://github.com/dense-analysis/ale.git ./dotfiles/.vim/plugged/ale
subrepo:
  subdir:   "dotfiles/.vim/plugged/ale"
  merged:   "e4b205440"
upstream:
  origin:   "https://github.com/dense-analysis/ale.git"
  branch:   "master"
  commit:   "e4b205440"
git-subrepo:
  version:  "0.4.3"
  origin:   "???"
  commit:   "???"
2022-10-18 10:37:09 -04:00

50 lines
1.2 KiB
Text

Before:
Save g:ale_json_fixjson_executable
Save g:ale_json_fixjson_options
let g:ale_json_fixjson_executable = '/path/to/fixjson'
let g:ale_json_fixjson_options = ''
call ale#test#SetDirectory('/testplugin/test/fixers')
After:
Restore
Execute(The fixjson callback should return the correct default command):
AssertEqual
\ {
\ 'command': ale#Escape('/path/to/fixjson')
\ . ' --stdin-filename '
\ . ale#Escape(bufname(bufnr('')))
\ },
\ ale#fixers#fixjson#Fix(bufnr(''))
Execute(The fixjson callback should set the buffer name as file name):
call ale#test#SetFilename('../test-files/json/testfile.json')
AssertEqual
\ {
\ 'command': ale#Escape('/path/to/fixjson')
\ . ' --stdin-filename '
\ . ale#Escape(bufname(bufnr('')))
\ },
\ ale#fixers#fixjson#Fix(bufnr(''))
AssertNotEqual
\ stridx(
\ ale#fixers#fixjson#Fix(bufnr('')).command,
\ 'testfile.json',
\ ),
\ -1
Execute(The fixjson callback should include additional options):
let g:ale_json_fixjson_options = '-i 2'
AssertEqual
\ {
\ 'command': ale#Escape('/path/to/fixjson')
\ . ' --stdin-filename '
\ . ale#Escape(bufname(bufnr('')))
\ . ' -i 2'
\ },
\ ale#fixers#fixjson#Fix(bufnr(''))