File: Select.hs

package info (click to toggle)
haskell-esqueleto 3.6.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 732 kB
  • sloc: haskell: 9,857; makefile: 3
file content (22 lines) | stat: -rw-r--r-- 741 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
module Common.Test.Select where

import Common.Test.Import

testSelect :: SpecDb
testSelect = do
    describe "select" $ do
        itDb "works for a single value" $ do
            ret <- select $ return $ val (3 :: Int)
            asserting $ ret `shouldBe` [ Value 3 ]

        itDb "works for a pair of a single value and ()" $ do
            ret <- select $ return (val (3 :: Int), ())
            asserting $ ret `shouldBe` [ (Value 3, ()) ]

        itDb "works for a single ()" $ do
            ret <- select $ return ()
            asserting $ ret `shouldBe` [ () ]

        itDb "works for a single NULL value" $ do
            ret <- select $ return nothing
            asserting $ ret `shouldBe` [ Value (Nothing :: Maybe Int) ]