fixes, do not run Format tests on < 4.08

This commit is contained in:
Simon Cruanes 2022-03-19 14:13:15 -04:00
parent 0ce613d7c4
commit 5a4adfa76b
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4
2 changed files with 16 additions and 15 deletions

View file

@ -19,6 +19,7 @@ let do_not_test file =
assert (not (is_suffix ~sub:"make.ml" file));
str_sub ~sub:"Labels.ml" file ||
is_suffix ~sub:".pp.ml" file ||
(if Sys.ocaml_version < "4.08" then Filename.basename file = "CCFormat.ml" else false) ||
is_suffix ~sub:".pp.mli" file ||
is_suffix ~sub:"containers.ml" file ||
is_suffix ~sub:"_top.ml" file ||

View file

@ -407,6 +407,19 @@ let set_color_tag_handling ppf =
in
pp_set_formatter_stag_functions ppf funs'
(*$R
set_color_default true;
let s = sprintf
"what is your %a? %a! No, %a! Ahhhhhhh@."
(styling [`FG `White; `Bold] string) "favorite color"
(styling [`FG `Blue] string) "blue"
(styling [`FG `Red] string) "red"
in
assert_equal ~printer:CCFun.id
"what is your \027[37;1mfavorite color\027[0m? \027[34mblue\027[0m! No, \027[31mred\027[0m! Ahhhhhhh\n"
s
*)
[@@@else_]
(* either prints the tag of [s] or delegate to [or_else] *)
@ -435,9 +448,9 @@ let set_color_tag_handling ppf =
let functions = {
funs with
mark_open_tag = mark_open_tag st ~or_else:funs.mark_open_tag;
mark_close_stag = mark_close_tag st ~or_else:funs.mark_close_tag;
mark_close_tag = mark_close_tag st ~or_else:funs.mark_close_tag;
} in
pp_set_formatter_stag_functions ppf functions
pp_set_formatter_tag_functions ppf functions
[@@@endif]
@ -463,19 +476,6 @@ let set_color_default =
s
*)
(*$R
set_color_default true;
let s = sprintf
"what is your %a? %a! No, %a! Ahhhhhhh@."
(styling [`FG `White; `Bold] string) "favorite color"
(styling [`FG `Blue] string) "blue"
(styling [`FG `Red] string) "red"
in
assert_equal ~printer:CCFun.id
"what is your \027[37;1mfavorite color\027[0m? \027[34mblue\027[0m! No, \027[31mred\027[0m! Ahhhhhhh\n"
s
*)
let with_color s pp out x =
pp_open_tag out s;
pp out x;