From c11d2ae375399ea935e3c2e36e812e8a727ffd99 Mon Sep 17 00:00:00 2001 From: w0rp Date: Sun, 10 Sep 2017 00:20:05 +0100 Subject: [PATCH] Fix an SML variable init bug, and get the SML cm file tests to pass on Windows --- ale_linters/sml/smlnj_cm.vim | 6 ------ autoload/ale/handlers/sml.vim | 5 +++++ test/test_sml_command.vader | 14 ++++++-------- 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 " 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 " 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')