1module Test.String (tests) where
6import ElmTest.Assertion (..)
7import ElmTest.Test (..)
11 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")
20 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")
26 , 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")
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