mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-13 20:24:00 +02:00
markup/goldmark: Change link and image render hook enablement to enums
Closes #13535
This commit is contained in:
committed by
Bjørn Erik Pedersen
parent
b8ba33ca95
commit
84b31721bf
@@ -18,9 +18,8 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/gohugoio/hugo/helpers"
|
||||
|
||||
qt "github.com/frankban/quicktest"
|
||||
"github.com/gohugoio/hugo/helpers"
|
||||
)
|
||||
|
||||
func TestResolveMarkup(t *testing.T) {
|
||||
@@ -304,3 +303,26 @@ func BenchmarkUniqueStrings(b *testing.B) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func TestStringSliceToList(t *testing.T) {
|
||||
for _, tt := range []struct {
|
||||
slice []string
|
||||
conjunction string
|
||||
want string
|
||||
}{
|
||||
{[]string{}, "", ""},
|
||||
{[]string{"foo"}, "", "foo"},
|
||||
{[]string{"foo"}, "and", "foo"},
|
||||
{[]string{"foo", "bar"}, "", "foo and bar"},
|
||||
{[]string{"foo", "bar"}, "and", "foo and bar"},
|
||||
{[]string{"foo", "bar"}, "or", "foo or bar"},
|
||||
{[]string{"foo", "bar", "baz"}, "", "foo, bar, and baz"},
|
||||
{[]string{"foo", "bar", "baz"}, "and", "foo, bar, and baz"},
|
||||
{[]string{"foo", "bar", "baz"}, "or", "foo, bar, or baz"},
|
||||
} {
|
||||
got := helpers.StringSliceToList(tt.slice, tt.conjunction)
|
||||
if got != tt.want {
|
||||
t.Errorf("StringSliceToList() got: %q, want: %q", got, tt.want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user