File tree 7 files changed +27
-7
lines changed
hls-stylish-haskell-plugin/test
7 files changed +27
-7
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ module Test.Hls
13
13
defaultTestRunner ,
14
14
goldenGitDiff ,
15
15
goldenWithHaskellDoc ,
16
+ goldenWithHaskellDocFormatter ,
16
17
def ,
17
18
runSessionWithServer ,
18
19
runSessionWithServerFormatter ,
@@ -90,6 +91,25 @@ goldenWithHaskellDoc plugin title testDataDir path desc ext act =
90
91
act doc
91
92
documentContents doc
92
93
94
+ goldenWithHaskellDocFormatter
95
+ :: PluginDescriptor IdeState
96
+ -> String
97
+ -> TestName
98
+ -> FilePath
99
+ -> FilePath
100
+ -> FilePath
101
+ -> FilePath
102
+ -> (TextDocumentIdentifier -> Session () )
103
+ -> TestTree
104
+ goldenWithHaskellDocFormatter plugin formatter title testDataDir path desc ext act =
105
+ goldenGitDiff title (testDataDir </> path <.> desc <.> ext)
106
+ $ runSessionWithServerFormatter plugin formatter testDataDir
107
+ $ TL. encodeUtf8 . TL. fromStrict
108
+ <$> do
109
+ doc <- openDoc (path <.> ext) " haskell"
110
+ act doc
111
+ documentContents doc
112
+
93
113
runSessionWithServer :: PluginDescriptor IdeState -> FilePath -> Session a -> IO a
94
114
runSessionWithServer plugin = runSessionWithServer' [plugin] def def fullCaps
95
115
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ tests = testGroup "brittany"
31
31
]
32
32
33
33
brittanyGolden :: TestName -> FilePath -> FilePath -> (TextDocumentIdentifier -> Session () ) -> TestTree
34
- brittanyGolden title path desc = goldenWithHaskellDoc brittanyPlugin title testDataDir path desc " hs"
34
+ brittanyGolden title path desc = goldenWithHaskellDocFormatter brittanyPlugin " brittany " title testDataDir path desc " hs"
35
35
36
36
testDataDir :: FilePath
37
37
testDataDir = " test" </> " testdata"
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ tests = testGroup "floskell"
24
24
]
25
25
26
26
goldenWithFloskell :: TestName -> FilePath -> FilePath -> (TextDocumentIdentifier -> Session () ) -> TestTree
27
- goldenWithFloskell title path desc = goldenWithHaskellDoc floskellPlugin title testDataDir path desc " hs"
27
+ goldenWithFloskell title path desc = goldenWithHaskellDocFormatter floskellPlugin " floskell " title testDataDir path desc " hs"
28
28
29
29
testDataDir :: FilePath
30
30
testDataDir = " test" </> " testdata"
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ tests = testGroup "fourmolu"
24
24
]
25
25
26
26
goldenWithFourmolu :: TestName -> FilePath -> FilePath -> (TextDocumentIdentifier -> Session () ) -> TestTree
27
- goldenWithFourmolu title path desc = goldenWithHaskellDoc fourmoluPlugin title testDataDir path desc " hs"
27
+ goldenWithFourmolu title path desc = goldenWithHaskellDocFormatter fourmoluPlugin " fourmolu " title testDataDir path desc " hs"
28
28
29
29
testDataDir :: FilePath
30
30
testDataDir = " test" </> " testdata"
Original file line number Diff line number Diff line change 1
- module Format where
1
+ module Fourmolu where
2
2
3
3
import Data.List
4
4
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ tests = testGroup "ormolu"
23
23
]
24
24
25
25
goldenWithOrmolu :: TestName -> FilePath -> FilePath -> (TextDocumentIdentifier -> Session () ) -> TestTree
26
- goldenWithOrmolu title path desc = goldenWithHaskellDoc ormoluPlugin title testDataDir path desc " hs"
26
+ goldenWithOrmolu title path desc = goldenWithHaskellDocFormatter ormoluPlugin " ormolu " title testDataDir path desc " hs"
27
27
28
28
testDataDir :: FilePath
29
29
testDataDir = " test" </> " testdata"
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ tests = testGroup "stylish-haskell"
22
22
]
23
23
24
24
goldenWithStylishHaskell :: TestName -> FilePath -> FilePath -> (TextDocumentIdentifier -> Session () ) -> TestTree
25
- goldenWithStylishHaskell title fp desc = goldenWithHaskellDoc stylishHaskellPlugin title testDataDir fp desc " hs"
25
+ goldenWithStylishHaskell title fp desc = goldenWithHaskellDocFormatter stylishHaskellPlugin " stylishHaskell " title testDataDir fp desc " hs"
26
26
27
27
testDataDir :: FilePath
28
- testDataDir = " test" </> " data "
28
+ testDataDir = " test" </> " testdata "
You can’t perform that action at this time.
0 commit comments