aboutsummaryrefslogtreecommitdiffstats
path: root/tests/Properties/Failure.hs
blob: fc7a3598273a947dffe5be7a2837385ed3b8884e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
module Properties.Failure where

import XMonad.StackSet hiding (filter)

import qualified Control.Exception.Extensible as C
import System.IO.Unsafe

-- ---------------------------------------------------------------------
-- testing for failure

-- and help out hpc
prop_abort x = unsafePerformIO $ C.catch (abort "fail")
                                         (\(C.SomeException e) -> return $  show e == "xmonad: StackSet: fail" )
   where
     _ = x :: Int

-- new should fail with an abort
prop_new_abort x = unsafePerformIO $ C.catch f
                                         (\(C.SomeException e) -> return $ show e == "xmonad: StackSet: non-positive argument to StackSet.new" )
   where
     f = new undefined{-layout-} [] [] `seq` return False

     _ = x :: Int

-- TODO: Fix this?
-- prop_view_should_fail = view {- with some bogus data -}