esqueleto/test/Common/Test/Select.hs
Matt Parsons e145be999a
Consolidate Tests (#261)
* Consolidate Tests

* stylish-haskell

* woops

* lol
2021-05-27 14:38:02 -06:00

27 lines
834 B
Haskell

module Common.Test.Select where
import Common.Test.Import
testSelect :: Run -> Spec
testSelect run = do
describe "select" $ do
it "works for a single value" $
run $ do
ret <- select $ return $ val (3 :: Int)
liftIO $ ret `shouldBe` [ Value 3 ]
it "works for a pair of a single value and ()" $
run $ do
ret <- select $ return (val (3 :: Int), ())
liftIO $ ret `shouldBe` [ (Value 3, ()) ]
it "works for a single ()" $
run $ do
ret <- select $ return ()
liftIO $ ret `shouldBe` [ () ]
it "works for a single NULL value" $
run $ do
ret <- select $ return nothing
liftIO $ ret `shouldBe` [ Value (Nothing :: Maybe Int) ]