Skip to content

Commit afcc3a5

Browse files
committedOct 22, 2017
Minimal library and tests
- Using hedgehog for tests - Ignore .dir-locals.el
0 parents  commit afcc3a5

7 files changed

+129
-0
lines changed
 

‎.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.stack-work/
2+
.dir-locals.el
3+
doc/.env/
4+
doc/.ensure-pip
5+
doc/.ensure-virtualenv
6+
doc/*.svg

‎README.rst

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
==========================
2+
Magic Wormhole for Haskell
3+
==========================
4+
5+
Library and command-line tools for interacting with `Magic Wormhole`_ in Haskell
6+
7+
Magic Wormhole lets you get things from one computer to another, safely.
8+
9+
.. _`Magic Wormhole`: https://github.com/warner/magic-wormhole/

‎magic-wormhole.cabal

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
-- This file has been generated from package.yaml by hpack version 0.17.1.
2+
--
3+
-- see: https://github.com/sol/hpack
4+
5+
name: magic-wormhole
6+
version: 0.1.0
7+
synopsis: Interact with Magic Wormhole
8+
description: Honestly, who can say?
9+
category: Crypto
10+
homepage: https://github.com/jml/haskell-magic-wormhole#readme
11+
bug-reports: https://github.com/jml/haskell-magic-wormhole/issues
12+
maintainer: Jonathan M. Lange <jml@mumak.net>
13+
license: Apache
14+
build-type: Simple
15+
cabal-version: >= 1.10
16+
17+
source-repository head
18+
type: git
19+
location: https://github.com/jml/haskell-magic-wormhole
20+
21+
library
22+
hs-source-dirs:
23+
src
24+
default-extensions: NoImplicitPrelude OverloadedStrings
25+
ghc-options: -Wall
26+
build-depends:
27+
base
28+
, protolude
29+
exposed-modules:
30+
MagicWormhole
31+
default-language: Haskell2010
32+
33+
test-suite tasty
34+
type: exitcode-stdio-1.0
35+
main-is: Tasty.hs
36+
hs-source-dirs:
37+
tests
38+
default-extensions: NoImplicitPrelude OverloadedStrings
39+
ghc-options: -Wall
40+
build-depends:
41+
base
42+
, protolude
43+
, hedgehog
44+
, magic-wormhole
45+
, tasty
46+
, tasty-hedgehog
47+
, tasty-hspec
48+
default-language: Haskell2010

‎package.yaml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: magic-wormhole
2+
version: 0.1.0
3+
synopsis: Interact with Magic Wormhole
4+
description: |
5+
Honestly, who can say?
6+
maintainer: Jonathan M. Lange <jml@mumak.net>
7+
license: Apache
8+
github: jml/haskell-magic-wormhole
9+
category: Crypto
10+
11+
ghc-options: -Wall
12+
default-extensions:
13+
- NoImplicitPrelude
14+
- OverloadedStrings
15+
16+
dependencies:
17+
- base
18+
- protolude
19+
20+
library:
21+
source-dirs: src
22+
23+
tests:
24+
tasty:
25+
main: Tasty.hs
26+
source-dirs: tests
27+
dependencies:
28+
- hedgehog
29+
- magic-wormhole
30+
- tasty
31+
- tasty-hedgehog
32+
- tasty-hspec
33+

‎src/MagicWormhole.hs

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module MagicWormhole (foo) where
2+
3+
import Protolude
4+
5+
foo :: Int
6+
foo = 42

‎stack.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
resolver: lts-9.9
2+
3+
packages:
4+
- .
5+
6+
extra-deps:
7+
- tasty-hedgehog-0.1.0.1

‎tests/Tasty.hs

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
module Main (main) where
2+
3+
import Protolude
4+
5+
import Hedgehog ((===), forAll, property)
6+
import qualified Hedgehog.Gen as Gen
7+
import qualified Hedgehog.Range as Range
8+
import Test.Tasty (defaultMain, testGroup)
9+
import Test.Tasty.Hedgehog (testProperty)
10+
11+
import qualified MagicWormhole
12+
13+
main :: IO ()
14+
main = defaultMain tests
15+
where
16+
tests = testGroup "magic-wormhole"
17+
[ testProperty "commutativity" $ property $ do
18+
x <- forAll $ Gen.int (Range.linear (-1000) 1000)
19+
MagicWormhole.foo + x === x + MagicWormhole.foo
20+
]

0 commit comments

Comments
 (0)
Please sign in to comment.