summaryrefslogtreecommitdiff
path: root/test/test_cursor_warnings.vader
blob: 364db4bc65ecd5c636784a31caed41352aaae69a (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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
Before:
  let g:ale_buffer_loclist_map = {
  \ bufnr('%'): [
  \   {
  \     'lnum': 1,
  \     'bufnr': bufnr('%'),
  \     'vcol': 0,
  \     'linter_name': 'eslint',
  \     'nr': -1,
  \     'type': 'E',
  \     'col': 10,
  \     'text': 'Missing semicolon. (semi)'
  \   },
  \   {
  \       'lnum': 2,
  \       'bufnr': bufnr('%'),
  \       'vcol': 0,
  \       'linter_name': 'eslint',
  \       'nr': -1,
  \       'type': 'W',
  \       'col': 10,
  \       'text': 'Infix operators must be spaced. (space-infix-ops)'
  \   },
  \   {
  \       'lnum': 2,
  \       'bufnr': bufnr('%'),
  \       'vcol': 0,
  \       'linter_name': 'eslint',
  \       'nr': -1,
  \       'type': 'E',
  \       'col': 15,
  \       'text': 'Missing radix parameter (radix)'
  \   }
  \ ],
  \}

After:
  unlet! g:output
  unlet! g:lines
  let g:ale_buffer_loclist_map = {}

Given javascript(A Javscript file with warnings/errors):
  var x = 3
  var x = 5*2 + parseInt("10");

Execute(Evaluate the cursor function at line 1):
  :1
  call ale#cursor#EchoCursorWarning()

Then(Check the cursor output):
  redir => g:output
    :mess
  redir END

  let g:lines = split(g:output, "\n")

  AssertEqual 'Missing semicolon. (semi)', g:lines[-1]

Execute(Evaluate the cursor function at line 2):
  :2
  call ale#cursor#EchoCursorWarning()

Then(Check the cursor output):
  redir => g:output
    :mess
  redir END

  let g:lines = split(g:output, "\n")

  AssertEqual 'Infix operators must be spaced. (space-infix-ops)', g:lines[-1]

Execute(Evaluate the cursor function later in line 2):
  :2
  normal 16l
  call ale#cursor#EchoCursorWarning()

Then(Check the cursor output):
  redir => g:output
    :mess
  redir END

  let g:lines = split(g:output, "\n")

  AssertEqual 'Missing radix parameter (radix)', g:lines[-1]