Skip to content

Commit

Permalink
Sort on string
Browse files Browse the repository at this point in the history
  • Loading branch information
xsebek committed Jul 13, 2024
1 parent cabb0ff commit 5a6e915
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions test/integration/TestRecipeCoverage.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
module TestRecipeCoverage where

import Control.Lens (view)
import Data.Function ((&))
import Data.List (intercalate, sort)
import Data.Set qualified as Set
import Data.Text qualified as T
import Swarm.Doc.Gen
import Swarm.Game.Entity (entityName)
import Swarm.Util (commaList, quote)
import Test.Tasty
import Test.Tasty.ExpectedFailure (expectFailBecause)
import Test.Tasty.HUnit
Expand All @@ -25,8 +26,14 @@ testRecipeCoverage =
testCase "Ensure all devices have recipes (#1268)" $ do
graphData <- classicScenarioRecipeGraphData
let nonCoveredEntities =
filter (\e -> view entityName e `notElem` ignoredEntities) . Set.toAscList $
rgAllEntities graphData `Set.difference` Set.unions (rgLevels graphData)
Set.unions (rgLevels graphData)
& Set.difference (rgAllEntities graphData)
& Set.toList
& map (view entityName)
& filter (`notElem` ignoredEntities)
& map T.unpack
& sort -- Text and String give different sort
assertBool (errMessage nonCoveredEntities) (null nonCoveredEntities)
where
errMessage missing = T.unpack $ "Missing recipes for: " <> commaList (quote . view entityName <$> missing)
errMessage missing = "Missing recipes for: " <> intercalate ", " (quote <$> missing)
quote t = concat ["\"", t, "\""]

0 comments on commit 5a6e915

Please sign in to comment.