on master help sign in
Avoid fragile CPP in testsuite
bfaf1efHerbert Valerio Riedel
uuid-types/tests/ByteOrder.hsdeleted−16
@@ -1,16 +0,0 @@
1−{-# LANGUAGE CPP #-}
2−
3−-- stolen from GHC.ByteOrder
4−module ByteOrder where
5−
6−#include "MachDeps.h"
7−
8−-- | Byte ordering.
9−data ByteOrder = BigEndian | LittleEndian deriving (Eq, Ord, Bounded, Enum, Read, Show)
10−
11−targetByteOrder :: ByteOrder
12−#if defined(WORDS_BIGENDIAN)
13−targetByteOrder = BigEndian
14−#else
15−targetByteOrder = LittleEndian
16−#endif
uuid-types/tests/TestUUID.hs+1−1
@@ -12,6 +12,7 @@ import qualified Data.UUID.Types as U
12import Data.Word
12import Data.Word
13import Foreign (alloca, castPtr, peek, poke,
13import Foreign (alloca, castPtr, peek, poke,
14 sizeOf)
14 sizeOf)
15+import GHC.ByteOrder (ByteOrder(..), targetByteOrder)
15import System.IO.Unsafe (unsafePerformIO)
16import System.IO.Unsafe (unsafePerformIO)
16
17
17import Test.QuickCheck (Arbitrary (arbitrary), choose)
18import Test.QuickCheck (Arbitrary (arbitrary), choose)
@@ -20,7 +21,6 @@ import Test.Tasty (TestTree, defaultMain, testGroup)
20import Test.Tasty.HUnit (assertBool, testCase, (@=?), (@?=))
21import Test.Tasty.HUnit (assertBool, testCase, (@=?), (@?=))
21import Test.Tasty.QuickCheck (testProperty)
22import Test.Tasty.QuickCheck (testProperty)
22
23
23−import ByteOrder
24
24
25-- orphan
25-- orphan
26instance Arbitrary U.UUID where
26instance Arbitrary U.UUID where
uuid-types/uuid-types.cabal+1−1
@@ -58,7 +58,6 @@ Library
58test-suite testuuid
58test-suite testuuid
59 type: exitcode-stdio-1.0
59 type: exitcode-stdio-1.0
60 main-is: TestUUID.hs
60 main-is: TestUUID.hs
61− other-modules: ByteOrder
62 hs-source-dirs: tests
61 hs-source-dirs: tests
63 default-language: Haskell2010
62 default-language: Haskell2010
64 other-extensions: ViewPatterns
63 other-extensions: ViewPatterns
@@ -71,6 +70,7 @@ test-suite testuuid
71 , bytestring
70 , bytestring
72 -- deps w/o inherited constraints
71 -- deps w/o inherited constraints
73 , QuickCheck == 2.11.*
72 , QuickCheck == 2.11.*
73+ , ghc-byteorder == 4.11.*
74 , tasty == 1.0.*
74 , tasty == 1.0.*
75 , tasty-hunit == 0.10.*
75 , tasty-hunit == 0.10.*
76 , tasty-quickcheck == 0.10.*
76 , tasty-quickcheck == 0.10.*