Skip to content

Commit 7759c08

Browse files
committed
Make test not sensitive to commands order
1 parent bf5108b commit 7759c08

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

test/functional/FunctionalCodeAction.hs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,16 @@ hlintTests = testGroup "hlint suggestions" [
7373

7474
_ <- waitForDiagnostics
7575

76-
(CACommand cmdApplyAll:_) <- getAllCodeActions doc
76+
(CACommand cmd:_) <- getAllCodeActions doc
7777

78-
executeCommand cmdApplyAll
78+
executeCommand cmd
79+
80+
let expectedContent = if "Apply all hints" `T.isSuffixOf` (cmd ^. L.title)
81+
then "main = undefined\nfoo = id\n"
82+
else "main = undefined\nfoo x = x\n" -- only redundant id
7983

8084
contents <- skipManyTill publishDiagnosticsNotification $ getDocumentEdit doc
81-
liftIO $ contents @?= "main = undefined\nfoo = id\n"
85+
liftIO $ contents @?= expectedContent
8286

8387
, testCase "changing configuration enables or disables hints" $ runSession hlsCommand fullCaps "test/testdata/hlint" $ do
8488
let config = def { hlintOn = True }
@@ -89,7 +93,7 @@ hlintTests = testGroup "hlint suggestions" [
8993

9094
liftIO $ length diags @?= 2
9195

92-
let config' = def { hlintOn = False}
96+
let config' = def { hlintOn = False }
9397
sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (toJSON config'))
9498

9599
_ <- waitForDiagnosticsSource "typecheck"

0 commit comments

Comments
 (0)