-
Notifications
You must be signed in to change notification settings - Fork 0
/
hgist_test.hs
30 lines (25 loc) · 1.06 KB
/
hgist_test.hs
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
{-# LANGUAGE OverloadedStrings #-}
import Test.HUnit
import HGist (Gist(..), File(..), decodeGistList, showGist)
tests = test [
"(decodeGistList)" ~:
[Gist {gistId = "1",
description = Just "My description",
files = [ File {filename = "myfile.hs"}]}]
~=?
decodeGistList "[{\"id\": \"1\", \"description\": \"My description\", \"files\": {\"myfile.hs\": {\"filename\": \"myfile.hs\"}}}]",
"(decodeGistList No description)" ~:
[Gist {gistId = "2",
description = Nothing,
files = [ File {filename = "myfile.hs"}]}]
~=?
decodeGistList "[{\"id\": \"2\", \"description\": null , \"files\": {\"myfile.hs\": {\"filename\": \"myfile.hs\"}}}]",
"(showGist)" ~:
"3: My description\n myFile.hs, myOtherFile.hs"
~=?
showGist Gist {
gistId = "3",
description = Just "My description",
files = [File {filename = "myFile.hs"}, File {filename = "myOtherFile.hs"}]}
]
main = runTestTT tests