Revision 20bc5360 htest/Test/Ganeti/JSON.hs

b/htest/Test/Ganeti/JSON.hs
38 38
import qualified Ganeti.BasicTypes as BasicTypes
39 39
import qualified Ganeti.JSON as JSON
40 40

  
41
prop_JSON_toArray :: [Int] -> Property
42
prop_JSON_toArray intarr =
41
prop_toArray :: [Int] -> Property
42
prop_toArray intarr =
43 43
  let arr = map J.showJSON intarr in
44 44
  case JSON.toArray (J.JSArray arr) of
45 45
    BasicTypes.Ok arr' -> arr ==? arr'
46 46
    BasicTypes.Bad err -> failTest $ "Failed to parse array: " ++ err
47 47

  
48
prop_JSON_toArrayFail :: Int -> String -> Bool -> Property
49
prop_JSON_toArrayFail i s b =
48
prop_toArrayFail :: Int -> String -> Bool -> Property
49
prop_toArrayFail i s b =
50 50
  -- poor man's instance Arbitrary JSValue
51 51
  forAll (elements [J.showJSON i, J.showJSON s, J.showJSON b]) $ \item ->
52 52
  case JSON.toArray item of
......
54 54
    BasicTypes.Ok result -> failTest $ "Unexpected parse, got " ++ show result
55 55

  
56 56
testSuite "JSON"
57
          [ 'prop_JSON_toArray
58
          , 'prop_JSON_toArrayFail
57
          [ 'prop_toArray
58
          , 'prop_toArrayFail
59 59
          ]

Also available in: Unified diff