File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed
hls-test-utils/src/Test/Hls
plugins/hls-cabal-plugin/test Expand file tree Collapse file tree 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
3636 , inspectCodeAction
3737 , inspectCommand
3838 , inspectDiagnostic
39+ , inspectDiagnosticAny
3940 , waitForDiagnosticsFrom
4041 , waitForDiagnosticsFromSource
4142 , waitForDiagnosticsFromSourceWithTimeout
@@ -247,6 +248,10 @@ inspectDiagnostic :: [Diagnostic] -> [T.Text] -> IO Diagnostic
247248inspectDiagnostic diags s = onMatch diags (\ ca -> all (`T.isInfixOf` (ca ^. L. message)) s) err
248249 where err = " expected diagnostic matching '" ++ show s ++ " ' but did not find one"
249250
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+
250255expectDiagnostic :: [Diagnostic ] -> [T. Text ] -> IO ()
251256expectDiagnostic diags s = void $ inspectDiagnostic diags s
252257
Original file line number Diff line number Diff line change @@ -110,7 +110,7 @@ pluginTests =
110110 , runCabalTestCaseSession " Publishes Diagnostics on unsupported cabal version as Warning" " " $ do
111111 _ <- openDoc " unsupportedVersion.cabal" " cabal"
112112 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" ]
114114 liftIO $ do
115115 length diags @?= 1
116116 unknownVersionDiag ^. L. range @?= Range (Position 0 0 ) (Position 1 0 )
You can’t perform that action at this time.
0 commit comments