]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/ale/test/linter/test_hdl_checker_options.vader

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Do not set EDITOR/VISUAL for shell
[etc/vim.git] / .vim / bundle / ale / test / linter / test_hdl_checker_options.vader
1 Before:
2   call ale#assert#SetUpLinterTest('vhdl', 'hdl_checker')
3
4   Save g:ale_hdl_checker_executable
5   Save g:ale_hdl_checker_config_file
6   Save g:ale_hdl_checker_options
7
8   let g:default_config_file = has('unix') ? '.hdl_checker.config' : '_hdl_checker.config'
9
10   runtime autoload/ale/handlers/hdl_checker.vim
11
12 After:
13   Restore
14
15   call ale#assert#TearDownLinterTest()
16
17   unlet! g:default_config_file
18   unlet! g:call_count
19
20   runtime autoload/ale/handlers/hdl_checker.vim
21
22 Execute(Get default initialization dict):
23   AssertEqual
24   \ {'project_file': g:default_config_file},
25   \ ale#handlers#hdl_checker#GetInitOptions(bufnr(''))
26
27 Execute(Get custom initialization dict):
28   let g:ale_hdl_checker_config_file = 'some_file_name'
29
30   AssertEqual
31   \ {'project_file': 'some_file_name'},
32   \ ale#handlers#hdl_checker#GetInitOptions(bufnr(''))
33
34 Execute(Get the checker command without extra user parameters):
35   AssertEqual
36   \ ale#Escape('hdl_checker') . ' --lsp',
37   \ ale#handlers#hdl_checker#GetCommand(bufnr(''))
38
39 Execute(Get the checker command with user configured parameters):
40   let g:ale_hdl_checker_options = '--log-level DEBUG'
41
42   AssertEqual
43   \ ale#Escape('hdl_checker') . ' --lsp --log-level DEBUG',
44   \ ale#handlers#hdl_checker#GetCommand(bufnr(''))
45
46 Execute(Customize executable):
47   let g:ale_hdl_checker_executable = '/some/other/path'
48   AssertEqual
49   \ ale#Escape('/some/other/path') . ' --lsp',
50   \ ale#handlers#hdl_checker#GetCommand(bufnr(''))
51
52 Execute(Get project root based on .git):
53   call ale#test#SetFilename('../test-files/hdl_server/with_git/files/foo.vhd')
54   " Create .git file
55   silent! call mkdir(g:dir . '/../test-files/hdl_server/with_git/.git')
56   AssertNotEqual '', glob(g:dir . '/../test-files/hdl_server/with_git/.git')
57
58   AssertEqual
59   \ ale#path#Simplify(g:dir . '/../test-files/hdl_server/with_git'),
60   \ ale#handlers#hdl_checker#GetProjectRoot(bufnr(''))
61
62 Execute(Get project root based on config file):
63   call ale#test#SetFilename('../test-files/hdl_server/with_config_file/foo.vhd')
64
65   AssertEqual
66   \ ale#path#Simplify(g:dir . '/../test-files/hdl_server/with_config_file'),
67   \ ale#handlers#hdl_checker#GetProjectRoot(bufnr(''))
68
69 Execute(Return no project root if neither .git or config file are found):
70   let g:call_count = 0
71
72   " Mock this command to avoid the test to find ale's own .git folder
73   function! ale#handlers#hdl_checker#IsDotGit(path) abort
74     let g:call_count += 1
75     return 0
76   endfunction
77
78   call ale#test#SetFilename('../test-files/hdl_server/foo.vhd')
79
80   AssertEqual
81   \ '',
82   \ ale#handlers#hdl_checker#GetProjectRoot(bufnr(''))
83
84   AssertEqual g:call_count, 1
85
86   unlet! g:call_count