Skip to content

Commit 0e211c8

Browse files
committed
add more test
1 parent d834b5c commit 0e211c8

File tree

2 files changed

+70
-54
lines changed

2 files changed

+70
-54
lines changed

jscomp/test/string_test.js

+67-53
Original file line numberDiff line numberDiff line change
@@ -214,136 +214,150 @@ Mt.from_pair_suites("string_test.ml", /* :: */[
214214
],
215215
/* :: */[
216216
/* tuple */[
217-
"xsplit",
217+
"File \"string_test.ml\", line 74, characters 2-9",
218218
(function () {
219219
return /* Eq */Block.__(0, [
220220
/* :: */[
221-
"a",
222-
/* :: */[
223-
"b",
224-
/* :: */[
225-
"c",
226-
/* [] */0
227-
]
228-
]
221+
"aaaa",
222+
/* [] */0
229223
],
230-
xsplit(/* "." */46, "a.b.c")
224+
rev_split_by_char(/* "," */44, "aaaa")
231225
]);
232226
})
233227
],
234228
/* :: */[
235229
/* tuple */[
236-
"split_empty",
230+
"xsplit",
237231
(function () {
238232
return /* Eq */Block.__(0, [
239-
/* [] */0,
240-
Ext_string.split(/* None */0, "", /* "_" */95)
233+
/* :: */[
234+
"a",
235+
/* :: */[
236+
"b",
237+
/* :: */[
238+
"c",
239+
/* [] */0
240+
]
241+
]
242+
],
243+
xsplit(/* "." */46, "a.b.c")
241244
]);
242245
})
243246
],
244247
/* :: */[
245248
/* tuple */[
246-
"split_empty2",
249+
"split_empty",
247250
(function () {
248251
return /* Eq */Block.__(0, [
249-
/* :: */[
250-
"test_unsafe_obj_ffi_ppx.cmi",
251-
/* [] */0
252-
],
253-
Ext_string.split(/* Some */[/* false */0], " test_unsafe_obj_ffi_ppx.cmi", /* " " */32)
252+
/* [] */0,
253+
Ext_string.split(/* None */0, "", /* "_" */95)
254254
]);
255255
})
256256
],
257257
/* :: */[
258258
/* tuple */[
259-
"rfind",
259+
"split_empty2",
260260
(function () {
261261
return /* Eq */Block.__(0, [
262-
7,
263-
Ext_string.rfind("__", "__index__js")
262+
/* :: */[
263+
"test_unsafe_obj_ffi_ppx.cmi",
264+
/* [] */0
265+
],
266+
Ext_string.split(/* Some */[/* false */0], " test_unsafe_obj_ffi_ppx.cmi", /* " " */32)
264267
]);
265268
})
266269
],
267270
/* :: */[
268271
/* tuple */[
269-
"rfind_2",
272+
"rfind",
270273
(function () {
271274
return /* Eq */Block.__(0, [
272-
0,
273-
Ext_string.rfind("__", "__index_js")
275+
7,
276+
Ext_string.rfind("__", "__index__js")
274277
]);
275278
})
276279
],
277280
/* :: */[
278281
/* tuple */[
279-
"rfind_3",
282+
"rfind_2",
280283
(function () {
281284
return /* Eq */Block.__(0, [
282-
-1,
283-
Ext_string.rfind("__", "_index_js")
285+
0,
286+
Ext_string.rfind("__", "__index_js")
284287
]);
285288
})
286289
],
287290
/* :: */[
288291
/* tuple */[
289-
"find",
292+
"rfind_3",
290293
(function () {
291294
return /* Eq */Block.__(0, [
292-
0,
293-
Ext_string.find(/* None */0, "__", "__index__js")
295+
-1,
296+
Ext_string.rfind("__", "_index_js")
294297
]);
295298
})
296299
],
297300
/* :: */[
298301
/* tuple */[
299-
"find_2",
302+
"find",
300303
(function () {
301304
return /* Eq */Block.__(0, [
302-
6,
303-
Ext_string.find(/* None */0, "__", "_index__js")
305+
0,
306+
Ext_string.find(/* None */0, "__", "__index__js")
304307
]);
305308
})
306309
],
307310
/* :: */[
308311
/* tuple */[
309-
"find_3",
312+
"find_2",
310313
(function () {
311314
return /* Eq */Block.__(0, [
312-
-1,
313-
Ext_string.find(/* None */0, "__", "_index_js")
315+
6,
316+
Ext_string.find(/* None */0, "__", "_index__js")
314317
]);
315318
})
316319
],
317320
/* :: */[
318321
/* tuple */[
319-
"of_char",
322+
"find_3",
320323
(function () {
321324
return /* Eq */Block.__(0, [
322-
String.fromCharCode(/* "0" */48),
323-
Caml_string.bytes_to_string(Bytes.make(1, /* "0" */48))
325+
-1,
326+
Ext_string.find(/* None */0, "__", "_index_js")
324327
]);
325328
})
326329
],
327330
/* :: */[
328331
/* tuple */[
329-
"of_chars",
332+
"of_char",
330333
(function () {
331334
return /* Eq */Block.__(0, [
332-
string_of_chars(/* :: */[
333-
/* "0" */48,
334-
/* :: */[
335-
/* "1" */49,
336-
/* :: */[
337-
/* "2" */50,
338-
/* [] */0
339-
]
340-
]
341-
]),
342-
"012"
335+
String.fromCharCode(/* "0" */48),
336+
Caml_string.bytes_to_string(Bytes.make(1, /* "0" */48))
343337
]);
344338
})
345339
],
346-
/* [] */0
340+
/* :: */[
341+
/* tuple */[
342+
"of_chars",
343+
(function () {
344+
return /* Eq */Block.__(0, [
345+
string_of_chars(/* :: */[
346+
/* "0" */48,
347+
/* :: */[
348+
/* "1" */49,
349+
/* :: */[
350+
/* "2" */50,
351+
/* [] */0
352+
]
353+
]
354+
]),
355+
"012"
356+
]);
357+
})
358+
],
359+
/* [] */0
360+
]
347361
]
348362
]
349363
]

jscomp/test/string_test.ml

+3-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ let string_of_chars x = String.concat "" @@ List.map string_of_char x
7171
Eq ("\\\"\\\"", String.escaped {|""|}));
7272
"rev_split_by_char", (fun _ ->
7373
Eq ([""; "bbbb"; "bbbb"], rev_split_by_char 'a' "bbbbabbbba"));
74-
74+
__LOC__, (fun _ ->
75+
Eq(["aaaa"], rev_split_by_char ',' "aaaa")
76+
) ;
7577
"xsplit", (fun _ -> Eq(["a";"b";"c"], xsplit ~delim:'.' "a.b.c") );
7678
"split_empty", (fun _ -> Eq([], Ext_string.split "" '_') );
7779
"split_empty2", (fun _ ->

0 commit comments

Comments
 (0)