on 4bec310 help sign in
elk/tests/elm/Test/String.elm
34 lines 1.9 kB history raw
1module Test.String (tests) where
3import List
4import String (..)
6import ElmTest.Assertion (..)
7import ElmTest.Test (..)
9tests : Test
10tests =
11 let isEmptyTests = suite "isEmpty Tests" [
12 test "empty is empty" <| assert <| isEmpty "",
13 test "not empty" <| assert <| not . isEmpty <| "the world"
14 ]
15 lengthTest = test "length of innumerable" <| assertEqual 11 (length "innumerable")
16 reverseTest = test "reverse test" <| assertEqual "desserts" (reverse "stressed")
17 repeatTest = test "repeat test" <| assertEqual "hahaha" (repeat 3 "ha")
18 unconsTests = suite "uncons Tests" [
19 test "nonempty uncons" <| assertEqual (Just ('a',"bc")) (uncons "abc"),
20 test "empty uncons" <| assertEqual Nothing (uncons "")
21 ]
22 appendTest = test "append test" <| assertEqual "butterfly" (append "butter" "fly")
23 concatTest = test "concat test" <| assertEqual "nevertheless" (concat ["never","the","less"])
24 splitTests = suite "split Tests" [
25 test "split commas" <| assertEqual ["cat","dog","cow"] (split "," "cat,dog,cow"),
26 test "split slashes"<| assertEqual ["home","evan","Desktop", ""] (split "/" "home/evan/Desktop/")
27 ]
28 joinTests = suite "join Tests" [
29 test "join spaces" <| assertEqual "cat dog cow" (join " " ["cat","dog","cow"]),
30 test "join slashes" <| assertEqual "home/evan/Desktop" (join "/" ["home","evan","Desktop"])
31 ]
33 endsWithTest = test "endsWith Check" (assert <| endsWith "h" "th")
34 in suite "String Tests" [isEmptyTests, lengthTest, reverseTest, repeatTest, unconsTests, appendTest, concatTest, splitTests, joinTests, endsWithTest]