summaryrefslogtreecommitdiff
path: root/test/test_ale_var.vader
blob: 5f42fe95f53839badd266c753399c4da4138412d (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
Before:
  let g:ale_some_variable = 'abc'

After:
  unlet! g:ale_some_variable
  unlet! b:undefined_variable_name

  let g:ale_fix_buffer_data = {}

Execute(ale#Var should return global variables):
  AssertEqual 'abc', ale#Var(bufnr(''), 'some_variable')

Execute(ale#Var should return buffer overrides):
  let b:ale_some_variable = 'def'

  AssertEqual 'def', ale#Var(bufnr(''), 'some_variable')

Execute(ale#Var should return buffer overrides for buffer numbers as strings):
  let b:ale_some_variable = 'def'

  AssertEqual 'def', ale#Var(string(bufnr('')), 'some_variable')

Execute(ale#Var should throw exceptions for undefined variables):
  let b:undefined_variable_name = 'def'

  AssertThrows call ale#Var(bufnr(''), 'undefined_variable_name')

Execute(ale#Var return variables from deleted buffers, saved for fixing things):
  let g:ale_fix_buffer_data[1347347] = {'vars': {'ale_some_variable': 'def'}}

  AssertEqual 'def', ale#Var(1347347, 'some_variable')

Execute(ale#Var should return the global variable for unknown variables):
  let g:ale_fix_buffer_data = {}

  AssertEqual 'abc', ale#Var(1347347, 'some_variable')