summaryrefslogtreecommitdiff
path: root/tests/Hakyll/Core/Util
diff options
context:
space:
mode:
authorJasper Van der Jeugt <m@jaspervdj.be>2012-02-12 23:53:03 +0100
committerJasper Van der Jeugt <m@jaspervdj.be>2012-02-12 23:53:03 +0100
commite1fa778a78b64b5a49d0121b8c95af62d41ff7d6 (patch)
treed7a6138f8816b9391ad326fc0dd8e415ebff322b /tests/Hakyll/Core/Util
parent3c4dbd579993b0320bdc9440a916e0b64c79784d (diff)
downloadhakyll-e1fa778a78b64b5a49d0121b8c95af62d41ff7d6.tar.gz
Add some tests for Hakyll.Core.Util.String
Diffstat (limited to 'tests/Hakyll/Core/Util')
-rw-r--r--tests/Hakyll/Core/Util/String/Tests.hs28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/Hakyll/Core/Util/String/Tests.hs b/tests/Hakyll/Core/Util/String/Tests.hs
new file mode 100644
index 0000000..bbdfb96
--- /dev/null
+++ b/tests/Hakyll/Core/Util/String/Tests.hs
@@ -0,0 +1,28 @@
+module Hakyll.Core.Util.String.Tests
+ ( tests
+ ) where
+
+import Test.Framework (Test)
+import Test.HUnit ((@=?))
+
+import Hakyll.Core.Util.String
+import TestSuite.Util
+
+tests :: [Test]
+tests = concat
+ [ fromAssertions "trim"
+ [ "foo" @=? trim " foo\n\t "
+ ]
+
+ , fromAssertions "replaceAll"
+ [ "32 & 131" @=? replaceAll "0x[0-9]+" (show . readInt) "0x20 & 0x83"
+ ]
+
+ , fromAssertions "splitAll"
+ [ ["λ", "∀x.x", "hi"] @=? splitAll ", *" "λ, ∀x.x, hi"
+ ]
+ ]
+
+ where
+ readInt :: String -> Int
+ readInt = read