Skip to content

Commit

Permalink
add regression test for #45
Browse files Browse the repository at this point in the history
  • Loading branch information
c-cube committed Sep 12, 2024
1 parent 4a17c68 commit 61bcd24
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/dune
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,9 @@
(mode promote)
(action
(copy %{deps} %{targets})))

(test
(name reg_45)
(modules reg_45)
(package printbox-text)
(libraries printbox printbox-text))
36 changes: 36 additions & 0 deletions test/reg_45.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
┌─────────┐
│123456789│
├─────────┤
│┌─┐ │
││.│ │
│├─┤ │
││.│ │
│└─┘ │
└─────────┘
┌─────────┐
│123456789│
├─────────┤
│┌────┐ │
││....│ │
│├────┤ │
││. │ │
│└────┘ │
└─────────┘
┌─────────┐
│123456789│
├─────────┤
│┌───────┐│
││ .││
│├───────┤│
││. ││
│└───────┘│
└─────────┘
┌─────────┐
│123456789│
├─────────┤
│┌───────┐│
││ ....││
│├───────┤│
││. ││
│└───────┘│
└─────────┘
47 changes: 47 additions & 0 deletions test/reg_45.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
let () =
PrintBox.(
PrintBox_text.output stdout
@@ frame
(vlist
[
text "123456789";
frame (vlist [ text "." |> align ~h:`Right ~v:`Top; text "." ]);
]));
print_endline ""

let () =
PrintBox.(
PrintBox_text.output stdout
@@ frame
(vlist
[
text "123456789";
frame (vlist [ text "...." |> align ~h:`Right ~v:`Top; text "." ]);
]));
print_endline ""

(* now with stretch *)

let () =
PrintBox.(
PrintBox_text.output stdout
@@ frame
(vlist
[
text "123456789";
frame ~stretch:true
(vlist [ text "." |> align ~h:`Right ~v:`Top; text "." ]);
]));
print_endline ""

let () =
PrintBox.(
PrintBox_text.output stdout
@@ frame
(vlist
[
text "123456789";
frame ~stretch:true
(vlist [ text "...." |> align ~h:`Right ~v:`Top; text "." ]);
]));
print_endline ""

0 comments on commit 61bcd24

Please sign in to comment.