Add closeDoc
[lsp-test.git] / test / Test.hs
index 56bd01dd0a1a5ec4d2ae65418706acf19620f0e0..a4a41732e395e36c9581525f398f985f32527af0 100644 (file)
@@ -289,6 +289,16 @@ main = hspec $ do
       formatRange doc (FormattingOptions 4 True) (Range (Position 1 10) (Position 2 10))
       documentContents doc >>= liftIO . (`shouldNotBe` oldContents)
 
+  describe "closeDoc" $
+    it "works" $
+      let sesh =
+            runSession "hie --lsp" "test/data" $ do
+              doc <- openDoc "Format.hs" "haskell"
+              closeDoc doc
+              -- need to evaluate to throw
+              documentContents doc >>= liftIO . print
+      in sesh `shouldThrow` anyException
+
 mkRange sl sc el ec = Range (Position sl sc) (Position el ec)
 
 didChangeCaps :: ClientCapabilities