summaryrefslogtreecommitdiff
path: root/tests/Hakyll/Core/Util
diff options
context:
space:
mode:
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