Revision 80a0546b htest/Test/Ganeti/Utils.hs

b/htest/Test/Ganeti/Utils.hs
1
{-# LANGUAGE TemplateHaskell #-}
1
{-# LANGUAGE TemplateHaskell, CPP #-}
2 2
{-# OPTIONS_GHC -fno-warn-orphans #-}
3 3

  
4 4
{-| Unittests for ganeti-htools.
......
34 34
import Data.Char (isSpace)
35 35
import Data.List
36 36
import qualified Text.JSON as J
37
#ifndef NO_REGEX_PCRE
38
import Text.Regex.PCRE
39
#endif
37 40

  
38 41
import Test.Ganeti.TestHelper
39 42
import Test.Ganeti.TestCommon
40 43

  
41 44
import Ganeti.BasicTypes
45
import qualified Ganeti.Constants as C
42 46
import qualified Ganeti.JSON as JSON
43 47
import Ganeti.Utils
44 48

  
......
219 223
              rStripSpace "" ==? ""
220 224
          ]
221 225

  
226
#ifndef NO_REGEX_PCRE
227
-- | Tests that the newUUID function produces valid UUIDs.
228
case_new_uuid :: Assertion
229
case_new_uuid = do
230
  uuid <- newUUID
231
  assertBool "newUUID" $ uuid =~ C.uuidRegex
232
#endif
233

  
222 234
-- | Test list for the Utils module.
223 235
testSuite "Utils"
224 236
            [ 'prop_commaJoinSplit
......
235 247
            , 'prop_niceSort_numbers
236 248
            , 'prop_niceSortKey_equiv
237 249
            , 'prop_rStripSpace
250
#ifndef NO_REGEX_PCRE
251
            , 'case_new_uuid
252
#endif
238 253
            ]

Also available in: Unified diff