@@ -19,7 +19,6 @@ module Test.Hls.Util
19
19
, fromAction
20
20
, fromCommand
21
21
, getCompletionByLabel
22
- , getHspecFormattedConfig
23
22
, ghcVersion , GhcVersion (.. )
24
23
, hostOS , OS (.. )
25
24
, matchesCurrentEnv , EnvSpec (.. )
@@ -50,9 +49,7 @@ import Control.Monad.IO.Class
50
49
import qualified Data.Aeson as A
51
50
import Data.Bool (bool )
52
51
import Data.Default
53
- import Data.List (intercalate )
54
52
import Data.List.Extra (find )
55
- import Data.Maybe
56
53
import qualified Data.Set as Set
57
54
import qualified Data.Text as T
58
55
import Development.IDE (GhcVersion (.. ), ghcVersion )
@@ -66,15 +63,11 @@ import System.FilePath
66
63
import System.IO.Temp
67
64
import System.Info.Extra (isMac , isWindows )
68
65
import System.Time.Extra (Seconds , sleep )
69
- import Test.Hspec.Core.Formatters hiding (Seconds )
70
- import Test.Hspec.Runner
71
66
import Test.Tasty (TestTree )
72
67
import Test.Tasty.ExpectedFailure (expectFailBecause ,
73
68
ignoreTestBecause )
74
69
import Test.Tasty.HUnit (Assertion , assertFailure ,
75
70
(@?=) )
76
- import Text.Blaze.Internal hiding (null )
77
- import Text.Blaze.Renderer.String (renderMarkup )
78
71
79
72
noLiteralCaps :: C. ClientCapabilities
80
73
noLiteralCaps = def { C. _textDocument = Just textDocumentCaps }
@@ -167,88 +160,6 @@ hieYamlCradleDirectContents = unlines
167
160
]
168
161
169
162
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
-
252
163
-- ---------------------------------------------------------------------
253
164
254
165
flushStackEnvironment :: IO ()
0 commit comments