flag inactive goalies in goalieName

This commit is contained in:
Jonathan Lamothe 2020-01-11 01:46:40 -05:00
parent 461fb5d942
commit 7923827d22
2 changed files with 15 additions and 5 deletions

View File

@ -51,8 +51,12 @@ goalieDetails g = let
goalieName :: Goalie -> String goalieName :: Goalie -> String
goalieName g = let goalieName g = let
prefix = if g^.gActive
then ""
else "*"
suffix = if g^.gRookie suffix = if g^.gRookie
then "*" then "*"
else "" else ""
in g^.gName ++ suffix in prefix ++ g^.gName ++ suffix

View File

@ -76,10 +76,16 @@ goalieNameSpec = describe "goalieName" $ mapM_
it ("should be " ++ expected) $ it ("should be " ++ expected) $
goalieName g `shouldBe` expected) goalieName g `shouldBe` expected)
-- label, goalie, expected -- label, goalie, expected
[ ( "rookie", goalie True, "foo*" ) [ ( "rookie", rookie, "foo*" )
, ( "non-rookie", goalie False, "foo" ) , ( "non-rookie", active, "foo" )
, ( "retired", retired, "*foo" )
] ]
where where
goalie r = newGoalie 1 "foo" & gRookie .~ r rookie = goalie True True
active = goalie False True
retired = goalie False False
goalie r a = newGoalie 1 "foo"
& gRookie .~ r
& gActive .~ a