(t *testing.T)
| 160 | } |
| 161 | |
| 162 | func Test_cutLinesFromFullDiff(t *testing.T) { |
| 163 | type args struct { |
| 164 | r io.Reader |
| 165 | startLine int |
| 166 | endLine int |
| 167 | } |
| 168 | tests := []struct { |
| 169 | name string |
| 170 | args args |
| 171 | wantW string |
| 172 | wantErr bool |
| 173 | }{ |
| 174 | { |
| 175 | name: "test empty", |
| 176 | args: args{ |
| 177 | r: strings.NewReader(`diff --git a/file.txt b/file.txt |
| 178 | index f0eec86f614944a81f87d879ebdc9a79aea0d7ea..47d2739ba2c34690248c8f91b84bb54e8936899a 100644 |
| 179 | --- a/file.txt |
| 180 | +++ b/file.txt |
| 181 | @@ -0,0 +0,0 @@ |
| 182 | `), |
| 183 | startLine: 2, |
| 184 | endLine: 10, |
| 185 | }, |
| 186 | wantW: `diff --git a/file.txt b/file.txt |
| 187 | index f0eec86f614944a81f87d879ebdc9a79aea0d7ea..47d2739ba2c34690248c8f91b84bb54e8936899a 100644 |
| 188 | --- a/file.txt |
| 189 | +++ b/file.txt |
| 190 | @@ -0,0 +0,0 @@ |
| 191 | `, |
| 192 | }, |
| 193 | { |
| 194 | name: "test 1", |
| 195 | args: args{ |
| 196 | r: strings.NewReader(`diff --git a/file.txt b/file.txt |
| 197 | index f0eec86f614944a81f87d879ebdc9a79aea0d7ea..47d2739ba2c34690248c8f91b84bb54e8936899a 100644 |
| 198 | --- a/file.txt |
| 199 | +++ b/file.txt |
| 200 | @@ -1,9 +1,9 @@ |
| 201 | some content |
| 202 | some content |
| 203 | some content |
| 204 | -some content |
| 205 | +some content |
| 206 | some content |
| 207 | some content |
| 208 | some content |
| 209 | some content |
| 210 | some content |
| 211 | `), |
| 212 | startLine: 2, |
| 213 | endLine: 10, |
| 214 | }, |
| 215 | wantW: `diff --git a/file.txt b/file.txt |
| 216 | index f0eec86f614944a81f87d879ebdc9a79aea0d7ea..47d2739ba2c34690248c8f91b84bb54e8936899a 100644 |
| 217 | --- a/file.txt |
| 218 | +++ b/file.txt |
| 219 | @@ -2,8 +2,8 @@ |
nothing calls this directly
no test coverage detected
searching dependent graphs…