diff options
author | Eddie Lebow <elebow@users.noreply.github.com> | 2019-11-23 00:06:03 -0500 |
---|---|---|
committer | Eddie Lebow <elebow@users.noreply.github.com> | 2019-11-23 00:34:40 -0500 |
commit | 1997a8f7e22a930e3d47b61a7f9ab948d04f2b92 (patch) | |
tree | 5d9e976f8bb58f47793da920f0d7f6c36aab9eae /test/test_shell_detection.vader | |
parent | b91d82bfaa395bb86b3ea51f63cc8cef05e90f98 (diff) | |
download | ale-1997a8f7e22a930e3d47b61a7f9ab948d04f2b92.zip |
ShellDetect: fall back to filetype if no hashbang
Some files lack a hashbang line but still have an unambiguous filetype.
For example, the file `.zshrc` has the filetype `zsh`.
Augment ale#handlers#sh#GetShellType to fall back to the filetype if
no hashbang line can be found.
Diffstat (limited to 'test/test_shell_detection.vader')
-rw-r--r-- | test/test_shell_detection.vader | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/test_shell_detection.vader b/test/test_shell_detection.vader index 88ee462d..b0b38aad 100644 --- a/test/test_shell_detection.vader +++ b/test/test_shell_detection.vader @@ -98,6 +98,16 @@ Execute(The ksh dialect should be used for shellcheck if b:is_kornshell is 1): AssertEqual 'ksh', ale_linters#sh#shellcheck#GetDialectArgument(bufnr('')) +Execute(The filetype should be used as the default shell type when there is no hashbang line): + set filetype=zsh + AssertEqual 'zsh', ale#handlers#sh#GetShellType(bufnr('')) + + set filetype=tcsh + AssertEqual 'tcsh', ale#handlers#sh#GetShellType(bufnr('')) + + set filetype=python + AssertEqual '', ale#handlers#sh#GetShellType(bufnr('')) + Given(A file with /bin/ash): #!/bin/ash |