summaryrefslogtreecommitdiff
path: root/test/fixers/test_dartfmt_fixer_callback.vader
blob: c783c9a445b5c69433a1d8d1b34e48d1c09efc27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
Before:
  Save g:ale_dart_dartfmt_executable
  Save g:ale_dart_dartfmt_options

  " Use an invalid global executable, so we don't match it.
  let g:ale_dart_dartfmt_executable = 'xxxinvalid'
  let g:ale_dart_dartfmt_options = ''

  call ale#test#SetDirectory('/testplugin/test/fixers')

After:
  Restore

  call ale#test#RestoreDirectory()

Execute(The dartfmt callback should return the correct default values):
  call ale#test#SetFilename('../test-files/dart/testfile.dart')

  AssertEqual
  \ {
  \   'read_temporary_file': 1,
  \   'command': ale#Escape('xxxinvalid')
  \     . ' -w'
  \     . ' %t',
  \ },
  \ ale#fixers#dartfmt#Fix(bufnr(''))

Execute(The dartfmt callback should include custom dartfmt options):
  let g:ale_dart_dartfmt_options = "-l 80"
  call ale#test#SetFilename('../test-files/dart/testfile.dart')

  AssertEqual
  \ {
  \   'read_temporary_file': 1,
  \   'command': ale#Escape('xxxinvalid')
  \     . ' -w'
  \     . ' ' . g:ale_dart_dartfmt_options
  \     . ' %t',
  \ },
  \ ale#fixers#dartfmt#Fix(bufnr(''))