-
Notifications
You must be signed in to change notification settings - Fork 234
/
join_test.go
45 lines (40 loc) · 1.07 KB
/
join_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package lipgloss
import "testing"
func TestJoinVertical(t *testing.T) {
type test struct {
name string
result string
expected string
}
tests := []test{
{"pos0", JoinVertical(Left, "A", "BBBB"), "A \nBBBB"},
{"pos1", JoinVertical(Right, "A", "BBBB"), " A\nBBBB"},
{"pos0.25", JoinVertical(0.25, "A", "BBBB"), " A \nBBBB"},
}
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)
}
})
}
}
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)
}
})
}
}