summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-09-10 00:20:05 +0100
committerw0rp <devw0rp@gmail.com>2017-09-10 00:20:05 +0100
commitc11d2ae375399ea935e3c2e36e812e8a727ffd99 (patch)
tree965088380bf815db8e8894613f3f5c6a35b5ea73
parent1a52a2b8804c0aa8e3c061225ccba47a23d3999e (diff)
downloadale-c11d2ae375399ea935e3c2e36e812e8a727ffd99.zip
Fix an SML variable init bug, and get the SML cm file tests to pass on Windows
-rw-r--r--ale_linters/sml/smlnj_cm.vim6
-rw-r--r--autoload/ale/handlers/sml.vim5
-rw-r--r--test/test_sml_command.vader14
3 files changed, 11 insertions, 14 deletions
diff --git a/ale_linters/sml/smlnj_cm.vim b/ale_linters/sml/smlnj_cm.vim
index 93cee63c..96cd7bd9 100644
--- a/ale_linters/sml/smlnj_cm.vim
+++ b/ale_linters/sml/smlnj_cm.vim
@@ -1,12 +1,6 @@
" Author: Jake Zimmerman <jake@zimmerman.io>
" Description: SML checking with SML/NJ Compilation Manager
-" Let user manually set the CM file (in case our search for a CM file is
-" ambiguous and picks the wrong one)
-"
-" See :help ale-sml-smlnj for more information.
-call ale#Set('sml_smlnj_cm_file', '*.cm')
-
function! ale_linters#sml#smlnj_cm#GetCommand(buffer) abort
let l:cmfile = ale#handlers#sml#GetCmFile(a:buffer)
return 'sml -m ' . l:cmfile . ' < /dev/null'
diff --git a/autoload/ale/handlers/sml.vim b/autoload/ale/handlers/sml.vim
index 822a2eff..377eade5 100644
--- a/autoload/ale/handlers/sml.vim
+++ b/autoload/ale/handlers/sml.vim
@@ -1,6 +1,11 @@
" Author: Jake Zimmerman <jake@zimmerman.io>
" Description: Shared functions for SML linters
+" The glob to use for finding the .cm file.
+"
+" See :help ale-sml-smlnj for more information.
+call ale#Set('sml_smlnj_cm_file', '*.cm')
+
function! ale#handlers#sml#GetCmFile(buffer) abort
let l:pattern = ale#Var(a:buffer, 'sml_smlnj_cm_file')
let l:as_list = 1
diff --git a/test/test_sml_command.vader b/test/test_sml_command.vader
index 5ce8a313..2db2552c 100644
--- a/test/test_sml_command.vader
+++ b/test/test_sml_command.vader
@@ -1,31 +1,29 @@
Before:
- runtime ale_linters/sml/sml.vim
- runtime ale_linters/sml/smlnj.vim
call ale#test#SetDirectory('/testplugin/test')
After:
call ale#test#RestoreDirectory()
call ale#linter#Reset()
-# ----- GetCmFile -----
-
Execute(smlnj finds CM file if it exists):
call ale#test#SetFilename('smlnj/cm/foo.sml')
- AssertEqual '/testplugin/test/smlnj/cm/sources.cm', ale#handlers#sml#GetCmFile(bufnr('%'))
+ AssertEqual
+ \ ale#path#Winify(g:dir . '/smlnj/cm/sources.cm'),
+ \ ale#handlers#sml#GetCmFile(bufnr('%'))
Execute(smlnj finds CM file by searching upwards):
call ale#test#SetFilename('smlnj/cm/path/to/bar.sml')
- AssertEqual '/testplugin/test/smlnj/cm/sources.cm', ale#handlers#sml#GetCmFile(bufnr('%'))
+ AssertEqual
+ \ ale#path#Winify(g:dir . '/smlnj/cm/sources.cm'),
+ \ ale#handlers#sml#GetCmFile(bufnr('%'))
Execute(smlnj returns '' when no CM file found):
call ale#test#SetFilename('smlnj/file/qux.sml')
AssertEqual '', ale#handlers#sml#GetCmFile(bufnr('%'))
-# ----- GetExecutableSmlnjCm & GetExecutableSmlnjFile -----
-
Execute(CM-project mode enabled when CM file found):
call ale#test#SetFilename('smlnj/cm/foo.sml')