File: OrphansSpec.hs

package info (click to toggle)
haskell-base-orphans 0.9.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 188 kB
  • sloc: haskell: 1,688; makefile: 2
file content (35 lines) | stat: -rw-r--r-- 1,086 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
34
35
{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedLists #-}
module Data.Version.OrphansSpec (main, spec) where

import Test.Hspec

import Data.Data
import Data.Orphans ()
import Data.Version

main :: IO ()
main = hspec spec

spec :: Spec
spec = do
  describe "Data Version instance" $
    it "allows obtaining a Version constructor" $
      dataTypeName (dataTypeOf (Version [1,2,3] [])) `shouldBe`
#if __GLASGOW_HASKELL__ >= 801 && __GLASGOW_HASKELL__ < 903
        -- Some old versions of GHC incorrectly return "Version" due to
        -- https://gitlab.haskell.org/ghc/ghc/-/issues/20371.
        "Version"
#elif __GLASGOW_HASKELL__ >= 910
        -- In GHC 9.10 and later, Version is defined in
        -- GHC.Internal.Data.Version (in the ghc-internal library).
        "GHC.Internal.Data.Version.Version"
#else
        -- In older versions of GHC, Version is defined in Data.Version (in the
        -- base library).
        "Data.Version.Version"
#endif

  describe "IsList Version instance" $
    it "creates a Version from an Int list" $
      [1,2,3] `shouldBe` Version [1,2,3] []