(t *testing.T)
| 7 | ) |
| 8 | |
| 9 | func TestHunkMatchesRegex(t *testing.T) { |
| 10 | app := &App{} |
| 11 | |
| 12 | tests := []struct { |
| 13 | name string |
| 14 | hunk git.Hunk |
| 15 | pattern string |
| 16 | expected bool |
| 17 | shouldErr bool |
| 18 | }{ |
| 19 | { |
| 20 | name: "pattern matches context line", |
| 21 | hunk: git.Hunk{ |
| 22 | Text: []string{ |
| 23 | "@@ -1,3 +1,4 @@", |
| 24 | " context line with Account_Fax", |
| 25 | "-old line", |
| 26 | "+new line", |
| 27 | }, |
| 28 | }, |
| 29 | pattern: "Account_Fax", |
| 30 | expected: true, |
| 31 | }, |
| 32 | { |
| 33 | name: "pattern matches added line", |
| 34 | hunk: git.Hunk{ |
| 35 | Text: []string{ |
| 36 | "@@ -1,3 +1,4 @@", |
| 37 | " context line", |
| 38 | "-old line", |
| 39 | "+new line with Account_Fax", |
| 40 | }, |
| 41 | }, |
| 42 | pattern: "Account_Fax", |
| 43 | expected: true, |
| 44 | }, |
| 45 | { |
| 46 | name: "pattern matches removed line", |
| 47 | hunk: git.Hunk{ |
| 48 | Text: []string{ |
| 49 | "@@ -1,3 +1,4 @@", |
| 50 | " context line", |
| 51 | "-old line with Account_Fax", |
| 52 | "+new line", |
| 53 | }, |
| 54 | }, |
| 55 | pattern: "Account_Fax", |
| 56 | expected: true, |
| 57 | }, |
| 58 | { |
| 59 | name: "pattern matches header line", |
| 60 | hunk: git.Hunk{ |
| 61 | Text: []string{ |
| 62 | "@@ -1,3 +1,4 @@ Account_Fax", |
| 63 | " context line", |
| 64 | "-old line", |
| 65 | "+new line", |
| 66 | }, |
nothing calls this directly
no test coverage detected