Skip to content

Commit 78305f2

Browse files
authored
Remove getHspecFormattedConfig which is no longer used (#2721)
1 parent 4018b68 commit 78305f2

File tree

2 files changed

+0
-91
lines changed

2 files changed

+0
-91
lines changed

Diff for: hls-test-utils/hls-test-utils.cabal

-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ library
4444
, ghcide ^>=1.6
4545
, hls-graph
4646
, hls-plugin-api ^>=1.3
47-
, hspec <2.8
48-
, hspec-core
4947
, lens
5048
, lsp ^>=1.4
5149
, lsp-test ^>=0.14

Diff for: hls-test-utils/src/Test/Hls/Util.hs

-89
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ module Test.Hls.Util
1919
, fromAction
2020
, fromCommand
2121
, getCompletionByLabel
22-
, getHspecFormattedConfig
2322
, ghcVersion, GhcVersion(..)
2423
, hostOS, OS(..)
2524
, matchesCurrentEnv, EnvSpec(..)
@@ -50,9 +49,7 @@ import Control.Monad.IO.Class
5049
import qualified Data.Aeson as A
5150
import Data.Bool (bool)
5251
import Data.Default
53-
import Data.List (intercalate)
5452
import Data.List.Extra (find)
55-
import Data.Maybe
5653
import qualified Data.Set as Set
5754
import qualified Data.Text as T
5855
import Development.IDE (GhcVersion(..), ghcVersion)
@@ -66,15 +63,11 @@ import System.FilePath
6663
import System.IO.Temp
6764
import System.Info.Extra (isMac, isWindows)
6865
import System.Time.Extra (Seconds, sleep)
69-
import Test.Hspec.Core.Formatters hiding (Seconds)
70-
import Test.Hspec.Runner
7166
import Test.Tasty (TestTree)
7267
import Test.Tasty.ExpectedFailure (expectFailBecause,
7368
ignoreTestBecause)
7469
import Test.Tasty.HUnit (Assertion, assertFailure,
7570
(@?=))
76-
import Text.Blaze.Internal hiding (null)
77-
import Text.Blaze.Renderer.String (renderMarkup)
7871

7972
noLiteralCaps :: C.ClientCapabilities
8073
noLiteralCaps = def { C._textDocument = Just textDocumentCaps }
@@ -167,88 +160,6 @@ hieYamlCradleDirectContents = unlines
167160
]
168161

169162

170-
-- ---------------------------------------------------------------------
171-
172-
getHspecFormattedConfig :: String -> IO Config
173-
getHspecFormattedConfig name = do
174-
-- https://circleci.com/docs/2.0/env-vars/#built-in-environment-variables
175-
isCI <- isJust <$> lookupEnv "CI"
176-
177-
-- Only use the xml formatter on CI since it hides console output
178-
if isCI
179-
then do
180-
let subdir = "test-results" </> name
181-
createDirectoryIfMissing True subdir
182-
183-
return $ defaultConfig { configFormatter = Just xmlFormatter
184-
, configOutputFile = Right $ subdir </> "results.xml"
185-
}
186-
else return defaultConfig
187-
188-
-- | A Hspec formatter for CircleCI.
189-
-- Originally from https://github.com/LeastAuthority/hspec-jenkins
190-
xmlFormatter :: Formatter
191-
xmlFormatter = silent {
192-
headerFormatter = do
193-
writeLine "<?xml version='1.0' encoding='UTF-8'?>"
194-
writeLine "<testsuite>"
195-
, exampleSucceeded
196-
, exampleFailed
197-
, examplePending
198-
, footerFormatter = writeLine "</testsuite>"
199-
}
200-
where
201-
202-
#if MIN_VERSION_hspec(2,5,0)
203-
exampleSucceeded path _ =
204-
#else
205-
exampleSucceeded path =
206-
#endif
207-
writeLine $ renderMarkup $ testcase path ""
208-
209-
#if MIN_VERSION_hspec(2,5,0)
210-
exampleFailed path _ err =
211-
#else
212-
exampleFailed path (Left err) =
213-
writeLine $ renderMarkup $ testcase path $
214-
failure ! message (show err) $ ""
215-
exampleFailed path (Right err) =
216-
#endif
217-
writeLine $ renderMarkup $ testcase path $
218-
failure ! message (reasonAsString err) $ ""
219-
220-
#if MIN_VERSION_hspec(2,5,0)
221-
examplePending path _ reason =
222-
#else
223-
examplePending path reason =
224-
#endif
225-
writeLine $ renderMarkup $ testcase path $
226-
case reason of
227-
Just desc -> skipped ! message desc $ ""
228-
Nothing -> skipped ""
229-
230-
failure, skipped :: Markup -> Markup
231-
failure = customParent "failure"
232-
skipped = customParent "skipped"
233-
234-
name, className, message :: String -> Attribute
235-
name = customAttribute "name" . stringValue
236-
className = customAttribute "classname" . stringValue
237-
message = customAttribute "message" . stringValue
238-
239-
testcase :: Path -> Markup -> Markup
240-
testcase (xs,x) = customParent "testcase" ! name x ! className (intercalate "." xs)
241-
242-
reasonAsString :: FailureReason -> String
243-
reasonAsString NoReason = "no reason given"
244-
reasonAsString (Reason x) = x
245-
reasonAsString (ExpectedButGot Nothing expected got) = "Expected " ++ expected ++ " but got " ++ got
246-
reasonAsString (ExpectedButGot (Just src) expected got) = src ++ " expected " ++ expected ++ " but got " ++ got
247-
#if MIN_VERSION_hspec(2,5,0)
248-
reasonAsString (Error Nothing err ) = show err
249-
reasonAsString (Error (Just s) err) = s ++ show err
250-
#endif
251-
252163
-- ---------------------------------------------------------------------
253164

254165
flushStackEnvironment :: IO ()

0 commit comments

Comments
 (0)