on master help sign in
Avoid fragile CPP in testsuite
commitbfaf1ef7248a2cb1cd24417b72f7564dde5817fa authorHerbert Valerio Riedel <hvr@gnu.org> dateSat 16 May 2020, 09:50 (6 years ago) parentfc16f9c
3 files changed+2−18
uuid-types/tests/ByteOrder.hs−16 uuid-types/tests/TestUUID.hs+1−1 uuid-types/uuid-types.cabal+1−1
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
1212import Data.Word
1313import Foreign (alloca, castPtr, peek, poke,
1414 sizeOf)
15+import GHC.ByteOrder (ByteOrder(..), targetByteOrder)
1516import System.IO.Unsafe (unsafePerformIO)
1617
1718import Test.QuickCheck (Arbitrary (arbitrary), choose)
@@ -20,7 +21,6 @@ import Test.Tasty (TestTree, defaultMain, testGroup)
2021import Test.Tasty.HUnit (assertBool, testCase, (@=?), (@?=))
2122import Test.Tasty.QuickCheck (testProperty)
2223
23−import ByteOrder
2424
2525-- orphan
2626instance Arbitrary U.UUID where
uuid-types/uuid-types.cabal+1−1
@@ -58,7 +58,6 @@ Library
5858test-suite testuuid
5959 type: exitcode-stdio-1.0
6060 main-is: TestUUID.hs
61− other-modules: ByteOrder
6261 hs-source-dirs: tests
6362 default-language: Haskell2010
6463 other-extensions: ViewPatterns
@@ -71,6 +70,7 @@ test-suite testuuid
7170 , bytestring
7271 -- deps w/o inherited constraints
7372 , QuickCheck == 2.11.*
73+ , ghc-byteorder == 4.11.*
7474 , tasty == 1.0.*
7575 , tasty-hunit == 0.10.*
7676 , tasty-quickcheck == 0.10.*