@@ -152,29 +152,26 @@ testStringCodePoints = do
152
152
assert $ (singleton <$> codePointFromInt 0x16805 ) == Just " \x16805 "
153
153
154
154
log " splitAt"
155
- let testSplitAt i s res =
155
+ let testSplitAt i s r =
156
156
assert $ case splitAt i s of
157
- Nothing ->
158
- isNothing res
159
- Just { before, after } ->
160
- maybe false (\r ->
161
- r.before == before && r.after == after) res
162
-
163
- testSplitAt 0 " " $ Just {before: " " , after: " " }
164
- testSplitAt 1 " " Nothing
165
- testSplitAt 0 " a" $ Just {before: " " , after: " a" }
166
- testSplitAt 1 " ab" $ Just {before: " a" , after: " b" }
167
- testSplitAt 3 " aabcc" $ Just {before: " aab" , after: " cc" }
168
- testSplitAt (-1 ) " abc" $ Nothing
169
- testSplitAt 0 str $ Just {before: " " , after: str}
170
- testSplitAt 1 str $ Just {before: " a" , after: " \xDC00\xD800\xD800\x16805\x16A06 \& z" }
171
- testSplitAt 2 str $ Just {before: " a\xDC00 " , after: " \xD800\xD800\x16805\x16A06 \& z" }
172
- testSplitAt 3 str $ Just {before: " a\xDC00\xD800 " , after: " \xD800\x16805\x16A06 \& z" }
173
- testSplitAt 4 str $ Just {before: " a\xDC00\xD800\xD800 " , after: " \x16805\x16A06 \& z" }
174
- testSplitAt 5 str $ Just {before: " a\xDC00\xD800\xD800\x16805 " , after: " \x16A06 \& z" }
175
- testSplitAt 6 str $ Just {before: " a\xDC00\xD800\xD800\x16805\x16A06 " , after: " z" }
176
- testSplitAt 7 str $ Just {before: str, after: " " }
177
- testSplitAt 8 str $ Nothing
157
+ { before, after } ->
158
+ r.before == before && r.after == after
159
+
160
+ testSplitAt 0 " " {before: " " , after: " " }
161
+ testSplitAt 1 " " {before: " " , after: " " }
162
+ testSplitAt 0 " a" {before: " " , after: " a" }
163
+ testSplitAt 1 " ab" {before: " a" , after: " b" }
164
+ testSplitAt 3 " aabcc" {before: " aab" , after: " cc" }
165
+ testSplitAt (-1 ) " abc" {before: " " , after: " abc" }
166
+ testSplitAt 0 str {before: " " , after: str}
167
+ testSplitAt 1 str {before: " a" , after: " \xDC00\xD800\xD800\x16805\x16A06 \& z" }
168
+ testSplitAt 2 str {before: " a\xDC00 " , after: " \xD800\xD800\x16805\x16A06 \& z" }
169
+ testSplitAt 3 str {before: " a\xDC00\xD800 " , after: " \xD800\x16805\x16A06 \& z" }
170
+ testSplitAt 4 str {before: " a\xDC00\xD800\xD800 " , after: " \x16805\x16A06 \& z" }
171
+ testSplitAt 5 str {before: " a\xDC00\xD800\xD800\x16805 " , after: " \x16A06 \& z" }
172
+ testSplitAt 6 str {before: " a\xDC00\xD800\xD800\x16805\x16A06 " , after: " z" }
173
+ testSplitAt 7 str {before: str, after: " " }
174
+ testSplitAt 8 str {before: str, after: " " }
178
175
179
176
log " take"
180
177
assert $ take (-1 ) str == " "
0 commit comments