MCPcopy
hub / github.com/mum4k/termdash / TestNew

Function TestNew

container/container_test.go:78–1357  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

76}
77
78func TestNew(t *testing.T) {
79 tests := []struct {
80 desc string
81 termSize image.Point
82 container func(ft *faketerm.Terminal) (*Container, error)
83 wantContainerErr bool
84 want func(size image.Point) *faketerm.Terminal
85 }{
86 {
87 desc: "fails on MarginTop too low",
88 termSize: image.Point{10, 10},
89 container: func(ft *faketerm.Terminal) (*Container, error) {
90 return New(ft, MarginTop(-1))
91 },
92 wantContainerErr: true,
93 },
94 {
95 desc: "fails on invalid option on the first vertical child container",
96 termSize: image.Point{10, 10},
97 container: func(ft *faketerm.Terminal) (*Container, error) {
98 return New(
99 ft,
100 SplitVertical(
101 Left(
102 MarginTop(-1),
103 ),
104 Right(),
105 ),
106 )
107 },
108 wantContainerErr: true,
109 },
110 {
111 desc: "fails on invalid option on the second vertical child container",
112 termSize: image.Point{10, 10},
113 container: func(ft *faketerm.Terminal) (*Container, error) {
114 return New(
115 ft,
116 SplitVertical(
117 Left(),
118 Right(
119 MarginTop(-1),
120 ),
121 ),
122 )
123 },
124 wantContainerErr: true,
125 },
126 {
127 desc: "fails on invalid option on the first horizontal child container",
128 termSize: image.Point{10, 10},
129 container: func(ft *faketerm.Terminal) (*Container, error) {
130 return New(
131 ft,
132 SplitHorizontal(
133 Top(
134 MarginTop(-1),
135 ),

Callers

nothing calls this directly

Calls 15

MustNewFunction · 0.92
MustNewFunction · 0.92
MustBorderFunction · 0.92
BorderCellOptsFunction · 0.92
FgColorFunction · 0.92
MustApplyFunction · 0.92
MustTextFunction · 0.92
TextCellOptsFunction · 0.92
NewFunction · 0.92
MustDrawFunction · 0.92
NewFunction · 0.92
DiffFunction · 0.92

Tested by

no test coverage detected