@@ -6,11 +6,11 @@ import Data.Array.NonEmpty as NEA
6
6
import Data.Maybe (Maybe (..), fromJust )
7
7
import Data.String.NonEmpty (Pattern (..), nes )
8
8
import Data.String.NonEmpty as NES
9
- import Data.Symbol (SProxy (..))
10
9
import Effect (Effect )
11
10
import Effect.Console (log )
12
11
import Partial.Unsafe (unsafePartial )
13
12
import Test.Assert (assert , assertEqual )
13
+ import Type.Proxy (Proxy (..))
14
14
15
15
testNonEmptyString :: Effect Unit
16
16
testNonEmptyString = do
@@ -22,7 +22,7 @@ testNonEmptyString = do
22
22
}
23
23
assertEqual
24
24
{ actual: NES .fromString " hello"
25
- , expected: Just (nes (SProxy :: SProxy " hello" ))
25
+ , expected: Just (nes (Proxy :: Proxy " hello" ))
26
26
}
27
27
28
28
log " toString"
@@ -33,136 +33,136 @@ testNonEmptyString = do
33
33
34
34
log " appendString"
35
35
assertEqual
36
- { actual: NES .appendString (nes (SProxy :: SProxy " Hello" )) " world"
37
- , expected: nes (SProxy :: SProxy " Hello world" )
36
+ { actual: NES .appendString (nes (Proxy :: Proxy " Hello" )) " world"
37
+ , expected: nes (Proxy :: Proxy " Hello world" )
38
38
}
39
39
assertEqual
40
- { actual: NES .appendString (nes (SProxy :: SProxy " Hello" )) " "
41
- , expected: nes (SProxy :: SProxy " Hello" )
40
+ { actual: NES .appendString (nes (Proxy :: Proxy " Hello" )) " "
41
+ , expected: nes (Proxy :: Proxy " Hello" )
42
42
}
43
43
44
44
log " prependString"
45
45
assertEqual
46
- { actual: NES .prependString " be" (nes (SProxy :: SProxy " fore" ))
47
- , expected: nes (SProxy :: SProxy " before" )
46
+ { actual: NES .prependString " be" (nes (Proxy :: Proxy " fore" ))
47
+ , expected: nes (Proxy :: Proxy " before" )
48
48
}
49
49
assertEqual
50
- { actual: NES .prependString " " (nes (SProxy :: SProxy " fore" ))
51
- , expected: nes (SProxy :: SProxy " fore" )
50
+ { actual: NES .prependString " " (nes (Proxy :: Proxy " fore" ))
51
+ , expected: nes (Proxy :: Proxy " fore" )
52
52
}
53
53
54
54
log " contains"
55
- assert $ NES .contains (Pattern " " ) (nes (SProxy :: SProxy " abcd" ))
56
- assert $ NES .contains (Pattern " bc" ) (nes (SProxy :: SProxy " abcd" ))
57
- assert $ not NES .contains (Pattern " cb" ) (nes (SProxy :: SProxy " abcd" ))
58
- assert $ NES .contains (Pattern " needle" ) (nes (SProxy :: SProxy " haystack with needle" ))
59
- assert $ not NES .contains (Pattern " needle" ) (nes (SProxy :: SProxy " haystack" ))
55
+ assert $ NES .contains (Pattern " " ) (nes (Proxy :: Proxy " abcd" ))
56
+ assert $ NES .contains (Pattern " bc" ) (nes (Proxy :: Proxy " abcd" ))
57
+ assert $ not NES .contains (Pattern " cb" ) (nes (Proxy :: Proxy " abcd" ))
58
+ assert $ NES .contains (Pattern " needle" ) (nes (Proxy :: Proxy " haystack with needle" ))
59
+ assert $ not NES .contains (Pattern " needle" ) (nes (Proxy :: Proxy " haystack" ))
60
60
61
61
log " localeCompare"
62
62
assertEqual
63
- { actual: NES .localeCompare (nes (SProxy :: SProxy " a" )) (nes (SProxy :: SProxy " a" ))
63
+ { actual: NES .localeCompare (nes (Proxy :: Proxy " a" )) (nes (Proxy :: Proxy " a" ))
64
64
, expected: EQ
65
65
}
66
66
assertEqual
67
- { actual: NES .localeCompare (nes (SProxy :: SProxy " a" )) (nes (SProxy :: SProxy " b" ))
67
+ { actual: NES .localeCompare (nes (Proxy :: Proxy " a" )) (nes (Proxy :: Proxy " b" ))
68
68
, expected: LT
69
69
}
70
70
assertEqual
71
- { actual: NES .localeCompare (nes (SProxy :: SProxy " b" )) (nes (SProxy :: SProxy " a" ))
71
+ { actual: NES .localeCompare (nes (Proxy :: Proxy " b" )) (nes (Proxy :: Proxy " a" ))
72
72
, expected: GT
73
73
}
74
74
75
75
log " replace"
76
76
assertEqual
77
- { actual: NES .replace (Pattern " b" ) (NES.NonEmptyReplacement (nes (SProxy :: SProxy " !" ))) (nes (SProxy :: SProxy " abc" ))
78
- , expected: nes (SProxy :: SProxy " a!c" )
77
+ { actual: NES .replace (Pattern " b" ) (NES.NonEmptyReplacement (nes (Proxy :: Proxy " !" ))) (nes (Proxy :: Proxy " abc" ))
78
+ , expected: nes (Proxy :: Proxy " a!c" )
79
79
}
80
80
assertEqual
81
- { actual: NES .replace (Pattern " b" ) (NES.NonEmptyReplacement (nes (SProxy :: SProxy " !" ))) (nes (SProxy :: SProxy " abbc" ))
82
- , expected: nes (SProxy :: SProxy " a!bc" )
81
+ { actual: NES .replace (Pattern " b" ) (NES.NonEmptyReplacement (nes (Proxy :: Proxy " !" ))) (nes (Proxy :: Proxy " abbc" ))
82
+ , expected: nes (Proxy :: Proxy " a!bc" )
83
83
}
84
84
assertEqual
85
- { actual: NES .replace (Pattern " d" ) (NES.NonEmptyReplacement (nes (SProxy :: SProxy " !" ))) (nes (SProxy :: SProxy " abc" ))
86
- , expected: nes (SProxy :: SProxy " abc" )
85
+ { actual: NES .replace (Pattern " d" ) (NES.NonEmptyReplacement (nes (Proxy :: Proxy " !" ))) (nes (Proxy :: Proxy " abc" ))
86
+ , expected: nes (Proxy :: Proxy " abc" )
87
87
}
88
88
89
89
log " replaceAll"
90
90
assertEqual
91
- { actual: NES .replaceAll (Pattern " [b]" ) (NES.NonEmptyReplacement (nes (SProxy :: SProxy " !" ))) (nes (SProxy :: SProxy " a[b]c" ))
92
- , expected: nes (SProxy :: SProxy " a!c" )
91
+ { actual: NES .replaceAll (Pattern " [b]" ) (NES.NonEmptyReplacement (nes (Proxy :: Proxy " !" ))) (nes (Proxy :: Proxy " a[b]c" ))
92
+ , expected: nes (Proxy :: Proxy " a!c" )
93
93
}
94
94
assertEqual
95
- { actual: NES .replaceAll (Pattern " [b]" ) (NES.NonEmptyReplacement (nes (SProxy :: SProxy " !" ))) (nes (SProxy :: SProxy " a[b]c[b]" ))
96
- , expected: nes (SProxy :: SProxy " a!c!" )
95
+ { actual: NES .replaceAll (Pattern " [b]" ) (NES.NonEmptyReplacement (nes (Proxy :: Proxy " !" ))) (nes (Proxy :: Proxy " a[b]c[b]" ))
96
+ , expected: nes (Proxy :: Proxy " a!c!" )
97
97
}
98
98
assertEqual
99
- { actual: NES .replaceAll (Pattern " x" ) (NES.NonEmptyReplacement (nes (SProxy :: SProxy " !" ))) (nes (SProxy :: SProxy " abc" ))
100
- , expected: nes (SProxy :: SProxy " abc" )
99
+ { actual: NES .replaceAll (Pattern " x" ) (NES.NonEmptyReplacement (nes (Proxy :: Proxy " !" ))) (nes (Proxy :: Proxy " abc" ))
100
+ , expected: nes (Proxy :: Proxy " abc" )
101
101
}
102
102
103
103
log " stripPrefix"
104
104
assertEqual
105
- { actual: NES .stripPrefix (Pattern " " ) (nes (SProxy :: SProxy " abc" ))
106
- , expected: Just (nes (SProxy :: SProxy " abc" ))
105
+ { actual: NES .stripPrefix (Pattern " " ) (nes (Proxy :: Proxy " abc" ))
106
+ , expected: Just (nes (Proxy :: Proxy " abc" ))
107
107
}
108
108
assertEqual
109
- { actual: NES .stripPrefix (Pattern " a" ) (nes (SProxy :: SProxy " abc" ))
110
- , expected: Just (nes (SProxy :: SProxy " bc" ))
109
+ { actual: NES .stripPrefix (Pattern " a" ) (nes (Proxy :: Proxy " abc" ))
110
+ , expected: Just (nes (Proxy :: Proxy " bc" ))
111
111
}
112
112
assertEqual
113
- { actual: NES .stripPrefix (Pattern " abc" ) (nes (SProxy :: SProxy " abc" ))
113
+ { actual: NES .stripPrefix (Pattern " abc" ) (nes (Proxy :: Proxy " abc" ))
114
114
, expected: Nothing
115
115
}
116
116
assertEqual
117
- { actual: NES .stripPrefix (Pattern " !" ) (nes (SProxy :: SProxy " abc" ))
117
+ { actual: NES .stripPrefix (Pattern " !" ) (nes (Proxy :: Proxy " abc" ))
118
118
, expected: Nothing
119
119
}
120
120
assertEqual
121
- { actual: NES .stripPrefix (Pattern " http:" ) (nes (SProxy :: SProxy " http://purescript.org" ))
122
- , expected: Just (nes (SProxy :: SProxy " //purescript.org" ))
121
+ { actual: NES .stripPrefix (Pattern " http:" ) (nes (Proxy :: Proxy " http://purescript.org" ))
122
+ , expected: Just (nes (Proxy :: Proxy " //purescript.org" ))
123
123
}
124
124
assertEqual
125
- { actual: NES .stripPrefix (Pattern " http:" ) (nes (SProxy :: SProxy " https://purescript.org" ))
125
+ { actual: NES .stripPrefix (Pattern " http:" ) (nes (Proxy :: Proxy " https://purescript.org" ))
126
126
, expected: Nothing
127
127
}
128
128
assertEqual
129
- { actual: NES .stripPrefix (Pattern " Hello!" ) (nes (SProxy :: SProxy " Hello!" ))
129
+ { actual: NES .stripPrefix (Pattern " Hello!" ) (nes (Proxy :: Proxy " Hello!" ))
130
130
, expected: Nothing
131
131
}
132
132
133
133
log " stripSuffix"
134
134
assertEqual
135
- { actual: NES .stripSuffix (Pattern " .exe" ) (nes (SProxy :: SProxy " purs.exe" ))
136
- , expected: Just (nes (SProxy :: SProxy " purs" ))
135
+ { actual: NES .stripSuffix (Pattern " .exe" ) (nes (Proxy :: Proxy " purs.exe" ))
136
+ , expected: Just (nes (Proxy :: Proxy " purs" ))
137
137
}
138
138
assertEqual
139
- { actual: NES .stripSuffix (Pattern " .exe" ) (nes (SProxy :: SProxy " purs" ))
139
+ { actual: NES .stripSuffix (Pattern " .exe" ) (nes (Proxy :: Proxy " purs" ))
140
140
, expected: Nothing
141
141
}
142
142
assertEqual
143
- { actual: NES .stripSuffix (Pattern " Hello!" ) (nes (SProxy :: SProxy " Hello!" ))
143
+ { actual: NES .stripSuffix (Pattern " Hello!" ) (nes (Proxy :: Proxy " Hello!" ))
144
144
, expected: Nothing
145
145
}
146
146
147
147
log " toLower"
148
148
assertEqual
149
- { actual: NES .toLower (nes (SProxy :: SProxy " bAtMaN" ))
150
- , expected: nes (SProxy :: SProxy " batman" )
149
+ { actual: NES .toLower (nes (Proxy :: Proxy " bAtMaN" ))
150
+ , expected: nes (Proxy :: Proxy " batman" )
151
151
}
152
152
153
153
log " toUpper"
154
154
assertEqual
155
- { actual: NES .toUpper (nes (SProxy :: SProxy " bAtMaN" ))
156
- , expected: nes (SProxy :: SProxy " BATMAN" )
155
+ { actual: NES .toUpper (nes (Proxy :: Proxy " bAtMaN" ))
156
+ , expected: nes (Proxy :: Proxy " BATMAN" )
157
157
}
158
158
159
159
log " trim"
160
160
assertEqual
161
- { actual: NES .trim (nes (SProxy :: SProxy " abc " ))
162
- , expected: Just (nes (SProxy :: SProxy " abc" ))
161
+ { actual: NES .trim (nes (Proxy :: Proxy " abc " ))
162
+ , expected: Just (nes (Proxy :: Proxy " abc" ))
163
163
}
164
164
assertEqual
165
- { actual: NES .trim (nes (SProxy :: SProxy " \n " ))
165
+ { actual: NES .trim (nes (Proxy :: Proxy " \n " ))
166
166
, expected: Nothing
167
167
}
168
168
@@ -172,48 +172,48 @@ testNonEmptyString = do
172
172
, expected: " "
173
173
}
174
174
assertEqual
175
- { actual: NES .joinWith " " [nes (SProxy :: SProxy " a" ), nes (SProxy :: SProxy " b" )]
175
+ { actual: NES .joinWith " " [nes (Proxy :: Proxy " a" ), nes (Proxy :: Proxy " b" )]
176
176
, expected: " ab"
177
177
}
178
178
assertEqual
179
- { actual: NES .joinWith " --" [nes (SProxy :: SProxy " a" ), nes (SProxy :: SProxy " b" ), nes (SProxy :: SProxy " c" )]
179
+ { actual: NES .joinWith " --" [nes (Proxy :: Proxy " a" ), nes (Proxy :: Proxy " b" ), nes (Proxy :: Proxy " c" )]
180
180
, expected: " a--b--c"
181
181
}
182
182
183
183
log " join1With"
184
184
assertEqual
185
- { actual: NES .join1With " " (nea [nes (SProxy :: SProxy " a" ), nes (SProxy :: SProxy " b" )] )
186
- , expected: nes (SProxy :: SProxy " ab" )
185
+ { actual: NES .join1With " " (nea [nes (Proxy :: Proxy " a" ), nes (Proxy :: Proxy " b" )] )
186
+ , expected: nes (Proxy :: Proxy " ab" )
187
187
}
188
188
assertEqual
189
- { actual: NES .join1With " --" (nea [nes (SProxy :: SProxy " a" ), nes (SProxy :: SProxy " b" ), nes (SProxy :: SProxy " c" )] )
190
- , expected: nes (SProxy :: SProxy " a--b--c" )
189
+ { actual: NES .join1With " --" (nea [nes (Proxy :: Proxy " a" ), nes (Proxy :: Proxy " b" ), nes (Proxy :: Proxy " c" )] )
190
+ , expected: nes (Proxy :: Proxy " a--b--c" )
191
191
}
192
192
assertEqual
193
- { actual: NES .join1With " , " (nea [nes (SProxy :: SProxy " apple" ), nes (SProxy :: SProxy " banana" )] )
194
- , expected: nes (SProxy :: SProxy " apple, banana" )
193
+ { actual: NES .join1With " , " (nea [nes (Proxy :: Proxy " apple" ), nes (Proxy :: Proxy " banana" )] )
194
+ , expected: nes (Proxy :: Proxy " apple, banana" )
195
195
}
196
196
assertEqual
197
- { actual: NES .join1With " " (nea [nes (SProxy :: SProxy " apple" ), nes (SProxy :: SProxy " banana" )] )
198
- , expected: nes (SProxy :: SProxy " applebanana" )
197
+ { actual: NES .join1With " " (nea [nes (Proxy :: Proxy " apple" ), nes (Proxy :: Proxy " banana" )] )
198
+ , expected: nes (Proxy :: Proxy " applebanana" )
199
199
}
200
200
201
201
log " joinWith1"
202
202
assertEqual
203
- { actual: NES .joinWith1 (nes (SProxy :: SProxy " " )) (nea [" a" , " b" ])
204
- , expected: nes (SProxy :: SProxy " a b" )
203
+ { actual: NES .joinWith1 (nes (Proxy :: Proxy " " )) (nea [" a" , " b" ])
204
+ , expected: nes (Proxy :: Proxy " a b" )
205
205
}
206
206
assertEqual
207
- { actual: NES .joinWith1 (nes (SProxy :: SProxy " --" )) (nea [" a" , " b" , " c" ])
208
- , expected: nes (SProxy :: SProxy " a--b--c" )
207
+ { actual: NES .joinWith1 (nes (Proxy :: Proxy " --" )) (nea [" a" , " b" , " c" ])
208
+ , expected: nes (Proxy :: Proxy " a--b--c" )
209
209
}
210
210
assertEqual
211
- { actual: NES .joinWith1 (nes (SProxy :: SProxy " , " )) (nea [" apple" , " banana" ])
212
- , expected: nes (SProxy :: SProxy " apple, banana" )
211
+ { actual: NES .joinWith1 (nes (Proxy :: Proxy " , " )) (nea [" apple" , " banana" ])
212
+ , expected: nes (Proxy :: Proxy " apple, banana" )
213
213
}
214
214
assertEqual
215
- { actual: NES .joinWith1 (nes (SProxy :: SProxy " /" )) (nea [" a" , " b" , " " , " c" , " " ])
216
- , expected: nes (SProxy :: SProxy " a/b//c/" )
215
+ { actual: NES .joinWith1 (nes (Proxy :: Proxy " /" )) (nea [" a" , " b" , " " , " c" , " " ])
216
+ , expected: nes (Proxy :: Proxy " a/b//c/" )
217
217
}
218
218
219
219
nea :: Array ~> NEA.NonEmptyArray
0 commit comments