Revision 72747d91 test/hs/Test/Ganeti/TestCommon.hs

b/test/hs/Test/Ganeti/TestCommon.hs
4 4

  
5 5
{-
6 6

  
7
Copyright (C) 2009, 2010, 2011, 2012 Google Inc.
7
Copyright (C) 2009, 2010, 2011, 2012, 2013 Google Inc.
8 8

  
9 9
This program is free software; you can redistribute it and/or modify
10 10
it under the terms of the GNU General Public License as published by
......
294 294
readTestData filename = do
295 295
    name <- testDataFilename "/test/data/" filename
296 296
    readFile name
297

  
298
-- | Generate arbitrary values in the IO monad. This is a simple
299
-- wrapper over 'sample''.
300
genSample :: Gen a -> IO a
301
genSample gen = do
302
  values <- sample' gen
303
  case values of
304
    [] -> error "sample' returned an empty list of values??"
305
    x:_ -> return x

Also available in: Unified diff