Simon Génier pushed to branch master at Stefan / Typer
Commits: 4eac6264 by Simon Génier at 2020-09-10T16:05:31-04:00 Get rid of warning by using String.uppercase_ascii.
This function is available since 4.03, and 4.05 is now on Debian stable so it is safe to use.
- - - - - a5a05e7b by Simon Génier at 2020-09-11T17:22:08-04:00 Merge branch 'string-uppercase' into master.
- - - - -
4 changed files:
- src/log.ml - src/util.ml - tests/utest_lib.ml - tests/utest_main.ml
Changes:
===================================== src/log.ml ===================================== @@ -47,7 +47,7 @@ let string_of_level lvl = | Debug -> "Debug"
let level_of_string str = - match Util.string_uppercase str with + match String.uppercase_ascii str with | "NOTHING" -> Nothing | "FATAL" -> Fatal | "ERROR" -> Error
===================================== src/util.ml ===================================== @@ -63,10 +63,6 @@ let loc_print loc = print_string (loc_string loc) let string_implode chars = String.concat "" (List.map (String.make 1) chars) let string_sub str b e = String.sub str b (e - b)
-(* `String.uppercase` is deprecated since OCaml-4.03, but the replacement - * `String.uppercase_ascii` is not yet available in Debian stable's `ocaml`. *) -let string_uppercase s = String.uppercase s - let opt_map f x = match x with None -> None | Some x -> Some (f x)
let str_split str sep =
===================================== tests/utest_lib.ml ===================================== @@ -30,8 +30,6 @@ * * --------------------------------------------------------------------------- *)
- -module U = Util open Fmt
module StringMap = @@ -83,20 +81,20 @@ let arg_defs = [ Arg.String (fun g -> global_sample_dir := g), " Set sample directory"); (* Allow users to select which test to run *) ("--fsection", - Arg.String (fun g -> global_fsection := U.string_uppercase g), + Arg.String (fun g -> global_fsection := String.uppercase_ascii g), " Set test filter"); ("--ftitle", - Arg.String (fun g -> global_ftitle := U.string_uppercase g), + Arg.String (fun g -> global_ftitle := String.uppercase_ascii g), " Set test filter"); ]
let must_run_section str = !global_fsection = "" - || U.string_uppercase str = !global_fsection + || String.uppercase_ascii str = !global_fsection
let must_run_title str = !global_ftitle = "" - || U.string_uppercase str = !global_ftitle + || String.uppercase_ascii str = !global_ftitle
let parse_args () = Arg.parse arg_defs (fun s -> ()) ""
===================================== tests/utest_main.ml ===================================== @@ -29,8 +29,8 @@ * Basic utest program run all tests * * --------------------------------------------------------------------------- *) + open Fmt -module U = Util
let cut_name str = String.sub str 0 (String.length str - 12) @@ -51,10 +51,10 @@ let arg_defs = [ Arg.String (fun g -> global_tests_dir := g), " Set tests directory"); (* Allow users to select which test to run *) ("--fsection", - Arg.String (fun g -> global_fsection := U.string_uppercase g; + Arg.String (fun g -> global_fsection := String.uppercase_ascii g; global_filter := true), " Set test filter"); ("--ftitle", - Arg.String (fun g -> global_ftitle := U.string_uppercase g; + Arg.String (fun g -> global_ftitle := String.uppercase_ascii g; global_filter := true), " Set test filter"); ]
@@ -88,7 +88,7 @@ let print_file_name i n name pass =
let must_run str = not (!global_filter) - || U.string_uppercase (cut_name str) = !global_fsection + || String.uppercase_ascii (cut_name str) = !global_fsection
(* search *_test.byte executable en run them Usage:
View it on GitLab: https://gitlab.com/monnier/typer/-/compare/a4540d1406fe38e5432cfb939e2e7e903...
Afficher les réponses par date