Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add more test
  • Loading branch information
bobzhang committed Jun 10, 2017
commit 0e211c82ceccf7fe2dc8e46b61df8ef3e09163ab
120 changes: 67 additions & 53 deletions jscomp/test/string_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,136 +214,150 @@ Mt.from_pair_suites("string_test.ml", /* :: */[
],
/* :: */[
/* tuple */[
"xsplit",
"File \"string_test.ml\", line 74, characters 2-9",
(function () {
return /* Eq */Block.__(0, [
/* :: */[
"a",
/* :: */[
"b",
/* :: */[
"c",
/* [] */0
]
]
"aaaa",
/* [] */0
],
xsplit(/* "." */46, "a.b.c")
rev_split_by_char(/* "," */44, "aaaa")
]);
})
],
/* :: */[
/* tuple */[
"split_empty",
"xsplit",
(function () {
return /* Eq */Block.__(0, [
/* [] */0,
Ext_string.split(/* None */0, "", /* "_" */95)
/* :: */[
"a",
/* :: */[
"b",
/* :: */[
"c",
/* [] */0
]
]
],
xsplit(/* "." */46, "a.b.c")
]);
})
],
/* :: */[
/* tuple */[
"split_empty2",
"split_empty",
(function () {
return /* Eq */Block.__(0, [
/* :: */[
"test_unsafe_obj_ffi_ppx.cmi",
/* [] */0
],
Ext_string.split(/* Some */[/* false */0], " test_unsafe_obj_ffi_ppx.cmi", /* " " */32)
/* [] */0,
Ext_string.split(/* None */0, "", /* "_" */95)
]);
})
],
/* :: */[
/* tuple */[
"rfind",
"split_empty2",
(function () {
return /* Eq */Block.__(0, [
7,
Ext_string.rfind("__", "__index__js")
/* :: */[
"test_unsafe_obj_ffi_ppx.cmi",
/* [] */0
],
Ext_string.split(/* Some */[/* false */0], " test_unsafe_obj_ffi_ppx.cmi", /* " " */32)
]);
})
],
/* :: */[
/* tuple */[
"rfind_2",
"rfind",
(function () {
return /* Eq */Block.__(0, [
0,
Ext_string.rfind("__", "__index_js")
7,
Ext_string.rfind("__", "__index__js")
]);
})
],
/* :: */[
/* tuple */[
"rfind_3",
"rfind_2",
(function () {
return /* Eq */Block.__(0, [
-1,
Ext_string.rfind("__", "_index_js")
0,
Ext_string.rfind("__", "__index_js")
]);
})
],
/* :: */[
/* tuple */[
"find",
"rfind_3",
(function () {
return /* Eq */Block.__(0, [
0,
Ext_string.find(/* None */0, "__", "__index__js")
-1,
Ext_string.rfind("__", "_index_js")
]);
})
],
/* :: */[
/* tuple */[
"find_2",
"find",
(function () {
return /* Eq */Block.__(0, [
6,
Ext_string.find(/* None */0, "__", "_index__js")
0,
Ext_string.find(/* None */0, "__", "__index__js")
]);
})
],
/* :: */[
/* tuple */[
"find_3",
"find_2",
(function () {
return /* Eq */Block.__(0, [
-1,
Ext_string.find(/* None */0, "__", "_index_js")
6,
Ext_string.find(/* None */0, "__", "_index__js")
]);
})
],
/* :: */[
/* tuple */[
"of_char",
"find_3",
(function () {
return /* Eq */Block.__(0, [
String.fromCharCode(/* "0" */48),
Caml_string.bytes_to_string(Bytes.make(1, /* "0" */48))
-1,
Ext_string.find(/* None */0, "__", "_index_js")
]);
})
],
/* :: */[
/* tuple */[
"of_chars",
"of_char",
(function () {
return /* Eq */Block.__(0, [
string_of_chars(/* :: */[
/* "0" */48,
/* :: */[
/* "1" */49,
/* :: */[
/* "2" */50,
/* [] */0
]
]
]),
"012"
String.fromCharCode(/* "0" */48),
Caml_string.bytes_to_string(Bytes.make(1, /* "0" */48))
]);
})
],
/* [] */0
/* :: */[
/* tuple */[
"of_chars",
(function () {
return /* Eq */Block.__(0, [
string_of_chars(/* :: */[
/* "0" */48,
/* :: */[
/* "1" */49,
/* :: */[
/* "2" */50,
/* [] */0
]
]
]),
"012"
]);
})
],
/* [] */0
]
]
]
]
Expand Down
4 changes: 3 additions & 1 deletion jscomp/test/string_test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ let string_of_chars x = String.concat "" @@ List.map string_of_char x
Eq ("\\\"\\\"", String.escaped {|""|}));
"rev_split_by_char", (fun _ ->
Eq ([""; "bbbb"; "bbbb"], rev_split_by_char 'a' "bbbbabbbba"));

__LOC__, (fun _ ->
Eq(["aaaa"], rev_split_by_char ',' "aaaa")
) ;
"xsplit", (fun _ -> Eq(["a";"b";"c"], xsplit ~delim:'.' "a.b.c") );
"split_empty", (fun _ -> Eq([], Ext_string.split "" '_') );
"split_empty2", (fun _ ->
Expand Down