mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
bugfix; more tests
This commit is contained in:
parent
735a11e5ec
commit
d36e8dd38e
2 changed files with 7 additions and 6 deletions
|
|
@ -92,7 +92,7 @@ module Split = struct
|
|||
and _split_search ~by s prev i =
|
||||
if i >= String.length s
|
||||
then Some (SplitStop, prev, String.length s - prev)
|
||||
else if _is_prefix ~by s i 0 && i>prev
|
||||
else if _is_prefix ~by s i 0
|
||||
then Some (SplitAt (i+String.length by), prev, i-prev)
|
||||
else _split_search ~by s prev (i+1)
|
||||
|
||||
|
|
@ -142,11 +142,6 @@ module Split = struct
|
|||
|
||||
let seq ~by s = _mkseq ~by s _tuple3
|
||||
let seq_cpy ~by s = _mkseq ~by s String.sub
|
||||
|
||||
(*$T
|
||||
Split.list_cpy ~by:"," "aa,bb,cc" = ["aa"; "bb"; "cc"]
|
||||
Split.list_cpy ~by:"--" "a--b----c--" = ["a"; "b"; ""; "c"; ""]
|
||||
*)
|
||||
end
|
||||
|
||||
(* note: inefficient *)
|
||||
|
|
|
|||
|
|
@ -111,6 +111,12 @@ module Split : sig
|
|||
|
||||
val list_cpy : by:t -> t -> t list
|
||||
|
||||
(*$T
|
||||
Split.list_cpy ~by:"," "aa,bb,cc" = ["aa"; "bb"; "cc"]
|
||||
Split.list_cpy ~by:"--" "a--b----c--" = ["a"; "b"; ""; "c"; ""]
|
||||
Split.list_cpy ~by:" " "hello world aie" = ["hello"; ""; "world"; "aie"]
|
||||
*)
|
||||
|
||||
val gen_cpy : by:t -> t -> t gen
|
||||
|
||||
val seq_cpy : by:t -> t -> t sequence
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue