Skip to content

Commit b60ec6f

Browse files
committed
Fix ordering of completions in test
1 parent 508521a commit b60ec6f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

ghcide/test/exe/Main.hs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3418,7 +3418,8 @@ completionTest name src pos expected = testSessionWait name $ do
34183418
let compls' = [ (_label, _kind, _insertText, _additionalTextEdits) | CompletionItem{..} <- compls]
34193419
liftIO $ do
34203420
let emptyToMaybe x = if T.null x then Nothing else Just x
3421-
compls' @?= [ (l, Just k, emptyToMaybe t, at) | (l,k,t,_,_,at) <- expected]
3421+
sortOn (Lens.view Lens._1) compls' @?=
3422+
sortOn (Lens.view Lens._1) [ (l, Just k, emptyToMaybe t, at) | (l,k,t,_,_,at) <- expected]
34223423
forM_ (zip compls expected) $ \(CompletionItem{..}, (_,_,_,expectedSig, expectedDocs, _)) -> do
34233424
when expectedSig $
34243425
assertBool ("Missing type signature: " <> T.unpack _label) (isJust _detail)
@@ -3472,7 +3473,7 @@ completionNoCommandTest name src pos wanted = testSession name $ do
34723473
Nothing ->
34733474
liftIO $ assertFailure $ "Cannot find expected completion in: " <> show [_label | CompletionItem {_label} <- compls]
34743475
Just CompletionItem{..} -> liftIO . assertBool ("Expected no command but got: " <> show _command) $ null _command
3475-
3476+
34763477

34773478
topLevelCompletionTests :: [TestTree]
34783479
topLevelCompletionTests = [
@@ -3703,7 +3704,7 @@ nonLocalCompletionTests =
37033704
"already imported"
37043705
["module A where", "import Text.Printf (FormatAdjustment (ZeroPad))", "ZeroPad"]
37053706
(Position 2 4)
3706-
"ZeroPad"
3707+
"ZeroPad"
37073708
, completionNoCommandTest
37083709
"function from Prelude"
37093710
["module A where", "import Data.Maybe ()", "Nothing"]

0 commit comments

Comments
 (0)