feat(xanthous): Add a method to get the name for a type of entity
I didn't end up using this directly for the thing I was doing, but it still seems generally useful enough that I'm keeping it around for now Change-Id: I05c8902d75845f2230ec2373a9677d61cfaafafd Reviewed-on: https://cl.tvl.fyi/c/depot/+/3206 Reviewed-by: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI
This commit is contained in:
parent
26d7dadded
commit
30d83d7c82
4 changed files with 35 additions and 1 deletions
25
users/grfn/xanthous/test/Xanthous/Game/StateSpec.hs
Normal file
25
users/grfn/xanthous/test/Xanthous/Game/StateSpec.hs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
--------------------------------------------------------------------------------
|
||||
module Xanthous.Game.StateSpec (main, test) where
|
||||
--------------------------------------------------------------------------------
|
||||
import Test.Prelude
|
||||
--------------------------------------------------------------------------------
|
||||
import Xanthous.Game.State
|
||||
import Xanthous.Entities.Raws (raws, entityFromRaw)
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
main :: IO ()
|
||||
main = defaultMain test
|
||||
|
||||
test :: TestTree
|
||||
test = testGroup "Xanthous.Game.StateSpec"
|
||||
[ testGroup "entityTypeName"
|
||||
[ testCase "for a creature" $
|
||||
let gormlakRaw = raws ^?! ix "gormlak"
|
||||
creature = entityFromRaw gormlakRaw
|
||||
in entityTypeName creature @?= "Creature"
|
||||
, testCase "for an item" $
|
||||
let stickRaw = raws ^?! ix "stick"
|
||||
item = entityFromRaw stickRaw
|
||||
in entityTypeName item @?= "Item"
|
||||
]
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue