We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b6e4584 commit 9fe4c60Copy full SHA for 9fe4c60
content/languages/haskell/hspec.md
@@ -1,4 +1,38 @@
1
---
2
-title: Hspec
3
kind: reference
+sidebar: "language:haskell"
4
+prev: /languages/haskell/
5
+languages: [haskell]
6
+tags:
7
+ - testing
8
9
+
10
+# HSpec
11
12
+## Basic Setup
13
14
+### Solution Code
15
16
+```haskell
17
+module Example where
18
19
+add :: Num a => a -> a -> a
20
+add = (+)
21
+```
22
23
+### Test Fixture
24
25
26
+module ExampleSpec where -- test module name MUST end with Spec
27
+import Test.Hspec
28
+import Example
29
30
+spec :: Spec -- `spec` is required
31
+spec = do
32
+ describe "Example" $ do
33
+ it "add a b" $ do
34
+ (add 1 1) `shouldBe` (2 :: Integer)
35
36
+main :: IO () -- `main` is optional
37
+main = hspec spec
38
0 commit comments