diff options
author | Gregor Kleen <pngwjpgh@users.noreply.github.com> | 2017-01-25 15:54:54 +0100 |
---|---|---|
committer | Gregor Kleen <pngwjpgh@users.noreply.github.com> | 2017-01-25 15:54:54 +0100 |
commit | 75d9fe614dca572aa1d7cfa53553e9c103eb2dd0 (patch) | |
tree | 54def052dcd8f288baead536a5f80d41a00387ef | |
parent | 99fc4947543c1916e9fec952526a688eb7753490 (diff) | |
download | thermoprint-75d9fe614dca572aa1d7cfa53553e9c103eb2dd0.tar thermoprint-75d9fe614dca572aa1d7cfa53553e9c103eb2dd0.tar.gz thermoprint-75d9fe614dca572aa1d7cfa53553e9c103eb2dd0.tar.bz2 thermoprint-75d9fe614dca572aa1d7cfa53553e9c103eb2dd0.tar.xz thermoprint-75d9fe614dca572aa1d7cfa53553e9c103eb2dd0.zip |
Cleanup test suite
-rw-r--r-- | server/test/Thermoprint/Server/Printer/GenericSpec.hs | 7 | ||||
-rw-r--r-- | server/thermoprint-server.cabal | 2 | ||||
-rw-r--r-- | server/thermoprint-server.nix | 2 | ||||
-rw-r--r-- | spec/src/Thermoprint/Printout.hs | 11 | ||||
-rw-r--r-- | spec/thermoprint-spec.cabal | 2 | ||||
-rw-r--r-- | spec/thermoprint-spec.nix | 2 | ||||
-rw-r--r-- | tp-bbcode/src/Thermoprint/Printout/BBCode/Inverse.hs | 6 | ||||
-rw-r--r-- | tp-bbcode/thermoprint-bbcode.cabal | 2 | ||||
-rw-r--r-- | tp-bbcode/thermoprint-bbcode.nix | 2 |
9 files changed, 21 insertions, 15 deletions
diff --git a/server/test/Thermoprint/Server/Printer/GenericSpec.hs b/server/test/Thermoprint/Server/Printer/GenericSpec.hs index 80096b0..e535754 100644 --- a/server/test/Thermoprint/Server/Printer/GenericSpec.hs +++ b/server/test/Thermoprint/Server/Printer/GenericSpec.hs | |||
@@ -29,8 +29,6 @@ import Data.Word | |||
29 | import Data.Sequence (Seq) | 29 | import Data.Sequence (Seq) |
30 | import qualified Data.Sequence as Seq | 30 | import qualified Data.Sequence as Seq |
31 | 31 | ||
32 | import Debug.Trace | ||
33 | |||
34 | instance IsString Line where | 32 | instance IsString Line where |
35 | fromString = (\(Right l) -> l) . text . TL.pack | 33 | fromString = (\(Right l) -> l) . text . TL.pack |
36 | 34 | ||
@@ -40,7 +38,7 @@ spec = do | |||
40 | zipWithM_ example [1..] examples | 38 | zipWithM_ example [1..] examples |
41 | where | 39 | where |
42 | example n (s, ts) = let str = show s | 40 | example n (s, ts) = let str = show s |
43 | in specify str $ traceDump (mkPrintout . Printout . fmap (Paragraph . Seq.singleton) . fmap Cooked $ s) == ts | 41 | in specify str $ (mkPrintout . Printout . fmap (Paragraph . Seq.singleton) . fmap Cooked $ s) == ts |
44 | 42 | ||
45 | final, initial :: L.ByteString | 43 | final, initial :: L.ByteString |
46 | initial = esc [64] <> esc [64] | 44 | initial = esc [64] <> esc [64] |
@@ -52,9 +50,6 @@ esc = L.BS.pack . (27:) | |||
52 | p :: L.ByteString -> L.ByteString | 50 | p :: L.ByteString -> L.ByteString |
53 | p = (<> final) . (initial <>) | 51 | p = (<> final) . (initial <>) |
54 | 52 | ||
55 | traceDump :: L.ByteString -> L.ByteString | ||
56 | traceDump bs = traceShow (map (\b -> (b, (toEnum $ fromEnum b) :: Char)) $ L.BS.unpack bs) bs | ||
57 | |||
58 | examples :: [(Seq Block, L.ByteString)] | 53 | examples :: [(Seq Block, L.ByteString)] |
59 | examples = [ ( [Line (JuxtaPos ["Hello", HSpace 1, "World!"])] | 54 | examples = [ ( [Line (JuxtaPos ["Hello", HSpace 1, "World!"])] |
60 | , p "Hello World!") | 55 | , p "Hello World!") |
diff --git a/server/thermoprint-server.cabal b/server/thermoprint-server.cabal index c80351b..eae3754 100644 --- a/server/thermoprint-server.cabal +++ b/server/thermoprint-server.cabal | |||
@@ -2,7 +2,7 @@ | |||
2 | -- documentation, see http://haskell.org/cabal/users-guide/ | 2 | -- documentation, see http://haskell.org/cabal/users-guide/ |
3 | 3 | ||
4 | name: thermoprint-server | 4 | name: thermoprint-server |
5 | version: 2.0.1 | 5 | version: 2.0.2 |
6 | synopsis: Server for thermoprint-spec | 6 | synopsis: Server for thermoprint-spec |
7 | -- description: | 7 | -- description: |
8 | homepage: http://dirty-haskell.org/tags/thermoprint.html | 8 | homepage: http://dirty-haskell.org/tags/thermoprint.html |
diff --git a/server/thermoprint-server.nix b/server/thermoprint-server.nix index 71a4211..41e645a 100644 --- a/server/thermoprint-server.nix +++ b/server/thermoprint-server.nix | |||
@@ -9,7 +9,7 @@ | |||
9 | }: | 9 | }: |
10 | mkDerivation { | 10 | mkDerivation { |
11 | pname = "thermoprint-server"; | 11 | pname = "thermoprint-server"; |
12 | version = "2.0.1"; | 12 | version = "2.0.2"; |
13 | src = ./.; | 13 | src = ./.; |
14 | isLibrary = true; | 14 | isLibrary = true; |
15 | isExecutable = true; | 15 | isExecutable = true; |
diff --git a/spec/src/Thermoprint/Printout.hs b/spec/src/Thermoprint/Printout.hs index 752ccb5..53b6a3e 100644 --- a/spec/src/Thermoprint/Printout.hs +++ b/spec/src/Thermoprint/Printout.hs | |||
@@ -37,7 +37,7 @@ import Data.Proxy (Proxy(..)) | |||
37 | 37 | ||
38 | import Test.QuickCheck.Arbitrary (Arbitrary(..), CoArbitrary, genericShrink) | 38 | import Test.QuickCheck.Arbitrary (Arbitrary(..), CoArbitrary, genericShrink) |
39 | import Test.QuickCheck.Modifiers (NonNegative(..)) | 39 | import Test.QuickCheck.Modifiers (NonNegative(..)) |
40 | import Test.QuickCheck.Gen (oneof, scale) | 40 | import Test.QuickCheck.Gen (oneof, scale, elements) |
41 | import Test.QuickCheck.Instances | 41 | import Test.QuickCheck.Instances |
42 | import Test.QuickCheck (forAll, Property) | 42 | import Test.QuickCheck (forAll, Property) |
43 | 43 | ||
@@ -242,10 +242,14 @@ data MarkupMode = Bold | |||
242 | | Underline | 242 | | Underline |
243 | | DoubleHeight | 243 | | DoubleHeight |
244 | | DoubleWidth | 244 | | DoubleWidth |
245 | deriving (Generic, NFData, Show, Arbitrary, CoArbitrary, FromJSON, ToJSON | 245 | deriving (Generic, NFData, Show, FromJSON, ToJSON |
246 | , Eq, Ord, Enum | 246 | , Eq, Ord, Enum, Bounded |
247 | ) | 247 | ) |
248 | 248 | ||
249 | instance Arbitrary MarkupMode where | ||
250 | arbitrary = elements [minBound..maxBound] | ||
251 | instance CoArbitrary MarkupMode | ||
252 | |||
249 | -- | We don't test 'Raw' 'Chunk's | 253 | -- | We don't test 'Raw' 'Chunk's |
250 | instance Arbitrary Chunk where | 254 | instance Arbitrary Chunk where |
251 | shrink = genericShrink | 255 | shrink = genericShrink |
@@ -262,6 +266,7 @@ instance Arbitrary Line where | |||
262 | shrink = genericShrink | 266 | shrink = genericShrink |
263 | arbitrary = oneof [ Word . TL.filter (not . isSpace) <$> arbitrary -- 'isSpace '\n' == True' | 267 | arbitrary = oneof [ Word . TL.filter (not . isSpace) <$> arbitrary -- 'isSpace '\n' == True' |
264 | , HSpace . getNonNegative <$> arbitrary | 268 | , HSpace . getNonNegative <$> arbitrary |
269 | , Markup <$> arbitrary <*> arbitrary | ||
265 | , JuxtaPos <$> scale' arbitrary | 270 | , JuxtaPos <$> scale' arbitrary |
266 | ] | 271 | ] |
267 | 272 | ||
diff --git a/spec/thermoprint-spec.cabal b/spec/thermoprint-spec.cabal index d4ecda6..138a06e 100644 --- a/spec/thermoprint-spec.cabal +++ b/spec/thermoprint-spec.cabal | |||
@@ -2,7 +2,7 @@ | |||
2 | -- documentation, see http://haskell.org/cabal/users-guide/ | 2 | -- documentation, see http://haskell.org/cabal/users-guide/ |
3 | 3 | ||
4 | name: thermoprint-spec | 4 | name: thermoprint-spec |
5 | version: 5.0.0 | 5 | version: 5.0.1 |
6 | synopsis: A specification of the API and the payload datatypes and associated utilities | 6 | synopsis: A specification of the API and the payload datatypes and associated utilities |
7 | -- description: | 7 | -- description: |
8 | homepage: http://dirty-haskell.org/tags/thermoprint.html | 8 | homepage: http://dirty-haskell.org/tags/thermoprint.html |
diff --git a/spec/thermoprint-spec.nix b/spec/thermoprint-spec.nix index 1a1611c..a3093de 100644 --- a/spec/thermoprint-spec.nix +++ b/spec/thermoprint-spec.nix | |||
@@ -4,7 +4,7 @@ | |||
4 | }: | 4 | }: |
5 | mkDerivation { | 5 | mkDerivation { |
6 | pname = "thermoprint-spec"; | 6 | pname = "thermoprint-spec"; |
7 | version = "5.0.0"; | 7 | version = "5.0.1"; |
8 | src = ./.; | 8 | src = ./.; |
9 | libraryHaskellDepends = [ | 9 | libraryHaskellDepends = [ |
10 | aeson base base64-bytestring bytestring Cabal cabal-test-quickcheck | 10 | aeson base base64-bytestring bytestring Cabal cabal-test-quickcheck |
diff --git a/tp-bbcode/src/Thermoprint/Printout/BBCode/Inverse.hs b/tp-bbcode/src/Thermoprint/Printout/BBCode/Inverse.hs index 8e15417..e356d09 100644 --- a/tp-bbcode/src/Thermoprint/Printout/BBCode/Inverse.hs +++ b/tp-bbcode/src/Thermoprint/Printout/BBCode/Inverse.hs | |||
@@ -49,5 +49,11 @@ handleLine = flip handleLine' T.empty | |||
49 | | " " `T.isSuffixOf` p = "[hspace=" <> T.pack (show i) <> "/]" | 49 | | " " `T.isSuffixOf` p = "[hspace=" <> T.pack (show i) <> "/]" |
50 | | i <= 2 = T.pack $ genericReplicate i ' ' | 50 | | i <= 2 = T.pack $ genericReplicate i ' ' |
51 | | otherwise = " [hspace=" <> T.pack (show $ i - 2) <> "/] " | 51 | | otherwise = " [hspace=" <> T.pack (show $ i - 2) <> "/] " |
52 | handleLine' (Markup ms l) _ = "[markup " <> foldMap markup ms <> "]" <> handleLine' l T.empty <> "[/markup]" | ||
53 | where | ||
54 | markup Bold = "bold=true" | ||
55 | markup Underline = "underline=true" | ||
56 | markup DoubleHeight = "doubleHeight=true" | ||
57 | markup DoubleWidth = "doubleWidth=true" | ||
52 | handleLine' (JuxtaPos ls) p = foldl (\p l -> p <> handleLine' l p) "" ls | 58 | handleLine' (JuxtaPos ls) p = foldl (\p l -> p <> handleLine' l p) "" ls |
53 | handleLine' (Line -> b) _ = LT.toStrict $ cotext b | 59 | handleLine' (Line -> b) _ = LT.toStrict $ cotext b |
diff --git a/tp-bbcode/thermoprint-bbcode.cabal b/tp-bbcode/thermoprint-bbcode.cabal index b476753..89ed326 100644 --- a/tp-bbcode/thermoprint-bbcode.cabal +++ b/tp-bbcode/thermoprint-bbcode.cabal | |||
@@ -2,7 +2,7 @@ | |||
2 | -- documentation, see http://haskell.org/cabal/users-guide/ | 2 | -- documentation, see http://haskell.org/cabal/users-guide/ |
3 | 3 | ||
4 | name: thermoprint-bbcode | 4 | name: thermoprint-bbcode |
5 | version: 2.0.0 | 5 | version: 2.0.1 |
6 | synopsis: Parse bbcode for use in thermoprint | 6 | synopsis: Parse bbcode for use in thermoprint |
7 | -- description: | 7 | -- description: |
8 | homepage: http://dirty-haskell.org/tags/thermoprint.html | 8 | homepage: http://dirty-haskell.org/tags/thermoprint.html |
diff --git a/tp-bbcode/thermoprint-bbcode.nix b/tp-bbcode/thermoprint-bbcode.nix index 27c3f60..3c698f1 100644 --- a/tp-bbcode/thermoprint-bbcode.nix +++ b/tp-bbcode/thermoprint-bbcode.nix | |||
@@ -4,7 +4,7 @@ | |||
4 | }: | 4 | }: |
5 | mkDerivation { | 5 | mkDerivation { |
6 | pname = "thermoprint-bbcode"; | 6 | pname = "thermoprint-bbcode"; |
7 | version = "2.0.0"; | 7 | version = "2.0.1"; |
8 | src = ./.; | 8 | src = ./.; |
9 | libraryHaskellDepends = [ | 9 | libraryHaskellDepends = [ |
10 | base bbcode bytestring case-insensitive containers text | 10 | base bbcode bytestring case-insensitive containers text |