From b1d066abecaee4bb8ea5559b095da41464f2d975 Mon Sep 17 00:00:00 2001 From: aditipatelpro Date: Tue, 6 Aug 2024 23:13:49 -0500 Subject: [PATCH] test: add test for JoinHorizontal --- join_test.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/join_test.go b/join_test.go index c57543e2..49f94dc4 100644 --- a/join_test.go +++ b/join_test.go @@ -22,3 +22,24 @@ func TestJoinVertical(t *testing.T) { }) } } + +func TestJoinHorizontal(t *testing.T) { + type test struct { + name string + result string + expected string + } + tests := []test{ + {"pos0", JoinHorizontal(Top, "A", "B\nB\nB\nB"), "AB\n B\n B\n B"}, + {"pos1", JoinHorizontal(Bottom, "A", "B\nB\nB\nB"), " B\n B\n B\nAB"}, + {"pos0.25", JoinHorizontal(0.25, "A", "B\nB\nB\nB"), " B\nAB\n B\n B"}, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + if test.result != test.expected { + t.Errorf("Got \n%s\n, expected \n%s\n", test.result, test.expected) + } + }) + } +}