|
6 | 6 | module Config (tests) where
|
7 | 7 |
|
8 | 8 | import Control.DeepSeq
|
9 |
| -import Control.Lens hiding (List, (.=)) |
| 9 | +import Control.Lens hiding (List, (.=)) |
10 | 10 | import Control.Monad
|
11 | 11 | import Data.Aeson
|
12 | 12 | import Data.Hashable
|
13 |
| -import qualified Data.HashMap.Strict as HM |
14 |
| -import qualified Data.Map as Map |
15 |
| -import qualified Data.Text as T |
16 |
| -import Data.Typeable (Typeable) |
17 |
| -import Development.IDE (RuleResult, action, define, |
18 |
| - getFilesOfInterestUntracked, |
19 |
| - getPluginConfigAction, ideErrorText, |
20 |
| - uses_) |
21 |
| -import Development.IDE.Test (expectDiagnostics) |
| 13 | +import qualified Data.HashMap.Strict as HM |
| 14 | +import qualified Data.Map as Map |
| 15 | +import qualified Data.Text as T |
| 16 | +import Data.Typeable (Typeable) |
| 17 | +import Development.IDE (RuleResult, action, define, |
| 18 | + getFilesOfInterestUntracked, |
| 19 | + getPluginConfigAction, ideErrorText, |
| 20 | + uses_) |
| 21 | +import Development.IDE.Test (expectDiagnostics) |
22 | 22 | import GHC.Generics
|
23 | 23 | import Ide.Plugin.Config
|
24 | 24 | import Ide.Types
|
25 |
| -import Language.LSP.Test as Test |
26 |
| -import qualified Language.LSP.Types.Lens as L |
27 |
| -import System.FilePath ((</>)) |
| 25 | +import Language.LSP.Test as Test |
| 26 | +import System.FilePath ((</>)) |
28 | 27 | import Test.Hls
|
29 |
| -import Test.Hls.Command |
30 | 28 |
|
31 | 29 | {-# ANN module ("HLint: ignore Reduce duplication"::String) #-}
|
32 | 30 |
|
33 | 31 | tests :: TestTree
|
34 | 32 | tests = testGroup "plugin config" [
|
35 | 33 | -- Note: there are more comprehensive tests over config in hls-hlint-plugin
|
36 | 34 | -- TODO: Add generic tests over some example plugin
|
37 |
| - configParsingTests, genericConfigTests |
| 35 | + genericConfigTests |
38 | 36 | ]
|
39 | 37 |
|
40 |
| -configParsingTests :: TestTree |
41 |
| -configParsingTests = testGroup "config parsing" |
42 |
| - [ testCase "empty object as user configuration should not send error logMessage" $ runConfigSession "" $ do |
43 |
| - let config = object [] |
44 |
| - sendConfigurationChanged (toJSON config) |
45 |
| - |
46 |
| - -- Send custom request so server returns a response to prevent blocking |
47 |
| - void $ sendNotification (SCustomMethod "non-existent-method") Null |
48 |
| - |
49 |
| - logNot <- skipManyTill Test.anyMessage (message SWindowLogMessage) |
50 |
| - |
51 |
| - liftIO $ (logNot ^. L.params . L.xtype) > MtError |
52 |
| - || "non-existent-method" `T.isInfixOf` (logNot ^. L.params . L.message) |
53 |
| - @? "Server sends logMessage with MessageType = Error" |
54 |
| - ] |
55 |
| - |
56 |
| - where |
57 |
| - runConfigSession :: FilePath -> Session a -> IO a |
58 |
| - runConfigSession subdir = |
59 |
| - failIfSessionTimeout . runSession hlsCommand fullCaps ("test/testdata" </> subdir) |
60 |
| - |
61 | 38 | genericConfigTests :: TestTree
|
62 | 39 | genericConfigTests = testGroup "generic plugin config"
|
63 | 40 | [
|
|
0 commit comments