Revision d31193c3 test/hs/Test/Ganeti/OpCodes.hs

b/test/hs/Test/Ganeti/OpCodes.hs
441 441
-- | Check that Python and Haskell defined the same opcode list.
442 442
case_AllDefined :: HUnit.Assertion
443 443
case_AllDefined = do
444
  let py_ops = sort C.opcodesOpIds
445
      hs_ops = sort OpCodes.allOpIDs
444
  py_stdout <-
445
     runPython "from ganeti import opcodes\n\
446
               \from ganeti import serializer\n\
447
               \import sys\n\
448
               \print serializer.Dump([opid for opid in opcodes.OP_MAPPING])\n" ""
449
     >>= checkPythonResult
450
  py_ops <- case J.decode py_stdout::J.Result [String] of
451
               J.Ok ops -> return ops
452
               J.Error msg ->
453
                 HUnit.assertFailure ("Unable to decode opcode names: " ++ msg)
454
                 -- this already raised an expection, but we need it
455
                 -- for proper types
456
                 >> fail "Unable to decode opcode names"
457
  let hs_ops = sort OpCodes.allOpIDs
446 458
      extra_py = py_ops \\ hs_ops
447 459
      extra_hs = hs_ops \\ py_ops
448 460
  HUnit.assertBool ("Missing OpCodes from the Haskell code:\n" ++

Also available in: Unified diff