summaryrefslogtreecommitdiff
path: root/test/handler/test_idris_handler.vader
blob: 6a032ea6d5ab5932f48f46d8325694b59d339269 (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
Before:
  Save $TMPDIR

  " Set TMPDIR so the temporary file checks work.
  let $TMPDIR = '/tmp'

  runtime ale_linters/idris/idris.vim

After:
  Restore

  call ale#linter#Reset()

Execute(The idris handler should parse messages that reference a single column):
  if has('win32')
    call ale#test#SetFilename($TEMP . '\foo.idr')
  else
    call ale#test#SetFilename('/tmp/foo.idr')
  endif

  AssertEqual
  \ [
  \   {
  \     'lnum': 4,
  \     'col': 5,
  \     'type': 'E',
  \     'text': 'When checking right hand side of main with expected type IO () When checking an application of function Prelude.Monad.>>=: Type mismatch between IO () (Type of putStrLn _) and _ -> _ (Is putStrLn _ applied to too many arguments?) Specifically: Type mismatch between IO and \uv => _ -> uv'
  \   }
  \ ],
  \ ale_linters#idris#idris#Handle(bufnr(''), [
  \   expand('%:p') . ':4:5:',
  \   'When checking right hand side of main with expected type',
  \   '        IO ()',
  \   '',
  \   'When checking an application of function Prelude.Monad.>>=:',
  \   '        Type mismatch between',
  \   '                IO () (Type of putStrLn _)',
  \   '        and',
  \   '                _ -> _ (Is putStrLn _ applied to too many arguments?)',
  \   '',
  \   '        Specifically:',
  \   '                Type mismatch between',
  \   '                        IO',
  \   '                and',
  \   '                        \uv => _ -> uv',
  \ ])

Execute(The idris handler should parse messages that reference a column range):
  call ale#test#SetFilename('/tmp/foo.idr')

  AssertEqual
  \ [
  \   {
  \     'lnum': 11,
  \     'col': 11,
  \     'type': 'E',
  \     'text': 'When checking right hand side of Main.case block in main at /tmp/foo.idr:10:10 with expected type IO () Last statement in do block must be an expression'
  \   }
  \ ],
  \ ale_linters#idris#idris#Handle(bufnr(''), [
  \   expand('%:p') . ':11:11-13:',
  \   'When checking right hand side of Main.case block in main at /tmp/foo.idr:10:10 with expected type',
  \   '        IO ()',
  \   '',
  \   'Last statement in do block must be an expression',
  \ ])