mark inactive players in playerName

This commit is contained in:
Jonathan Lamothe 2020-01-11 01:27:01 -05:00
parent e38275aefe
commit 461fb5d942
2 changed files with 12 additions and 4 deletions

View File

@ -49,8 +49,12 @@ playerDetails p = unlines $ top ++ [""] ++ table
playerName :: Player -> String
playerName p = let
prefix = if p^.pActive
then ""
else "*"
suffix = if p^.pRookie
then "*"
else ""
in p^.pName ++ suffix
in prefix ++ p^.pName ++ suffix

View File

@ -71,9 +71,13 @@ playerNameSpec = describe "playerName" $ mapM_
-- label, player, expected
[ ( "rookie", rookie, "foo*" )
, ( "non-rookie", nonRookie, "foo" )
, ( "retired", retired, "*foo" )
]
where
rookie = player True
nonRookie = player False
player r = newPlayer 1 "foo" "centre" & pRookie .~ r
rookie = player True True
nonRookie = player False True
retired = player False False
player r a = newPlayer 1 "foo" "centre"
& pRookie .~ r
& pActive .~ a