summaryrefslogtreecommitdiff
path: root/tests/CompressCSS.hs
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2010-01-24 22:27:11 +0100
committerJasper Van der Jeugt <jaspervdj@gmail.com>2010-01-24 22:27:11 +0100
commitd41500758f884a4e7a54a4696a2a521b4465242f (patch)
treeb4fb85045c6c5a80accd03ee8be3f37b0d58af93 /tests/CompressCSS.hs
parent7a75e1f4814a36f57558f59d11e5b7b948e03ed5 (diff)
downloadhakyll-d41500758f884a4e7a54a4696a2a521b4465242f.tar.gz
Backported previous tests.
Diffstat (limited to 'tests/CompressCSS.hs')
-rw-r--r--tests/CompressCSS.hs35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/CompressCSS.hs b/tests/CompressCSS.hs
new file mode 100644
index 0000000..855efcf
--- /dev/null
+++ b/tests/CompressCSS.hs
@@ -0,0 +1,35 @@
+module CompressCSS
+ ( compressCSSGroup
+ ) where
+
+import qualified Data.Map as M
+
+import Data.Binary
+import Test.Framework (testGroup)
+import Test.Framework.Providers.HUnit
+import Test.Framework.Providers.QuickCheck2
+import Test.HUnit
+
+import Text.Hakyll.Internal.CompressCSS
+
+-- CompressCSS test group.
+compressCSSGroup = testGroup "CompressCSS"
+ [ testProperty "prop_compressCSS_length" prop_compressCSS_length
+ , testCase "test_compressCSS_1" test_compressCSS_1
+ , testCase "test_compressCSS_2" test_compressCSS_2
+ , testCase "test_compressCSS_3" test_compressCSS_3
+ , testCase "test_compressCSS_4" test_compressCSS_4
+ ]
+
+-- CSS compression should always decrease the text length.
+prop_compressCSS_length str = length str >= length (compressCSS str)
+
+-- Compress CSS test cases.
+test_compressCSS_1 = compressCSS "a { \n color : red; }" @?= "a{color:red}"
+test_compressCSS_2 = compressCSS "img {border :none;;;; }"
+ @?= "img{border:none}"
+test_compressCSS_3 =
+ compressCSS "p {font-size : 90%;} h1 {color :white;;; }"
+ @?= "p{font-size:90%}h1{color:white}"
+test_compressCSS_4 = compressCSS "a { /* /* red is pretty cool */ color: red; }"
+ @?= "a{color:red}"