Fix an SML variable init bug, and get the SML cm file tests to pass on Windows
This commit is contained in:
parent
1a52a2b880
commit
c11d2ae375
@ -1,12 +1,6 @@
|
|||||||
" Author: Jake Zimmerman <jake@zimmerman.io>
|
" Author: Jake Zimmerman <jake@zimmerman.io>
|
||||||
" Description: SML checking with SML/NJ Compilation Manager
|
" 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
|
function! ale_linters#sml#smlnj_cm#GetCommand(buffer) abort
|
||||||
let l:cmfile = ale#handlers#sml#GetCmFile(a:buffer)
|
let l:cmfile = ale#handlers#sml#GetCmFile(a:buffer)
|
||||||
return 'sml -m ' . l:cmfile . ' < /dev/null'
|
return 'sml -m ' . l:cmfile . ' < /dev/null'
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
" Author: Jake Zimmerman <jake@zimmerman.io>
|
" Author: Jake Zimmerman <jake@zimmerman.io>
|
||||||
" Description: Shared functions for SML linters
|
" 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
|
function! ale#handlers#sml#GetCmFile(buffer) abort
|
||||||
let l:pattern = ale#Var(a:buffer, 'sml_smlnj_cm_file')
|
let l:pattern = ale#Var(a:buffer, 'sml_smlnj_cm_file')
|
||||||
let l:as_list = 1
|
let l:as_list = 1
|
||||||
|
@ -1,31 +1,29 @@
|
|||||||
Before:
|
Before:
|
||||||
runtime ale_linters/sml/sml.vim
|
|
||||||
runtime ale_linters/sml/smlnj.vim
|
|
||||||
call ale#test#SetDirectory('/testplugin/test')
|
call ale#test#SetDirectory('/testplugin/test')
|
||||||
|
|
||||||
After:
|
After:
|
||||||
call ale#test#RestoreDirectory()
|
call ale#test#RestoreDirectory()
|
||||||
call ale#linter#Reset()
|
call ale#linter#Reset()
|
||||||
|
|
||||||
# ----- GetCmFile -----
|
|
||||||
|
|
||||||
Execute(smlnj finds CM file if it exists):
|
Execute(smlnj finds CM file if it exists):
|
||||||
call ale#test#SetFilename('smlnj/cm/foo.sml')
|
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):
|
Execute(smlnj finds CM file by searching upwards):
|
||||||
call ale#test#SetFilename('smlnj/cm/path/to/bar.sml')
|
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):
|
Execute(smlnj returns '' when no CM file found):
|
||||||
call ale#test#SetFilename('smlnj/file/qux.sml')
|
call ale#test#SetFilename('smlnj/file/qux.sml')
|
||||||
|
|
||||||
AssertEqual '', ale#handlers#sml#GetCmFile(bufnr('%'))
|
AssertEqual '', ale#handlers#sml#GetCmFile(bufnr('%'))
|
||||||
|
|
||||||
# ----- GetExecutableSmlnjCm & GetExecutableSmlnjFile -----
|
|
||||||
|
|
||||||
Execute(CM-project mode enabled when CM file found):
|
Execute(CM-project mode enabled when CM file found):
|
||||||
call ale#test#SetFilename('smlnj/cm/foo.sml')
|
call ale#test#SetFilename('smlnj/cm/foo.sml')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user