(t *testing.T)
| 76 | } |
| 77 | |
| 78 | func 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 | ), |
nothing calls this directly
no test coverage detected