Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
c-cube committed Jan 18, 2022
1 parent 9e9334b commit 2f96cde
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 1 deletion.
31 changes: 31 additions & 0 deletions test/test1.expected
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,32 @@ root
│ │ 10│20 │
│ │ │
└─────┴──────────────────────────┘
┌─────────────────┬──────────────────────────────────────────────────────────────┐
│subject │announce: printbox 0.3 │
├─────────────────┼──────────────────────────────────────────────────────────────┤
│explanation │┌────────────────────────────────────────────────────────────┐│
│ ││PrintBox is a library for rendering nested tables, ││
│ ││ trees, and similar structures in monospace text or HTML.││
│ │└────────────────────────────────────────────────────────────┘│
├─────────────────┼──────────────────────────────────────────────────────────────┤
│github │https://github.com/c-cube/printbox/releases/tag/0.3 │
├─────────────────┼──────────────────────────────────────────────────────────────┤
│contributors │Simon │
│ ├──────────────────────────────────────────────────────────────┤
│ │Guillaume │
│ ├──────────────────────────────────────────────────────────────┤
│ │Matt │
├─────────────────┼──────────────────────────────────────────────────────────────┤
│dependencies │├─mandatory │
│ ││ ├─dune │
│ ││ └─bytes │
│ │└─optional │
│ │ ├─uutf │
│ │ ├─uucp │
│ │ └─tyxml │
├─────────────────┼──────────────────────────────────────────────────────────────┤
│expected reaction│🎉 │
└─────────────────┴──────────────────────────────────────────────────────────────┘
┌────────────────────────────────────┐
│nice unicode! 💪 │
├────────────────────────────────────┤
Expand All @@ -528,3 +554,8 @@ root
││ │└─────────────────┘││
│└──────────────┴───────────────────┘│
└────────────────────────────────────┘
┌─────────────────────────────────┐
│ab │
│cd no color here │
│hello world color me (but not me)│
└─────────────────────────────────┘
17 changes: 16 additions & 1 deletion test/test1.ml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ end

let b =
let open PrintBox in
frame @@ record [
frame @@ v_record [
("subject", text_with_style Style.bold "announce: printbox 0.3");
("explanation",
frame @@ text {|PrintBox is a library for rendering nested tables,
Expand All @@ -96,6 +96,9 @@ let b =
("expected reaction", text "🎉");
]

(* announcefor 0.3 *)
let () = print_endline @@ PrintBox_text.to_string b

module Unicode = struct
let b =
B.(frame @@ vlist [text "nice unicode! 💪"; frame @@
Expand All @@ -107,3 +110,15 @@ module Unicode = struct

let () = print_endline @@ PrintBox_text.to_string b
end

module Rich_text_ = struct
let b =
B.(frame @@ rich_text @@ Rich_text.(lines [
cat [with_style Style.(bg_color Cyan) (s "ab\ncd"); s " no color here"];
cat [s "hello"; space; s "world";
with_style Style.(fg_color Green) (s " color me"); s " (but not me)"];
]));;

let () = print_endline @@ PrintBox_text.to_string b

end

0 comments on commit 2f96cde

Please sign in to comment.