mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
add test for nested ansi color
This commit is contained in:
parent
0d273d886f
commit
14acdbc1c6
1 changed files with 17 additions and 4 deletions
|
|
@ -46,10 +46,10 @@ let () =
|
||||||
Pretty.to_string ~width:10 d)
|
Pretty.to_string ~width:10 d)
|
||||||
|
|
||||||
let ext_coucou =
|
let ext_coucou =
|
||||||
{
|
Ext.make ~name:"coucou"
|
||||||
Ext.pre = (fun out () -> out.string "<coucou>");
|
~pre:(fun out ~inside:_ () -> out.string "<coucou>")
|
||||||
post = (fun out () -> out.string "</coucou>");
|
~post:(fun out ~inside:_ () -> out.string "</coucou>")
|
||||||
}
|
()
|
||||||
|
|
||||||
let () =
|
let () =
|
||||||
eq ~name:"wrap1" ~printer:(spf "%S")
|
eq ~name:"wrap1" ~printer:(spf "%S")
|
||||||
|
|
@ -59,3 +59,16 @@ let () =
|
||||||
[ text "bar"; ext ext_coucou () (sexp_apply "g" [ int 42; int 10 ]) ]
|
[ text "bar"; ext ext_coucou () (sexp_apply "g" [ int 42; int 10 ]) ]
|
||||||
in
|
in
|
||||||
Pretty.to_string ~width:10 d)
|
Pretty.to_string ~width:10 d)
|
||||||
|
|
||||||
|
let () =
|
||||||
|
eq ~name:"nested color" ~printer:(spf "%S")
|
||||||
|
"hello \027[32mworld \027[31moh my!\027[32m!?\027[43moh well\027[32m\027[0m"
|
||||||
|
(let d =
|
||||||
|
text "hello"
|
||||||
|
^+ Term_color.color `Green
|
||||||
|
(text "world"
|
||||||
|
^+ Term_color.color `Red (text "oh my!")
|
||||||
|
^ text "!?"
|
||||||
|
^ Term_color.style_l [ `BG `Yellow ] (text "oh well"))
|
||||||
|
in
|
||||||
|
Pretty.to_string ~width:1000 d)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue