mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 03:05:28 -05:00
add test for nested ansi color
This commit is contained in:
parent
ba9ef1f453
commit
517fd99a5f
1 changed files with 17 additions and 4 deletions
|
|
@ -46,10 +46,10 @@ let () =
|
|||
Pretty.to_string ~width:10 d)
|
||||
|
||||
let ext_coucou =
|
||||
{
|
||||
Ext.pre = (fun out () -> out.string "<coucou>");
|
||||
post = (fun out () -> out.string "</coucou>");
|
||||
}
|
||||
Ext.make ~name:"coucou"
|
||||
~pre:(fun out ~inside:_ () -> out.string "<coucou>")
|
||||
~post:(fun out ~inside:_ () -> out.string "</coucou>")
|
||||
()
|
||||
|
||||
let () =
|
||||
eq ~name:"wrap1" ~printer:(spf "%S")
|
||||
|
|
@ -59,3 +59,16 @@ let () =
|
|||
[ text "bar"; ext ext_coucou () (sexp_apply "g" [ int 42; int 10 ]) ]
|
||||
in
|
||||
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