(t *testing.T)
| 7 | ) |
| 8 | |
| 9 | func TestTitleParser(t *testing.T) { |
| 10 | type args struct { |
| 11 | diff string |
| 12 | } |
| 13 | type want struct { |
| 14 | title string |
| 15 | } |
| 16 | tests := []struct { |
| 17 | name string |
| 18 | args args |
| 19 | want want |
| 20 | }{ |
| 21 | { |
| 22 | name: "simple addition (html)", |
| 23 | args: args{ |
| 24 | diff: `<p>changed title from <code class="idiff">simple title</code> to <code class="idiff">simple title<span class="idiff left addition"> addition</span></code></p>`, |
| 25 | }, |
| 26 | want: want{ |
| 27 | title: "simple title addition", |
| 28 | }, |
| 29 | }, |
| 30 | { |
| 31 | name: "simple addition (markdown)", |
| 32 | args: args{ |
| 33 | diff: `changed title from **simple title** to **simple title{+ addition+}**`, |
| 34 | }, |
| 35 | want: want{ |
| 36 | title: "simple title addition", |
| 37 | }, |
| 38 | }, |
| 39 | { |
| 40 | name: "simple deletion (html)", |
| 41 | args: args{ |
| 42 | diff: `<p>changed title from <code class="idiff">simple<span class="idiff left right deletion"> deleted</span> title</code> to <code class="idiff">simple title</code></p>`, |
| 43 | }, |
| 44 | want: want{ |
| 45 | title: "simple title", |
| 46 | }, |
| 47 | }, |
| 48 | { |
| 49 | name: "simple deletion (markdown)", |
| 50 | args: args{ |
| 51 | diff: `changed title from **simple{- deleted-} title** to **simple title**`, |
| 52 | }, |
| 53 | want: want{ |
| 54 | title: "simple title", |
| 55 | }, |
| 56 | }, |
| 57 | { |
| 58 | name: "tail replacement (html)", |
| 59 | args: args{ |
| 60 | diff: `<p>changed title from <code class="idiff">tail <span class="idiff left right deletion">title</span></code> to <code class="idiff">tail <span class="idiff left addition">replacement</span></code></p>`, |
| 61 | }, |
| 62 | want: want{ |
| 63 | title: "tail replacement", |
| 64 | }, |
| 65 | }, |
| 66 | { |
nothing calls this directly
no test coverage detected