File: HUnitTestExtended.hs

package info (click to toggle)
haskell-hunit 1.3.1.2-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 176 kB
  • ctags: 1
  • sloc: haskell: 721; makefile: 3
file content (35 lines) | stat: -rw-r--r-- 906 bytes parent folder | download | duplicates (3)
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
27
28
29
30
31
32
33
34
35
{-# LANGUAGE CPP #-}
module HUnitTestExtended (
    extendedTests
    ) where

import Test.HUnit
import HUnitTestBase

#if MIN_VERSION_base(4,9,0)
errorCall :: a
errorCall = error "error"
#endif

extendedTests :: Test
extendedTests = test [

    -- Hugs doesn't currently catch arithmetic exceptions.

    "div by 0" ~:
        expectUnspecifiedError (TestCase ((3 `div` 0 :: Integer) `seq` return ())),

    "list ref out of bounds" ~:
        expectUnspecifiedError (TestCase ([1 .. 4 :: Integer] !! 10 `seq` return ())),

#if MIN_VERSION_base(4,9,0)
    "error" ~:
        expectError "error\nCallStack (from HasCallStack):\n  error, called at tests/HUnitTestExtended.hs:11:13 in main:HUnitTestExtended" (TestCase errorCall),
#else
     "error" ~:
        expectError "error" (TestCase (error "error")),
#endif

    "tail []" ~:
        expectUnspecifiedError (TestCase (tail [] `seq` return ()))
    ]