diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d006000..f549d80 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,7 +30,8 @@ jobs: - os: macos-12 ghc: system steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + - uses: hspec/setup-haskell@v1 with: ghc-version: ${{ matrix.ghc }} @@ -47,7 +48,7 @@ jobs: # https://github.com/actions/runner-images/blob/macOS-12/20230416.1/images/macos/macos-12-Readme.md#tools # # (on Linux this is a noop) - run: ghcup install cabal 3.10 --set + run: ghcup install cabal latest --set - shell: bash run: git config --global init.defaultBranch main @@ -66,6 +67,20 @@ jobs: env: HSPEC_OPTIONS: --color + - run: vim/run-tests.vim + if: runner.os == 'Linux' + + - shell: bash + run: | + vim/test/assets/generate.sh + untracked=$(git ls-files --others --exclude-standard) + if [ -n "$untracked" ]; then + echo "Untracked files:" + echo "$untracked" + exit 1 + fi + git diff --exit-code + success: needs: build runs-on: ubuntu-latest @@ -75,6 +90,6 @@ jobs: - run: false if: needs.build.result != 'success' - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Check for trailing whitespace - run: '! git grep -I "\s\+$"' + run: "! git grep -nI '[[:blank:]]$' -- . ':!vim/test/assets'" diff --git a/README.md b/README.md index 0d209de..8a70165 100644 --- a/README.md +++ b/README.md @@ -51,13 +51,14 @@ instead: ### Vim integration -You can use `sensei` to load the result of the last test run into your quickfix +You can use `seito` to load the results of the last test run into your quickfix list by executing `:make` in Vim. -For this to work, you can either create a `Makefile` or set `makeprg` to a -custom value. +For this to work, you can choose one out of three options: -(In both cases, `sed` is used to strip ANSI color sequences.) +1. Create a `Makefile` +2. Set `makeprg` to a custom value +3. Use [`sensei.vim`](vim/sensei.vim) #### Option 1: Create a `Makefile` @@ -78,6 +79,16 @@ Add the following to your Vim configuration (e.g. :set makeprg=seito ``` +#### Option 3: Use `sensei.vim`: + +Add the following to your Vim configuration (e.g. +`~/.vim/after/ftplugin/haskell.vim`): + +```vim +let vim_config = system('seito --vim-config') +execute 'source ' . vim_config +``` + ### Emacs integration Similarly, you can use `sensei` to load the result of the last test run into an diff --git a/driver/seito.hs b/driver/seito.hs index 7c1f760..44a815b 100644 --- a/driver/seito.hs +++ b/driver/seito.hs @@ -5,10 +5,12 @@ import System.Environment import Control.Monad import qualified Data.ByteString.Lazy as L +import Paths_sensei (getDataFileName) + import Client main :: IO () main = do - (success, output) <- getArgs >>= client "" + (success, output) <- getArgs >>= client getDataFileName "" L.putStr output unless success exitFailure diff --git a/package.yaml b/package.yaml index 5f4548d..92c9369 100644 --- a/package.yaml +++ b/package.yaml @@ -17,8 +17,7 @@ default-extensions: - RecordWildCards - ViewPatterns -other-extensions: - - NoFieldSelectors +data-files: vim/sensei.vim dependencies: - base >= 4.11 && < 5 @@ -62,6 +61,7 @@ executables: seito: source-dirs: driver + generated-other-modules: Paths_sensei main: seito.hs tests: diff --git a/sensei.cabal b/sensei.cabal index 061e932..702199d 100644 --- a/sensei.cabal +++ b/sensei.cabal @@ -1,6 +1,6 @@ -cabal-version: 1.12 +cabal-version: 2.0 --- This file has been generated from package.yaml by hpack version 0.36.0. +-- This file has been generated from package.yaml by hpack version 0.37.0. -- -- see: https://github.com/sol/hpack @@ -14,6 +14,8 @@ maintainer: Simon Hengel license: MIT license-file: LICENSE build-type: Simple +data-files: + vim/sensei.vim source-repository head type: git @@ -36,6 +38,9 @@ executable seito Session Trigger Util + Paths_sensei + autogen-modules: + Paths_sensei hs-source-dirs: src driver @@ -47,8 +52,6 @@ executable seito OverloadedStrings RecordWildCards ViewPatterns - other-extensions: - NoFieldSelectors ghc-options: -Wall -threaded build-depends: aeson @@ -105,8 +108,6 @@ executable sensei OverloadedStrings RecordWildCards ViewPatterns - other-extensions: - NoFieldSelectors ghc-options: -Wall -threaded build-depends: aeson @@ -163,8 +164,6 @@ executable sensei-web OverloadedStrings RecordWildCards ViewPatterns - other-extensions: - NoFieldSelectors ghc-options: -Wall -threaded build-depends: aeson @@ -236,8 +235,6 @@ test-suite spec OverloadedStrings RecordWildCards ViewPatterns - other-extensions: - NoFieldSelectors ghc-options: -Wall -threaded cpp-options: -DTEST build-tool-depends: diff --git a/src/Client.hs b/src/Client.hs index b3dc721..609dc7d 100644 --- a/src/Client.hs +++ b/src/Client.hs @@ -11,11 +11,12 @@ import qualified Data.ByteString.Lazy as L import HTTP (newSocket, socketName) -client :: FilePath -> [String] -> IO (Bool, L.ByteString) -client dir args = case args of +client :: (FilePath -> IO FilePath) -> FilePath -> [String] -> IO (Bool, L.ByteString) +client getDataFileName dir args = case args of [] -> hIsTerminalDevice stdout >>= run ["--no-color"] -> run False ["--color"] -> run True + ["--vim-config"] -> (,) True . fromString <$> getDataFileName "vim/sensei.vim" _ -> do hPutStrLn stderr $ "Usage: seito [ --color | --no-color ]" return (False, "") diff --git a/test/ClientSpec.hs b/test/ClientSpec.hs index 38dcfcd..cd15f2d 100644 --- a/test/ClientSpec.hs +++ b/test/ClientSpec.hs @@ -24,17 +24,21 @@ spec = do describe "client" $ do it "accepts --color" $ do withSuccess $ \ dir -> do - client dir ["--color"] `shouldReturn` (True, fromString $ withColor Green "success") + client return dir ["--color"] `shouldReturn` (True, fromString $ withColor Green "success") it "accepts --no-color" $ do withSuccess $ \ dir -> do - client dir ["--no-color"] `shouldReturn` (True, "success") + client return dir ["--no-color"] `shouldReturn` (True, "success") it "indicates failure" $ do withFailure $ \ dir -> do - client dir [] `shouldReturn` (False, "failure") + client return dir [] `shouldReturn` (False, "failure") context "when server socket is missing" $ do it "reports error" $ do withTempDirectory $ \ dir -> do - client dir [] `shouldReturn` (False, "could not connect to " <> fromString (socketName dir) <> "\n") + client return dir [] `shouldReturn` (False, "could not connect to " <> fromString (socketName dir) <> "\n") + + context "with --vim-config" $ do + it "returns a path to Vim support files" $ do + client return undefined ["--vim-config"] `shouldReturn` (True, "vim/sensei.vim") diff --git a/vim/run-tests.vim b/vim/run-tests.vim new file mode 100755 index 0000000..e2bd27f --- /dev/null +++ b/vim/run-tests.vim @@ -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 | echohl none +command -nargs=* SUCCESS echohl green | echo | 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 diff --git a/vim/sensei.test.vim b/vim/sensei.test.vim new file mode 100644 index 0000000..4f2e29b --- /dev/null +++ b/vim/sensei.test.vim @@ -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) diff --git a/vim/sensei.vim b/vim/sensei.vim new file mode 100644 index 0000000..f95b9e4 --- /dev/null +++ b/vim/sensei.vim @@ -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:\ .%# diff --git a/vim/test/assets/generate.sh b/vim/test/assets/generate.sh new file mode 100755 index 0000000..d8a32ee --- /dev/null +++ b/vim/test/assets/generate.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +for name in $(find vim/test/assets/ -name '*.hs' ! -name '*hspec*'); do + for ghc in ghc-9.6 ghc-9.8 ghc-9.10; do + if command -v "$ghc" >/dev/null 2>&1; then + $ghc -fno-diagnostics-show-caret -fno-show-error-context "$name" &> "$name.ghc-$($ghc --numeric-version).errors" + fi + done + for ghc in ghc-9.2 ghc-9.4; do + if command -v "$ghc" >/dev/null 2>&1; then + $ghc -fno-diagnostics-show-caret "$name" &> "$name.ghc-$($ghc --numeric-version).errors" + fi + done +done + +cabal exec -- runhaskell vim/test/assets/hspec.hs --expert --seed 0 > vim/test/assets/hspec.hs.errors +sed -i 's/Finished in 0.000[0-9] seconds/Finished in 0.0005 seconds/' vim/test/assets/hspec.hs.errors diff --git a/vim/test/assets/hspec.hs b/vim/test/assets/hspec.hs new file mode 100644 index 0000000..1522bfa --- /dev/null +++ b/vim/test/assets/hspec.hs @@ -0,0 +1,6 @@ +import Test.Hspec + +main :: IO () +main = hspec $ do + it "foo" $ do + "foo" `shouldBe` "bar" diff --git a/vim/test/assets/hspec.hs.errors b/vim/test/assets/hspec.hs.errors new file mode 100644 index 0000000..04cf9d6 --- /dev/null +++ b/vim/test/assets/hspec.hs.errors @@ -0,0 +1,14 @@ + +foo [✘] + +Failures: + + vim/test/assets/hspec.hs:6:11: + 1) foo + expected: "bar" + but got: "foo" + +Randomized with seed 0 + +Finished in 0.0005 seconds +1 example, 1 failure diff --git a/vim/test/assets/lexical-error.hs b/vim/test/assets/lexical-error.hs new file mode 100644 index 0000000..281b9f6 --- /dev/null +++ b/vim/test/assets/lexical-error.hs @@ -0,0 +1 @@ +foo = "bar diff --git a/vim/test/assets/lexical-error.hs.ghc-9.10.1.errors b/vim/test/assets/lexical-error.hs.ghc-9.10.1.errors new file mode 100644 index 0000000..ef0e8fb --- /dev/null +++ b/vim/test/assets/lexical-error.hs.ghc-9.10.1.errors @@ -0,0 +1,4 @@ +[1 of 2] Compiling Main ( vim/test/assets/lexical-error.hs, vim/test/assets/lexical-error.o ) +vim/test/assets/lexical-error.hs:1:11: error: [GHC-21231] + lexical error in string/character literal at character '\n' + diff --git a/vim/test/assets/lexical-error.hs.ghc-9.2.8.errors b/vim/test/assets/lexical-error.hs.ghc-9.2.8.errors new file mode 100644 index 0000000..ae31a34 --- /dev/null +++ b/vim/test/assets/lexical-error.hs.ghc-9.2.8.errors @@ -0,0 +1,4 @@ +[1 of 1] Compiling Main ( vim/test/assets/lexical-error.hs, vim/test/assets/lexical-error.o ) + +vim/test/assets/lexical-error.hs:1:11: error: + lexical error in string/character literal at character '\n' diff --git a/vim/test/assets/lexical-error.hs.ghc-9.4.8.errors b/vim/test/assets/lexical-error.hs.ghc-9.4.8.errors new file mode 100644 index 0000000..5c4bc74 --- /dev/null +++ b/vim/test/assets/lexical-error.hs.ghc-9.4.8.errors @@ -0,0 +1,4 @@ +[1 of 2] Compiling Main ( vim/test/assets/lexical-error.hs, vim/test/assets/lexical-error.o ) + +vim/test/assets/lexical-error.hs:1:11: error: + lexical error in string/character literal at character '\n' diff --git a/vim/test/assets/lexical-error.hs.ghc-9.6.6.errors b/vim/test/assets/lexical-error.hs.ghc-9.6.6.errors new file mode 100644 index 0000000..6215b2a --- /dev/null +++ b/vim/test/assets/lexical-error.hs.ghc-9.6.6.errors @@ -0,0 +1,4 @@ +[1 of 2] Compiling Main ( vim/test/assets/lexical-error.hs, vim/test/assets/lexical-error.o ) + +vim/test/assets/lexical-error.hs:1:11: error: [GHC-21231] + lexical error in string/character literal at character '\n' diff --git a/vim/test/assets/lexical-error.hs.ghc-9.8.2.errors b/vim/test/assets/lexical-error.hs.ghc-9.8.2.errors new file mode 100644 index 0000000..6215b2a --- /dev/null +++ b/vim/test/assets/lexical-error.hs.ghc-9.8.2.errors @@ -0,0 +1,4 @@ +[1 of 2] Compiling Main ( vim/test/assets/lexical-error.hs, vim/test/assets/lexical-error.o ) + +vim/test/assets/lexical-error.hs:1:11: error: [GHC-21231] + lexical error in string/character literal at character '\n' diff --git a/vim/test/assets/parse-error.hs b/vim/test/assets/parse-error.hs new file mode 100644 index 0000000..e187a3a --- /dev/null +++ b/vim/test/assets/parse-error.hs @@ -0,0 +1,2 @@ +foo : Int +foo = 23 diff --git a/vim/test/assets/parse-error.hs.ghc-9.10.1.errors b/vim/test/assets/parse-error.hs.ghc-9.10.1.errors new file mode 100644 index 0000000..7352342 --- /dev/null +++ b/vim/test/assets/parse-error.hs.ghc-9.10.1.errors @@ -0,0 +1,5 @@ +[1 of 2] Compiling Main ( vim/test/assets/parse-error.hs, vim/test/assets/parse-error.o ) +vim/test/assets/parse-error.hs:1:1: error: [GHC-25277] + Parse error: module header, import declaration + or top-level declaration expected. + diff --git a/vim/test/assets/parse-error.hs.ghc-9.2.8.errors b/vim/test/assets/parse-error.hs.ghc-9.2.8.errors new file mode 100644 index 0000000..1fdc490 --- /dev/null +++ b/vim/test/assets/parse-error.hs.ghc-9.2.8.errors @@ -0,0 +1,5 @@ +[1 of 1] Compiling Main ( vim/test/assets/parse-error.hs, vim/test/assets/parse-error.o ) + +vim/test/assets/parse-error.hs:1:1: error: + Parse error: module header, import declaration + or top-level declaration expected. diff --git a/vim/test/assets/parse-error.hs.ghc-9.4.8.errors b/vim/test/assets/parse-error.hs.ghc-9.4.8.errors new file mode 100644 index 0000000..f31c804 --- /dev/null +++ b/vim/test/assets/parse-error.hs.ghc-9.4.8.errors @@ -0,0 +1,5 @@ +[1 of 2] Compiling Main ( vim/test/assets/parse-error.hs, vim/test/assets/parse-error.o ) + +vim/test/assets/parse-error.hs:1:1: error: + Parse error: module header, import declaration + or top-level declaration expected. diff --git a/vim/test/assets/parse-error.hs.ghc-9.6.6.errors b/vim/test/assets/parse-error.hs.ghc-9.6.6.errors new file mode 100644 index 0000000..f31c804 --- /dev/null +++ b/vim/test/assets/parse-error.hs.ghc-9.6.6.errors @@ -0,0 +1,5 @@ +[1 of 2] Compiling Main ( vim/test/assets/parse-error.hs, vim/test/assets/parse-error.o ) + +vim/test/assets/parse-error.hs:1:1: error: + Parse error: module header, import declaration + or top-level declaration expected. diff --git a/vim/test/assets/parse-error.hs.ghc-9.8.2.errors b/vim/test/assets/parse-error.hs.ghc-9.8.2.errors new file mode 100644 index 0000000..78b27f3 --- /dev/null +++ b/vim/test/assets/parse-error.hs.ghc-9.8.2.errors @@ -0,0 +1,5 @@ +[1 of 2] Compiling Main ( vim/test/assets/parse-error.hs, vim/test/assets/parse-error.o ) + +vim/test/assets/parse-error.hs:1:1: error: [GHC-25277] + Parse error: module header, import declaration + or top-level declaration expected. diff --git a/vim/test/assets/type-error.hs b/vim/test/assets/type-error.hs new file mode 100644 index 0000000..5b28234 --- /dev/null +++ b/vim/test/assets/type-error.hs @@ -0,0 +1,2 @@ +foo :: String +foo = 23 :: Int diff --git a/vim/test/assets/type-error.hs.ghc-9.10.1.errors b/vim/test/assets/type-error.hs.ghc-9.10.1.errors new file mode 100644 index 0000000..6e9cea3 --- /dev/null +++ b/vim/test/assets/type-error.hs.ghc-9.10.1.errors @@ -0,0 +1,6 @@ +[1 of 2] Compiling Main ( vim/test/assets/type-error.hs, vim/test/assets/type-error.o ) +vim/test/assets/type-error.hs:2:7: error: [GHC-83865] + Couldn't match type ‘Int’ with ‘[Char]’ + Expected: String + Actual: Int + diff --git a/vim/test/assets/type-error.hs.ghc-9.2.8.errors b/vim/test/assets/type-error.hs.ghc-9.2.8.errors new file mode 100644 index 0000000..a40fe9c --- /dev/null +++ b/vim/test/assets/type-error.hs.ghc-9.2.8.errors @@ -0,0 +1,8 @@ +[1 of 1] Compiling Main ( vim/test/assets/type-error.hs, vim/test/assets/type-error.o ) + +vim/test/assets/type-error.hs:2:7: error: + • Couldn't match type ‘Int’ with ‘[Char]’ + Expected: String + Actual: Int + • In the expression: 23 :: Int + In an equation for ‘foo’: foo = 23 :: Int diff --git a/vim/test/assets/type-error.hs.ghc-9.4.8.errors b/vim/test/assets/type-error.hs.ghc-9.4.8.errors new file mode 100644 index 0000000..6ab819f --- /dev/null +++ b/vim/test/assets/type-error.hs.ghc-9.4.8.errors @@ -0,0 +1,8 @@ +[1 of 2] Compiling Main ( vim/test/assets/type-error.hs, vim/test/assets/type-error.o ) + +vim/test/assets/type-error.hs:2:7: error: + • Couldn't match type ‘Int’ with ‘[Char]’ + Expected: String + Actual: Int + • In the expression: 23 :: Int + In an equation for ‘foo’: foo = 23 :: Int diff --git a/vim/test/assets/type-error.hs.ghc-9.6.6.errors b/vim/test/assets/type-error.hs.ghc-9.6.6.errors new file mode 100644 index 0000000..83d1421 --- /dev/null +++ b/vim/test/assets/type-error.hs.ghc-9.6.6.errors @@ -0,0 +1,6 @@ +[1 of 2] Compiling Main ( vim/test/assets/type-error.hs, vim/test/assets/type-error.o ) + +vim/test/assets/type-error.hs:2:7: error: [GHC-83865] + Couldn't match type ‘Int’ with ‘[Char]’ + Expected: String + Actual: Int diff --git a/vim/test/assets/type-error.hs.ghc-9.8.2.errors b/vim/test/assets/type-error.hs.ghc-9.8.2.errors new file mode 100644 index 0000000..83d1421 --- /dev/null +++ b/vim/test/assets/type-error.hs.ghc-9.8.2.errors @@ -0,0 +1,6 @@ +[1 of 2] Compiling Main ( vim/test/assets/type-error.hs, vim/test/assets/type-error.o ) + +vim/test/assets/type-error.hs:2:7: error: [GHC-83865] + Couldn't match type ‘Int’ with ‘[Char]’ + Expected: String + Actual: Int diff --git a/vim/test/assets/type-signature-lacks-binding.hs b/vim/test/assets/type-signature-lacks-binding.hs new file mode 100644 index 0000000..5a9f494 --- /dev/null +++ b/vim/test/assets/type-signature-lacks-binding.hs @@ -0,0 +1,5 @@ +foo :: Int +foo_ = 23 + +bar :: Int +bar_ = 23 diff --git a/vim/test/assets/type-signature-lacks-binding.hs.ghc-9.10.1.errors b/vim/test/assets/type-signature-lacks-binding.hs.ghc-9.10.1.errors new file mode 100644 index 0000000..62fca25 --- /dev/null +++ b/vim/test/assets/type-signature-lacks-binding.hs.ghc-9.10.1.errors @@ -0,0 +1,11 @@ +[1 of 2] Compiling Main ( vim/test/assets/type-signature-lacks-binding.hs, vim/test/assets/type-signature-lacks-binding.o ) +vim/test/assets/type-signature-lacks-binding.hs:1:1: error: [GHC-44432] + The type signature for ‘foo’ lacks an accompanying binding + Suggested fix: + Perhaps use ‘foo_’ (Defined at vim/test/assets/type-signature-lacks-binding.hs:2:1) + +vim/test/assets/type-signature-lacks-binding.hs:4:1: error: [GHC-44432] + The type signature for ‘bar’ lacks an accompanying binding + Suggested fix: + Perhaps use ‘bar_’ (Defined at vim/test/assets/type-signature-lacks-binding.hs:5:1) + diff --git a/vim/test/assets/type-signature-lacks-binding.hs.ghc-9.2.8.errors b/vim/test/assets/type-signature-lacks-binding.hs.ghc-9.2.8.errors new file mode 100644 index 0000000..4f23b10 --- /dev/null +++ b/vim/test/assets/type-signature-lacks-binding.hs.ghc-9.2.8.errors @@ -0,0 +1,9 @@ +[1 of 1] Compiling Main ( vim/test/assets/type-signature-lacks-binding.hs, vim/test/assets/type-signature-lacks-binding.o ) + +vim/test/assets/type-signature-lacks-binding.hs:1:1: error: + The type signature for ‘foo’ lacks an accompanying binding + Perhaps you meant ‘foo_’ (Defined at vim/test/assets/type-signature-lacks-binding.hs:2:1) + +vim/test/assets/type-signature-lacks-binding.hs:4:1: error: + The type signature for ‘bar’ lacks an accompanying binding + Perhaps you meant ‘bar_’ (Defined at vim/test/assets/type-signature-lacks-binding.hs:5:1) diff --git a/vim/test/assets/type-signature-lacks-binding.hs.ghc-9.4.8.errors b/vim/test/assets/type-signature-lacks-binding.hs.ghc-9.4.8.errors new file mode 100644 index 0000000..73c57b8 --- /dev/null +++ b/vim/test/assets/type-signature-lacks-binding.hs.ghc-9.4.8.errors @@ -0,0 +1,11 @@ +[1 of 2] Compiling Main ( vim/test/assets/type-signature-lacks-binding.hs, vim/test/assets/type-signature-lacks-binding.o ) + +vim/test/assets/type-signature-lacks-binding.hs:1:1: error: + The type signature for ‘foo’ lacks an accompanying binding + Suggested fix: + Perhaps use ‘foo_’ (Defined at vim/test/assets/type-signature-lacks-binding.hs:2:1) + +vim/test/assets/type-signature-lacks-binding.hs:4:1: error: + The type signature for ‘bar’ lacks an accompanying binding + Suggested fix: + Perhaps use ‘bar_’ (Defined at vim/test/assets/type-signature-lacks-binding.hs:5:1) diff --git a/vim/test/assets/type-signature-lacks-binding.hs.ghc-9.6.6.errors b/vim/test/assets/type-signature-lacks-binding.hs.ghc-9.6.6.errors new file mode 100644 index 0000000..18bb2a7 --- /dev/null +++ b/vim/test/assets/type-signature-lacks-binding.hs.ghc-9.6.6.errors @@ -0,0 +1,11 @@ +[1 of 2] Compiling Main ( vim/test/assets/type-signature-lacks-binding.hs, vim/test/assets/type-signature-lacks-binding.o ) + +vim/test/assets/type-signature-lacks-binding.hs:1:1: error: [GHC-44432] + The type signature for ‘foo’ lacks an accompanying binding + Suggested fix: + Perhaps use ‘foo_’ (Defined at vim/test/assets/type-signature-lacks-binding.hs:2:1) + +vim/test/assets/type-signature-lacks-binding.hs:4:1: error: [GHC-44432] + The type signature for ‘bar’ lacks an accompanying binding + Suggested fix: + Perhaps use ‘bar_’ (Defined at vim/test/assets/type-signature-lacks-binding.hs:5:1) diff --git a/vim/test/assets/type-signature-lacks-binding.hs.ghc-9.8.2.errors b/vim/test/assets/type-signature-lacks-binding.hs.ghc-9.8.2.errors new file mode 100644 index 0000000..18bb2a7 --- /dev/null +++ b/vim/test/assets/type-signature-lacks-binding.hs.ghc-9.8.2.errors @@ -0,0 +1,11 @@ +[1 of 2] Compiling Main ( vim/test/assets/type-signature-lacks-binding.hs, vim/test/assets/type-signature-lacks-binding.o ) + +vim/test/assets/type-signature-lacks-binding.hs:1:1: error: [GHC-44432] + The type signature for ‘foo’ lacks an accompanying binding + Suggested fix: + Perhaps use ‘foo_’ (Defined at vim/test/assets/type-signature-lacks-binding.hs:2:1) + +vim/test/assets/type-signature-lacks-binding.hs:4:1: error: [GHC-44432] + The type signature for ‘bar’ lacks an accompanying binding + Suggested fix: + Perhaps use ‘bar_’ (Defined at vim/test/assets/type-signature-lacks-binding.hs:5:1) diff --git a/watch.sh b/watch.sh new file mode 100755 index 0000000..f138390 --- /dev/null +++ b/watch.sh @@ -0,0 +1,6 @@ +#!/bin/bash +while true; do + echo + ./vim/run-tests.vim + inotifywait -e modify -e attrib -e close_write -e move -e create -e delete -r vim/ +done