Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Commit 9f83cd5

Browse files
committed
Reorder tests and add executable test
Reorder the test to endsure some liquid products are available in /test/testdata/liquid/.liquid at first run. Also add a test to see if the liquid haskell excutable is available.
1 parent 9b2cd85 commit 9f83cd5

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

test/unit/LiquidSpec.hs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import Data.List
88
import qualified Data.Text as T
99
import qualified Data.Text.IO as T
1010
import Data.Monoid ((<>))
11+
import Data.Maybe (isJust)
1112
import Haskell.Ide.Engine.MonadTypes
1213
import Haskell.Ide.Engine.Plugin.Liquid
1314
import System.Directory
@@ -24,7 +25,20 @@ spec = do
2425
cwd <- runIO getCurrentDirectory
2526

2627
-- ---------------------------------
28+
it "finds liquid haskell exe in $PATH" $ findExecutable "liquid" >>= (`shouldSatisfy` isJust)
2729

30+
-- ---------------------------------
31+
-- This produces some products in /test/testdata/liquid/.liquid/ that is used in subsequent test
32+
it "runs the liquid haskell exe" $ do
33+
let
34+
fp = cwd </> "test/testdata/liquid/Evens.hs"
35+
-- fp = "/home/alanz/tmp/haskell-proc-play/Evens.hs"
36+
-- uri = filePathToUri fp
37+
Just (ef, (msg:_)) <- runLiquidHaskell fp
38+
msg `shouldSatisfy` isPrefixOf "RESULT\n[{\"start\":{\"line\":9,\"column\":1},\"stop\":{\"line\":9,\"column\":8},\"message\":\"Error: Liquid Type Mismatch\\n Inferred type\\n VV : {v : Int | v == (7 : int)}\\n \\n not a subtype of Required type\\n VV : {VV : Int | VV mod 2 == 0}\\n"
39+
ef `shouldBe` ExitFailure 1
40+
41+
-- ---------------------------------
2842
it "gets annot file paths" $ do
2943
let
3044
uri = filePathToUri $ cwd </> "test/testdata/liquid/Evens.hs"
@@ -107,14 +121,3 @@ spec = do
107121
n `shouldBe` Nothing
108122

109123
-- ---------------------------------
110-
111-
it "runs the liquid haskell exe" $ do
112-
let
113-
fp = cwd </> "test/testdata/liquid/Evens.hs"
114-
-- fp = "/home/alanz/tmp/haskell-proc-play/Evens.hs"
115-
-- uri = filePathToUri fp
116-
Just (ef, (msg:_)) <- runLiquidHaskell fp
117-
msg `shouldSatisfy` isPrefixOf "RESULT\n[{\"start\":{\"line\":9,\"column\":1},\"stop\":{\"line\":9,\"column\":8},\"message\":\"Error: Liquid Type Mismatch\\n Inferred type\\n VV : {v : Int | v == (7 : int)}\\n \\n not a subtype of Required type\\n VV : {VV : Int | VV mod 2 == 0}\\n"
118-
ef `shouldBe` ExitFailure 1
119-
120-
-- ---------------------------------

0 commit comments

Comments
 (0)