File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed
Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -34,3 +34,14 @@ func (m *Markdown) GreenBadge(text string) *Markdown {
3434func (m * Markdown ) GreenBadgef (format string , args ... interface {}) * Markdown {
3535 return m .GreenBadge (fmt .Sprintf (format , args ... ))
3636}
37+
38+ // BlueBadge set text with blue badge format.
39+ func (m * Markdown ) blueBadge (text string ) * Markdown {
40+ m .body = append (m .body , fmt .Sprintf ("" , text ))
41+ return m
42+ }
43+
44+ // BlueBadgef set text with blue badge format. It is similar to fmt.Sprintf.
45+ func (m * Markdown ) BlueBadgef (format string , args ... interface {}) * Markdown {
46+ return m .blueBadge (fmt .Sprintf (format , args ... ))
47+ }
Original file line number Diff line number Diff line change @@ -47,4 +47,17 @@ func TestMarkdown_RedBadgef(t *testing.T) {
4747 t .Errorf ("value is mismatch (-want +got):\n %s" , diff )
4848 }
4949 })
50+
51+ t .Run ("success BlueBadgef()" , func (t * testing.T ) {
52+ t .Parallel ()
53+
54+ m := NewMarkdown (io .Discard )
55+ m .BlueBadgef ("%s" , "Hello" )
56+ want := []string {"" }
57+ got := m .body
58+
59+ if diff := cmp .Diff (want , got ); diff != "" {
60+ t .Errorf ("value is mismatch (-want +got):\n %s" , diff )
61+ }
62+ })
5063}
You can’t perform that action at this time.
0 commit comments