-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
38 changed files
with
419 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/env -S vim -u NONE -S | ||
|
||
set t_ti= | ||
set t_te= | ||
|
||
highlight red ctermfg=red | ||
highlight green ctermfg=green | ||
|
||
command -nargs=* FAILURE echohl red | echo <args> | echohl none | ||
command -nargs=* SUCCESS echohl green | echo <args> | echohl none | ||
|
||
function CheckResults() | ||
if !empty(v:errors) | ||
FAILURE "FAILURES:\n" | ||
for error in v:errors | ||
echo "\n" | ||
FAILURE substitute(substitute(substitute(error, "^command line..script ", "", ""), " Expected ", "\n\nexpected: ", ""), " but got", "\n but got:", "") | ||
endfor | ||
cquit | ||
endif | ||
endfunction | ||
|
||
try | ||
for name in glob("**/*.test.vim", v:true, v:true) | ||
SUCCESS "running " . name | ||
execute "source " . name | ||
endfor | ||
catch | ||
FAILURE substitute(v:throwpoint, "^command line..script ", "", "") | ||
echo "\n" | ||
FAILURE v:exception | ||
cquit | ||
endtry | ||
|
||
echo "\n" | ||
|
||
call CheckResults() | ||
SUCCESS "SUCCESS" | ||
quit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
source vim/sensei.vim | ||
|
||
function Require(actual, required) | ||
for i in range(len(a:required)) | ||
if a:actual[i] > a:required[i] | ||
return 1 | ||
elseif a:actual[i] < a:required[i] | ||
return 0 | ||
endif | ||
endfor | ||
return 1 | ||
endfunction | ||
|
||
function GhcVersion(name) | ||
return matchlist(a:name, '\vghc-(\d+)\.(\d+)\.(\d+)\.errors')[1:3] | ||
endfunction | ||
|
||
function PopulateQuickFixList(name) | ||
SUCCESS a:name | ||
execute "cgetfile " . a:name | ||
return filter(getqflist(), 'v:val.valid') | ||
endfunction | ||
|
||
for name in glob("vim/test/assets/lexical-error.hs.*.errors", v:true, v:true) | ||
let errors = PopulateQuickFixList(name) | ||
call assert_equal(1, len(errors)) | ||
|
||
let err = errors[0] | ||
call assert_equal("vim/test/assets/lexical-error.hs", bufname(err.bufnr)) | ||
call assert_equal(1, err.lnum) | ||
call assert_equal(11, err.col) | ||
call assert_equal(0, err.end_lnum) | ||
call assert_equal(0, err.end_col) | ||
call assert_equal('e', err.type) | ||
if Require(GhcVersion(name), [9,6]) | ||
call assert_equal(21231, err.nr) | ||
else | ||
call assert_equal(-1, err.nr) | ||
endif | ||
call assert_equal("\n lexical error in string/character literal at character '\\n'", err.text) | ||
endfor | ||
|
||
for name in glob("vim/test/assets/parse-error.hs.*.errors", v:true, v:true) | ||
let errors = PopulateQuickFixList(name) | ||
call assert_equal(1, len(errors)) | ||
|
||
let err = errors[0] | ||
call assert_equal("vim/test/assets/parse-error.hs", bufname(err.bufnr)) | ||
call assert_equal(1, err.lnum) | ||
call assert_equal(1, err.col) | ||
call assert_equal(0, err.end_lnum) | ||
call assert_equal(0, err.end_col) | ||
call assert_equal('e', err.type) | ||
if Require(GhcVersion(name), [9,8]) | ||
call assert_equal(25277, err.nr) | ||
else | ||
call assert_equal(-1, err.nr) | ||
endif | ||
call assert_equal("\n Parse error: module header, import declaration\n or top-level declaration expected.", err.text) | ||
endfor | ||
|
||
for name in glob("vim/test/assets/type-error.hs.*.errors", v:true, v:true) | ||
let errors = PopulateQuickFixList(name) | ||
call assert_equal(1, len(errors)) | ||
|
||
let err = errors[0] | ||
call assert_equal("vim/test/assets/type-error.hs", bufname(err.bufnr)) | ||
call assert_equal(2, err.lnum) | ||
call assert_equal(7, err.col) | ||
call assert_equal(0, err.end_lnum) | ||
call assert_equal(0, err.end_col) | ||
call assert_equal('e', err.type) | ||
if Require(GhcVersion(name), [9,6]) | ||
call assert_equal(83865, err.nr) | ||
call assert_equal("\n Couldn't match type ‘Int’ with ‘[Char]’\n Expected: String\n Actual: Int", err.text) | ||
else | ||
call assert_equal(-1, err.nr) | ||
call assert_equal("\n • Couldn't match type ‘Int’ with ‘[Char]’\n Expected: String\n Actual: Int\n • In the expression: 23 :: Int\n In an equation for ‘foo’: foo = 23 :: Int", err.text) | ||
endif | ||
endfor | ||
|
||
for name in glob("vim/test/assets/type-signature-lacks-binding.hs.*.errors", v:true, v:true) | ||
let errors = PopulateQuickFixList(name) | ||
call assert_equal(2, len(errors)) | ||
|
||
let err = errors[0] | ||
call assert_equal("vim/test/assets/type-signature-lacks-binding.hs", bufname(err.bufnr)) | ||
call assert_equal(1, err.lnum) | ||
call assert_equal(1, err.col) | ||
call assert_equal(0, err.end_lnum) | ||
call assert_equal(0, err.end_col) | ||
call assert_equal('e', err.type) | ||
if Require(GhcVersion(name), [9,6]) | ||
call assert_equal(44432, err.nr) | ||
else | ||
call assert_equal(-1, err.nr) | ||
endif | ||
call assert_equal("\n The type signature for ‘foo’ lacks an accompanying binding", err.text) | ||
|
||
let err = errors[1] | ||
call assert_equal("vim/test/assets/type-signature-lacks-binding.hs", bufname(err.bufnr)) | ||
call assert_equal(4, err.lnum) | ||
call assert_equal(1, err.col) | ||
call assert_equal(0, err.end_lnum) | ||
call assert_equal(0, err.end_col) | ||
call assert_equal('e', err.type) | ||
if Require(GhcVersion(name), [9,6]) | ||
call assert_equal(44432, err.nr) | ||
else | ||
call assert_equal(-1, err.nr) | ||
endif | ||
call assert_equal("\n The type signature for ‘bar’ lacks an accompanying binding", err.text) | ||
endfor | ||
|
||
let errors = PopulateQuickFixList("vim/test/assets/hspec.hs.errors") | ||
call assert_equal(1, len(errors)) | ||
|
||
let err = errors[0] | ||
call assert_equal("vim/test/assets/hspec.hs", bufname(err.bufnr)) | ||
call assert_equal(6, err.lnum) | ||
call assert_equal(11, err.col) | ||
call assert_equal(0, err.end_lnum) | ||
call assert_equal(0, err.end_col) | ||
call assert_equal('', err.type) | ||
call assert_equal(-1, err.nr) | ||
call assert_equal("", err.text) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
set makeprg=seito | ||
|
||
" GHC | ||
set errorformat=%A%f:%l:%c:\ %t%*[^:]:\ [GHC-%n] | ||
set errorformat+=%A%f:%l:%c:\ %t%*[^:]: " GHC 9.6 | ||
|
||
set errorformat^=%+C\ %.%# | ||
set errorformat^=%Z | ||
set errorformat^=%-G\ \ \ \ Suggested\ fix:%.%# | ||
set errorformat^=%-G\ \ \ \ \ \ Perhaps\ you\ meant\ %.%# " GHC 9.2 | ||
|
||
" Hspec | ||
set errorformat^=\ \ %f:%l:%c:\ .%# |
Oops, something went wrong.