@@ -1,7 +1,7 @@
11module Test.String (tests) where
22
33import List
4−import String (..)
4+import String
55
66import ElmTest.Assertion (..)
77import ElmTest.Test (..)
@@ -9,29 +9,29 @@ import ElmTest.Test (..)
99tests : Test
1010tests =
1111 let simpleTests = suite "Simple Stuff"
12− [ test "is empty" <| assert (isEmpty "")
13− , test "is not empty" <| assert (not (isEmpty ("the world")))
14− , test "length" <| assertEqual 11 (length "innumerable")
15− , test "endsWith" (assert <| endsWith "ship" "spaceship")
16− , test "reverse" <| assertEqual "desserts" (reverse "stressed")
17− , test "repeat" <| assertEqual "hahaha" (repeat 3 "ha")
12+ [ test "is empty" <| assert (String.isEmpty "")
13+ , test "is not empty" <| assert (not (String.isEmpty ("the world")))
14+ , test "length" <| assertEqual 11 (String.length "innumerable")
15+ , test "endsWith" (assert <| String.endsWith "ship" "spaceship")
16+ , test "reverse" <| assertEqual "desserts" (String.reverse "stressed")
17+ , test "repeat" <| assertEqual "hahaha" (String.repeat 3 "ha")
1818 ]
1919
2020 combiningTests = suite "Combining Strings"
21− [ test "uncons non-empty" <| assertEqual (Just ('a',"bc")) (uncons "abc")
22− , test "uncons empty" <| assertEqual Nothing (uncons "")
23− , test "append 1" <| assertEqual "butterfly" (append "butter" "fly")
24− , test "append 2" <| assertEqual "butter" (append "butter" "")
25− , test "append 3" <| assertEqual "butter" (append "" "butter")
21+ [ test "uncons non-empty" <| assertEqual (Just ('a',"bc")) (String.uncons "abc")
22+ , test "uncons empty" <| assertEqual Nothing (String.uncons "")
23+ , test "append 1" <| assertEqual "butterfly" (String.append "butter" "fly")
24+ , test "append 2" <| assertEqual "butter" (String.append "butter" "")
25+ , test "append 3" <| assertEqual "butter" (String.append "" "butter")
2626 , test "concat" <| assertEqual "nevertheless" (concat ["never","the","less"])
27− , test "split commas" <| assertEqual ["cat","dog","cow"] (split "," "cat,dog,cow")
28− , test "split slashes"<| assertEqual ["home","steve","Desktop", ""] (split "/" "home/steve/Desktop/")
29− , test "join spaces" <| assertEqual "cat dog cow" (join " " ["cat","dog","cow"])
30− , test "join slashes" <| assertEqual "home/steve/Desktop" (join "/" ["home","steve","Desktop"])
31− , test "slice 1" <| assertEqual "c" (slice 2 3 "abcd")
32− , test "slice 2" <| assertEqual "abc" (slice 0 3 "abcd")
33− , test "slice 3" <| assertEqual "abc" (slice 0 -1 "abcd")
34− , test "slice 4" <| assertEqual "cd" (slice -2 4 "abcd")
27+ , test "split commas" <| assertEqual ["cat","dog","cow"] (String.split "," "cat,dog,cow")
28+ , test "split slashes"<| assertEqual ["home","steve","Desktop", ""] (String.split "/" "home/steve/Desktop/")
29+ , test "join spaces" <| assertEqual "cat dog cow" (String.join " " ["cat","dog","cow"])
30+ , test "join slashes" <| assertEqual "home/steve/Desktop" (String.join "/" ["home","steve","Desktop"])
31+ , test "slice 1" <| assertEqual "c" (String.slice 2 3 "abcd")
32+ , test "slice 2" <| assertEqual "abc" (String.slice 0 3 "abcd")
33+ , test "slice 3" <| assertEqual "abc" (String.slice 0 -1 "abcd")
34+ , test "slice 4" <| assertEqual "cd" (String.slice -2 4 "abcd")
3535 ]
3636 in
3737 suite "String" [ simpleTests, combiningTests ]