Tezt_core.BaseSourceBase functions.
Same as Filename.concat.
Same as Lwt.both, but immediately propagate exceptions.
More precisely, if one of the two promises is rejected or canceled, cancel the other promise and reject the resulting promise immediately with the original exception.
Get the value of an option that must not be None.
Usage: mandatory name option
name is used in the error message if option is None.
Make a list of all integers between two integers.
If the first argument a is greater than the second argument b, return the empty list. Otherwise, returns the list a; ...; b.
Backport of List.find_map from OCaml 4.10.
take n l returns the first n elements of l if longer than n, else l itself.
drop n l removes the first n elements of l if longer than n, else the empty list. Raise invalid_arg if n is negative.
Split a list based on a predicate.
span f l returns a pair of lists (l1, l2), where l1 is the longest prefix of l that satisfies the predicate f, and l2 is the rest of the list. The order of the elements in the input list is preserved such that l = l1 @ l2.
Compiled regular expressions.
Compile a regular expression using Perl syntax.
Same as rex @@ sf ....
Test whether a string matches a regular expression.
Example: "number 1234 matches" =~ rex "\\d+"
Match a regular expression with two capture groups.
Match a regular expression with three capture groups.
Match a regular expression with four capture groups.
Match a regular expression with one capture group and return all results.
val replace_string :
?pos:int ->
?len:int ->
?all:bool ->
rex ->
by:string ->
string ->
stringreplace_string ~all rex ~by s iterates on s, and replaces every occurrence of rex with by. If all = false, then only the first occurrence of rex is replaced.
Repeat something a given amount of times.
Open file, use function to write output then close the output. In case of error while writing, the channel is closed before raising the exception
Open file, use function to read input then close the input. In case of error while reading, the channel is closed before raising the exception *
Write a string into a file, overwriting the file if it already exists.
Usage: write_file filename ~contents
Read the whole contents of a file.
Path to the root of the project.
This is DUNE_SOURCEROOT is defined, PWD otherwise.