MCPcopy Index your code
hub / github.com/git-bug/git-bug / TestTitleParser

Function TestTitleParser

bridge/gitlab/parser/parser_test.go:9–122  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

7)
8
9func 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 {

Callers

nothing calls this directly

Calls 4

NewWithInputFunction · 0.85
RunMethod · 0.80
ParseMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected