1module Test.String (tests) where
6import ElmTest.Assertion (..)
7import ElmTest.Test (..)
11 let simpleTests = suite "Simple Stuff"
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")
20 combiningTests = suite "Combining Strings"
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")
26 , test "concat" <| assertEqual "nevertheless" (concat ["never","the","less"])
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")
37 suite "String" [ simpleTests, combiningTests ]
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list