-
-
Notifications
You must be signed in to change notification settings - Fork 85
/
hspec.scroll
35 lines (28 loc) · 830 Bytes
/
hspec.scroll
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
import ../code/conceptPage.scroll
id hspec
name Hspec
appeared 1990
tags pl
website https://hspec.github.io/
conceptDescription Hspec is a testing framework for Haskell.
country Various
originCommunity https://github.com/hspec
pygmentsHighlighter Hspec
filename haskell.py
example
-- file Spec.hs
import Test.Hspec
import Test.QuickCheck
import Control.Exception (evaluate)
main :: IO ()
main = hspec $ do
describe "Prelude.head" $ do
it "returns the first element of a list" $ do
head [23 ..] `shouldBe` (23 :: Int)
it "returns the first element of an *arbitrary* list" $
property $ \x xs -> head (x:xs) == (x :: Int)
it "throws an exception if used with an empty list" $ do
evaluate (head []) `shouldThrow` anyException
domainName hspec.github.io
awisRank
2022 4534652