@@ -97,23 +97,16 @@ goldenWithHaskellDoc plugin title testDataDir path desc ext act =
9797 documentContents doc
9898
9999goldenWithHaskellDocFormatter
100- :: PluginDescriptor IdeState
101- -> String
102- -> TestName
103- -> FilePath
104- -> FilePath
105- -> FilePath
106- -> FilePath
100+ :: PluginDescriptor IdeState -- ^ Formatter plugin to be used
101+ -> String -- ^ Name of the formatter to be used
102+ -> TestName -- ^ Title of the test
103+ -> FilePath -- ^ Directory of the test data to be used
104+ -> FilePath -- ^ Path to the testdata to be used within the directory
105+ -> FilePath -- ^ Additional suffix to be appended to the output file
106+ -> FilePath -- ^ Extension of the output file
107107 -> (TextDocumentIdentifier -> Session () )
108108 -> TestTree
109- goldenWithHaskellDocFormatter plugin formatter title testDataDir path desc ext act =
110- goldenGitDiff title (testDataDir </> path <.> desc <.> ext)
111- $ runSessionWithServerFormatter plugin formatter testDataDir
112- $ TL. encodeUtf8 . TL. fromStrict
113- <$> do
114- doc <- openDoc (path <.> ext) " haskell"
115- act doc
116- documentContents doc
109+ goldenWithHaskellDocFormatter = goldenWithDocFormatter " haskell"
117110
118111runSessionWithServer :: PluginDescriptor IdeState -> FilePath -> Session a -> IO a
119112runSessionWithServer plugin = runSessionWithServer' [plugin] def def fullCaps
@@ -127,21 +120,34 @@ runSessionWithServerFormatter plugin formatter =
127120 fullCaps
128121
129122goldenWithCabalDocFormatter
130- :: PluginDescriptor IdeState
131- -> String
132- -> TestName
133- -> FilePath
134- -> FilePath
135- -> FilePath
136- -> FilePath
123+ :: PluginDescriptor IdeState -- ^ Formatter plugin to be used
124+ -> String -- ^ Name of the formatter to be used
125+ -> TestName -- ^ Title of the test
126+ -> FilePath -- ^ Directory of the test data to be used
127+ -> FilePath -- ^ Path to the testdata to be used within the directory
128+ -> FilePath -- ^ Additional suffix to be appended to the output file
129+ -> FilePath -- ^ Extension of the output file
130+ -> (TextDocumentIdentifier -> Session () )
131+ -> TestTree
132+ goldenWithCabalDocFormatter = goldenWithDocFormatter " cabal"
133+
134+ goldenWithDocFormatter
135+ :: T. Text -- ^ Type of the document to open
136+ -> PluginDescriptor IdeState -- ^ Formatter plugin to be used
137+ -> String -- ^ Name of the formatter to be used
138+ -> TestName -- ^ Title of the test
139+ -> FilePath -- ^ Directory of the test data to be used
140+ -> FilePath -- ^ Path to the testdata to be used within the directory
141+ -> FilePath -- ^ Additional suffix to be appended to the output file
142+ -> FilePath -- ^ Extension of the output file
137143 -> (TextDocumentIdentifier -> Session () )
138144 -> TestTree
139- goldenWithCabalDocFormatter plugin formatter title testDataDir path desc ext act =
145+ goldenWithDocFormatter filetype plugin formatter title testDataDir path desc ext act =
140146 goldenGitDiff title (testDataDir </> path <.> desc <.> ext)
141147 $ runSessionWithServerFormatter plugin formatter testDataDir
142148 $ TL. encodeUtf8 . TL. fromStrict
143149 <$> do
144- doc <- openDoc (path <.> ext) " cabal "
150+ doc <- openDoc (path <.> ext) filetype
145151 act doc
146152 documentContents doc
147153
0 commit comments