git.iko.soy/rowtype-yoga/purescript-native
on ef14768 help sign in
35 lines 1.2 kB history raw
1{-# LANGUAGE OverloadedStrings #-}
3module Language.PureScript.IdeSpec where
5import Control.Concurrent.STM
6import Control.Monad.Reader
7import Data.List
8import qualified Data.Map as Map
9import Language.PureScript.Ide
10import Language.PureScript.Ide.Types
11import Test.Hspec
13testState :: PscIdeState
14testState = PscIdeState (Map.fromList [("Data.Array", []), ("Control.Monad.Eff", [])]) Map.empty
16defaultConfig :: Configuration
17defaultConfig =
18 Configuration
19 {
20 confOutputPath = "output/"
21 , confDebug = False
22 }
24spec :: SpecWith ()
25spec =
26 describe "list" $
27 describe "loadedModules" $ do
28 it "returns an empty list when no modules are loaded" $ do
29 st <- newTVarIO emptyPscIdeState
30 result <- runReaderT printModules (PscIdeEnvironment st defaultConfig)
31 result `shouldBe` ModuleList []
32 it "returns the list of loaded modules" $ do
33 st <- newTVarIO testState
34 ModuleList result <- runReaderT printModules (PscIdeEnvironment st defaultConfig)
35 sort result `shouldBe` sort ["Data.Array", "Control.Monad.Eff"]