basic love

This commit is contained in:
2025-11-26 16:20:31 +09:00
parent 7bf66c6de0
commit 68adfeb1d8
16 changed files with 308 additions and 73 deletions

16
test/Data/TypesSpec.hs Normal file
View 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"

View File

@@ -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
View File

@@ -0,0 +1 @@
{-# OPTIONS_GHC -F -pgmF hspec-discover #-}