2017-04-15 23:16:48 +00:00
|
|
|
Before:
|
|
|
|
let g:ale_some_variable = 'abc'
|
|
|
|
|
|
|
|
After:
|
|
|
|
unlet! g:ale_some_variable
|
2017-05-30 21:15:24 +00:00
|
|
|
unlet! b:undefined_variable_name
|
|
|
|
|
|
|
|
let g:ale_fix_buffer_data = {}
|
2017-04-15 23:16:48 +00:00
|
|
|
|
|
|
|
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')
|
|
|
|
|
2017-04-26 23:15:16 +00:00
|
|
|
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')
|
|
|
|
|
2017-04-15 23:16:48 +00:00
|
|
|
Execute(ale#Var should throw exceptions for undefined variables):
|
2017-05-30 21:15:24 +00:00
|
|
|
let b:undefined_variable_name = 'def'
|
|
|
|
|
2017-04-15 23:16:48 +00:00
|
|
|
AssertThrows call ale#Var(bufnr(''), 'undefined_variable_name')
|
2017-05-30 21:15:24 +00:00
|
|
|
|
|
|
|
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')
|
|
|
|
|
|
|
|
Execute(ale#Var should return the global variables when the ALE fix variable is undefined):
|
|
|
|
unlet! g:ale_fix_buffer_data
|
|
|
|
|
|
|
|
AssertEqual 'abc', ale#Var(1347347, 'some_variable')
|