Detect and use CM files for smlnj (#884)
* Detect and use CM files for smlnj * Split into two checkers - one for CM projects - one for single SML files * Fix some typos * Fix error caught by writing tests We want to actually use `glob` to search in paths upwards from us. (Previously we were just searching in the current directory every time!) * Fix errors from former test run * Write tests for GetCmFile and GetExecutableSmlnj * Typo in 'smlnj/' fixture filenames
This commit is contained in:
parent
c7fbcb3c02
commit
63e8946fc8
11 changed files with 205 additions and 49 deletions
47
test/test_sml_command.vader
Normal file
47
test/test_sml_command.vader
Normal file
|
@ -0,0 +1,47 @@
|
|||
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('%'))
|
||||
|
||||
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('%'))
|
||||
|
||||
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')
|
||||
|
||||
AssertEqual 'sml', ale#handlers#sml#GetExecutableSmlnjCm(bufnr('%'))
|
||||
|
||||
Execute(single-file mode disabled when CM file found):
|
||||
call ale#test#SetFilename('smlnj/cm/foo.sml')
|
||||
|
||||
AssertEqual '', ale#handlers#sml#GetExecutableSmlnjFile(bufnr('%'))
|
||||
|
||||
Execute(CM-project mode disabled when CM file not found):
|
||||
call ale#test#SetFilename('smlnj/file/qux.sml')
|
||||
|
||||
AssertEqual '', ale#handlers#sml#GetExecutableSmlnjCm(bufnr('%'))
|
||||
|
||||
Execute(single-file mode enabled when CM file found):
|
||||
call ale#test#SetFilename('smlnj/file/qux.sml')
|
||||
|
||||
AssertEqual 'sml', ale#handlers#sml#GetExecutableSmlnjFile(bufnr('%'))
|
Loading…
Add table
Add a link
Reference in a new issue