File tree Expand file tree Collapse file tree 7 files changed +27
-7
lines changed
hls-stylish-haskell-plugin/test Expand file tree Collapse file tree 7 files changed +27
-7
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ module Test.Hls
1313 defaultTestRunner ,
1414 goldenGitDiff ,
1515 goldenWithHaskellDoc ,
16+ goldenWithHaskellDocFormatter ,
1617 def ,
1718 runSessionWithServer ,
1819 runSessionWithServerFormatter ,
@@ -90,6 +91,25 @@ goldenWithHaskellDoc plugin title testDataDir path desc ext act =
9091 act doc
9192 documentContents doc
9293
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+
93113runSessionWithServer :: PluginDescriptor IdeState -> FilePath -> Session a -> IO a
94114runSessionWithServer plugin = runSessionWithServer' [plugin] def def fullCaps
95115
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ tests = testGroup "brittany"
3131 ]
3232
3333brittanyGolden :: 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"
3535
3636testDataDir :: FilePath
3737testDataDir = " test" </> " testdata"
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ tests = testGroup "floskell"
2424 ]
2525
2626goldenWithFloskell :: 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"
2828
2929testDataDir :: FilePath
3030testDataDir = " test" </> " testdata"
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ tests = testGroup "fourmolu"
2424 ]
2525
2626goldenWithFourmolu :: 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"
2828
2929testDataDir :: FilePath
3030testDataDir = " test" </> " testdata"
Original file line number Diff line number Diff line change 1- module Format where
1+ module Fourmolu where
22
33import Data.List
44
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ tests = testGroup "ormolu"
2323 ]
2424
2525goldenWithOrmolu :: 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"
2727
2828testDataDir :: FilePath
2929testDataDir = " test" </> " testdata"
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ tests = testGroup "stylish-haskell"
2222 ]
2323
2424goldenWithStylishHaskell :: 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"
2626
2727testDataDir :: FilePath
28- testDataDir = " test" </> " data "
28+ testDataDir = " test" </> " testdata "
You can’t perform that action at this time.
0 commit comments