flag inactive goalies in goalieName
This commit is contained in:
parent
461fb5d942
commit
7923827d22
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user