From 61bcd245cc8808aba4e53544c18d78726b06ef5b Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Thu, 12 Sep 2024 09:55:56 -0400 Subject: [PATCH] add regression test for #45 --- test/dune | 6 ++++++ test/reg_45.expected | 36 +++++++++++++++++++++++++++++++++ test/reg_45.ml | 47 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 89 insertions(+) create mode 100644 test/reg_45.expected create mode 100644 test/reg_45.ml diff --git a/test/dune b/test/dune index a1736e7..0f86c79 100644 --- a/test/dune +++ b/test/dune @@ -45,3 +45,9 @@ (mode promote) (action (copy %{deps} %{targets}))) + +(test + (name reg_45) + (modules reg_45) + (package printbox-text) + (libraries printbox printbox-text)) diff --git a/test/reg_45.expected b/test/reg_45.expected new file mode 100644 index 0000000..5560d5f --- /dev/null +++ b/test/reg_45.expected @@ -0,0 +1,36 @@ +┌─────────┐ +│123456789│ +├─────────┤ +│┌─┐ │ +││.│ │ +│├─┤ │ +││.│ │ +│└─┘ │ +└─────────┘ +┌─────────┐ +│123456789│ +├─────────┤ +│┌────┐ │ +││....│ │ +│├────┤ │ +││. │ │ +│└────┘ │ +└─────────┘ +┌─────────┐ +│123456789│ +├─────────┤ +│┌───────┐│ +││ .││ +│├───────┤│ +││. ││ +│└───────┘│ +└─────────┘ +┌─────────┐ +│123456789│ +├─────────┤ +│┌───────┐│ +││ ....││ +│├───────┤│ +││. ││ +│└───────┘│ +└─────────┘ diff --git a/test/reg_45.ml b/test/reg_45.ml new file mode 100644 index 0000000..185b4da --- /dev/null +++ b/test/reg_45.ml @@ -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 ""