File tree 2 files changed +6
-1
lines changed
hls-test-utils/src/Test/Hls
plugins/hls-cabal-plugin/test
2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ module Test.Hls.Util
36
36
, inspectCodeAction
37
37
, inspectCommand
38
38
, inspectDiagnostic
39
+ , inspectDiagnosticAny
39
40
, waitForDiagnosticsFrom
40
41
, waitForDiagnosticsFromSource
41
42
, waitForDiagnosticsFromSourceWithTimeout
@@ -247,6 +248,10 @@ inspectDiagnostic :: [Diagnostic] -> [T.Text] -> IO Diagnostic
247
248
inspectDiagnostic diags s = onMatch diags (\ ca -> all (`T.isInfixOf` (ca ^. L. message)) s) err
248
249
where err = " expected diagnostic matching '" ++ show s ++ " ' but did not find one"
249
250
251
+ inspectDiagnosticAny :: [Diagnostic ] -> [T. Text ] -> IO Diagnostic
252
+ inspectDiagnosticAny diags s = onMatch diags (\ ca -> any (`T.isInfixOf` (ca ^. L. message)) s) err
253
+ where err = " expected diagnostic matching one of'" ++ show s ++ " ' but did not find one"
254
+
250
255
expectDiagnostic :: [Diagnostic ] -> [T. Text ] -> IO ()
251
256
expectDiagnostic diags s = void $ inspectDiagnostic diags s
252
257
Original file line number Diff line number Diff line change @@ -110,7 +110,7 @@ pluginTests =
110
110
, runCabalTestCaseSession " Publishes Diagnostics on unsupported cabal version as Warning" " " $ do
111
111
_ <- openDoc " unsupportedVersion.cabal" " cabal"
112
112
diags <- cabalCaptureKick
113
- unknownVersionDiag <- liftIO $ inspectDiagnostic diags [" Unsupported cabal-version 99999.0" ]
113
+ unknownVersionDiag <- liftIO $ inspectDiagnosticAny diags [" Unsupported cabal-version 99999.0 " , " Unsupported cabal format version in cabal-version field: 99999.0" ]
114
114
liftIO $ do
115
115
length diags @?= 1
116
116
unknownVersionDiag ^. L. range @?= Range (Position 0 0 ) (Position 1 0 )
You can’t perform that action at this time.
0 commit comments