File: test_filetype_mapping.vader

package info (click to toggle)
vim-ale 3.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 8,408 kB
  • sloc: sh: 497; python: 311; perl: 31; makefile: 4; javascript: 1
file content (29 lines) | stat: -rw-r--r-- 982 bytes parent folder | download | duplicates (2)
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
Before:
    augroup TestFiletypeGroup
        autocmd!
        autocmd BufEnter,BufRead *.x setf xfiletype
        autocmd BufEnter,BufRead *.y set filetype=yfiletype
        autocmd BufEnter,BufRead *.z setlocal filetype=zfiletype
        autocmd BufEnter,BufRead *.jsx set filetype=javascript.jsx
    augroup END

After:
  unlet! g:map
  augroup TestFiletypeGroup
      autocmd!
  augroup END
  augroup! TestFiletypeGroup

Execute(ALE should parse autocmd filetypes correctly):
  let g:map = ale#filetypes#LoadExtensionMap()

  AssertEqual '.x', g:map['xfiletype']
  AssertEqual '.y', g:map['yfiletype']
  AssertEqual '.z', g:map['zfiletype']
  AssertEqual '.jsx', g:map['javascript.jsx']

Execute(ALE should guess file extensions appropriately):
  " The whole string should be used, if there's a match.
  AssertEqual '.jsx', ale#filetypes#GuessExtension('javascript.jsx')
  " The first part should be used.
  AssertEqual '.x', ale#filetypes#GuessExtension('xfiletype.yfiletype')