File: CompatSpec.hs

package info (click to toggle)
haskell-hspec 1.11.0-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 288 kB
  • sloc: haskell: 2,646; makefile: 5
file content (33 lines) | stat: -rw-r--r-- 906 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
{-# LANGUAGE DeriveDataTypeable #-}
module Test.Hspec.CompatSpec (main, spec) where

import           Helper
import           System.SetEnv

import           Test.Hspec.Compat
import           Data.Typeable

data SomeType = SomeType
  deriving Typeable

main :: IO ()
main = hspec spec

spec :: Spec
spec = do
  describe "showType" $ do
    it "shows unqualified name of type" $ do
      showType SomeType `shouldBe` "SomeType"

  describe "showFullType (currently unused)" $ do
    it "shows fully qualified name of type" $ do
      showFullType SomeType `shouldBe` "Test.Hspec.CompatSpec.SomeType"

  describe "lookupEnv" $ do
    it "returns value of specified environment variable" $ do
      setEnv "FOO" "bar"
      lookupEnv "FOO" `shouldReturn` Just "bar"

    it "returns Nothing if specified environment variable is not set" $ do
      unsetEnv "FOO"
      lookupEnv "FOO" `shouldReturn` Nothing