basic love
This commit is contained in:
16
test/Data/TypesSpec.hs
Normal file
16
test/Data/TypesSpec.hs
Normal file
@@ -0,0 +1,16 @@
|
||||
module Data.TypesSpec (spec) where
|
||||
|
||||
import Data.Types (UserId (..))
|
||||
import Serialize.Str
|
||||
import Test.Hspec
|
||||
|
||||
spec :: Spec
|
||||
spec = describe "userId StringTrans" $ do
|
||||
it "fromStr should convert String to UserId::Discord" $ do
|
||||
fromStr "d:muffin" `shouldBe` Just (Discord "muffin")
|
||||
|
||||
it "fromStr should fail conversion" $ do
|
||||
(fromStr "muffin" :: Maybe UserId) `shouldBe` Nothing
|
||||
|
||||
it "toStr should convert UserId to String" $ do
|
||||
toStr (Discord "muffin") `shouldBe` "d:muffin"
|
||||
26
test/Main.hs
26
test/Main.hs
@@ -1,26 +0,0 @@
|
||||
{-# LANGUAGE FlexibleInstances #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE RecordWildCards #-}
|
||||
{-# LANGUAGE ScopedTypeVariables #-}
|
||||
|
||||
module Main (main) where
|
||||
|
||||
import Data.List (isInfixOf)
|
||||
import Test.Tasty
|
||||
import Test.Tasty.HUnit
|
||||
import Test.Tasty.QuickCheck as QC
|
||||
|
||||
main :: IO ()
|
||||
main = spec >>= defaultMain
|
||||
|
||||
spec :: IO TestTree
|
||||
spec = return $ testGroup "example tests" [baseTests]
|
||||
|
||||
baseTests :: TestTree
|
||||
baseTests =
|
||||
testGroup
|
||||
"Base"
|
||||
[ QC.testProperty "example function works" $
|
||||
\(num :: Integer) ->
|
||||
num * 0 == 0
|
||||
]
|
||||
1
test/Spec.hs
Normal file
1
test/Spec.hs
Normal file
@@ -0,0 +1 @@
|
||||
{-# OPTIONS_GHC -F -pgmF hspec-discover #-}
|
||||
Reference in New Issue
Block a user