Skip to content

Commit 0618c73

Browse files
feat(test): add test for JoinHorizontal (#346)
* refactor: use position constants * test: add test for JoinHorizontal
1 parent ed7f56e commit 0618c73

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

join_test.go

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ func TestJoinVertical(t *testing.T) {
99
expected string
1010
}
1111
tests := []test{
12-
{"pos0", JoinVertical(0, "A", "BBBB"), "A \nBBBB"},
13-
{"pos1", JoinVertical(1, "A", "BBBB"), " A\nBBBB"},
12+
{"pos0", JoinVertical(Left, "A", "BBBB"), "A \nBBBB"},
13+
{"pos1", JoinVertical(Right, "A", "BBBB"), " A\nBBBB"},
1414
{"pos0.25", JoinVertical(0.25, "A", "BBBB"), " A \nBBBB"},
1515
}
1616

@@ -22,3 +22,24 @@ func TestJoinVertical(t *testing.T) {
2222
})
2323
}
2424
}
25+
26+
func TestJoinHorizontal(t *testing.T) {
27+
type test struct {
28+
name string
29+
result string
30+
expected string
31+
}
32+
tests := []test{
33+
{"pos0", JoinHorizontal(Top, "A", "B\nB\nB\nB"), "AB\n B\n B\n B"},
34+
{"pos1", JoinHorizontal(Bottom, "A", "B\nB\nB\nB"), " B\n B\n B\nAB"},
35+
{"pos0.25", JoinHorizontal(0.25, "A", "B\nB\nB\nB"), " B\nAB\n B\n B"},
36+
}
37+
38+
for _, test := range tests {
39+
t.Run(test.name, func(t *testing.T) {
40+
if test.result != test.expected {
41+
t.Errorf("Got \n%s\n, expected \n%s\n", test.result, test.expected)
42+
}
43+
})
44+
}
45+
}

0 commit comments

Comments
 (0)