forked from pen-lang/pen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
String.test.pen
47 lines (35 loc) · 1.14 KB
/
String.test.pen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import Test'Assert
import 'String
ConcatenateEmpty = \() none | error {
Assert'True(String'Concatenate([string]) == "")
}
ConcatenateString = \() none | error {
Assert'True(String'Concatenate([string "foo"]) == "foo")
}
ConcatenateTwoStrings = \() none | error {
Assert'True(String'Concatenate([string "foo", "bar"]) == "foobar")
}
ConcatenateThreeStrings = \() none | error {
Assert'True(String'Concatenate([string "lan", "gua", "ge"]) == "language")
}
JoinEmpty = \() none | error {
Assert'True(String'Join([string], "") == "")
}
JoinTwoStrings = \() none | error {
Assert'True(String'Join([string "foo", "bar"], "") == "foobar")
}
JoinTwoStringsWithSeparator = \() none | error {
Assert'True(String'Join([string "foo", "bar"], ",") == "foo,bar")
}
JoinThreeStringsWithSeparator = \() none | error {
Assert'True(String'Join([string "foo", "bar", "baz"], ",") == "foo,bar,baz")
}
HasPrefix = \() none | error {
Assert'True(String'HasPrefix("foobar", "foo"))
}
HasNoPrefix = \() none | error {
Assert'True(!String'HasPrefix("bar", "foo"))
}
HasNoPrefixWithSubString = \() none | error {
Assert'True(!String'HasPrefix("fo", "foo"))
}