summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam T <pxqr.sta@gmail.com>2013-06-07 01:09:37 +0400
committerSam T <pxqr.sta@gmail.com>2013-06-07 01:09:37 +0400
commit558616b7dcc8955ab08fe8b194cdd5e128aba3f4 (patch)
tree71a7c54f5f3c83bc2847c8efabf3b966e0f0800c
parent65282d73004fb45b502a5e9bf50359159f6179de (diff)
~ Use testing flag to hide internals.
We need some internal functions in tests and benchmarks, so it's better to just use CPP for this.
-rw-r--r--bittorrent.cabal15
-rw-r--r--src/Data/Bitfield.hs8
2 files changed, 19 insertions, 4 deletions
diff --git a/bittorrent.cabal b/bittorrent.cabal
index e3d98e84..138f5d3b 100644
--- a/bittorrent.cabal
+++ b/bittorrent.cabal
@@ -24,6 +24,9 @@ source-repository head
24 type: git 24 type: git
25 location: git://github.com/pxqr/bittorrent.git 25 location: git://github.com/pxqr/bittorrent.git
26 26
27flag testing
28 description: Expose debug stuff in export declarations.
29 default: False
27 30
28library 31library
29 exposed-modules: Data.Torrent 32 exposed-modules: Data.Torrent
@@ -79,9 +82,12 @@ library
79 82
80 extensions: PatternGuards 83 extensions: PatternGuards
81 hs-source-dirs: src 84 hs-source-dirs: src
85 if flag(testing)
86 cpp-options: -DTESTING
82 ghc-options: -Wall 87 ghc-options: -Wall
83 88
84 89
90
85test-suite info-hash 91test-suite info-hash
86 type: exitcode-stdio-1.0 92 type: exitcode-stdio-1.0
87 main-is: info-hash.hs 93 main-is: info-hash.hs
@@ -96,6 +102,9 @@ test-suite info-hash
96 102
97 ghc-options: -Wall 103 ghc-options: -Wall
98 104
105 if !flag(testing)
106 buildable: False
107
99 108
100 109
101test-suite properties 110test-suite properties
@@ -119,6 +128,9 @@ test-suite properties
119 128
120 ghc-options: -Wall -fno-warn-orphans 129 ghc-options: -Wall -fno-warn-orphans
121 130
131 if !flag(testing)
132 buildable: False
133
122 134
123 135
124benchmark benchmarks 136benchmark benchmarks
@@ -137,3 +149,6 @@ benchmark benchmarks
137 , bittorrent 149 , bittorrent
138 150
139 ghc-options: -O2 -Wall -fno-warn-orphans 151 ghc-options: -O2 -Wall -fno-warn-orphans
152
153 if !flag(testing)
154 buildable: False \ No newline at end of file
diff --git a/src/Data/Bitfield.hs b/src/Data/Bitfield.hs
index a1033ff2..ee0570e7 100644
--- a/src/Data/Bitfield.hs
+++ b/src/Data/Bitfield.hs
@@ -34,10 +34,10 @@ module Data.Bitfield
34 , getBitfield, putBitfield 34 , getBitfield, putBitfield
35 , bitfieldByteCount 35 , bitfieldByteCount
36 36
37-- #ifdef TESTING 37#if defined (TESTING)
38 , -- * Debug 38 -- * Debug
39 mkBitfield 39 , mkBitfield
40-- #endif 40#endif
41 ) where 41 ) where
42 42
43import Control.Monad 43import Control.Monad