From e1fa778a78b64b5a49d0121b8c95af62d41ff7d6 Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Sun, 12 Feb 2012 23:53:03 +0100 Subject: Add some tests for Hakyll.Core.Util.String --- tests/Hakyll/Core/Util/String/Tests.hs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 tests/Hakyll/Core/Util/String/Tests.hs (limited to 'tests/Hakyll/Core') 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 -- cgit v1.2.3