hugolib: Simplify some test loops

This commit is contained in:
Bjørn Erik Pedersen 2017-06-06 08:43:33 +02:00
parent 8aaec644a9
commit 1f55cb767d
3 changed files with 53 additions and 61 deletions

View file

@ -28,9 +28,9 @@ func TestPageTargetPath(t *testing.T) {
pathSpec := newTestDefaultPathSpec()
for _, langPrefix := range []string{"", "no"} {
t.Run(fmt.Sprintf("langPrefix=%q", langPrefix), func(t *testing.T) {
for _, uglyURLs := range []bool{false, true} {
t.Run(fmt.Sprintf("uglyURLs=%t", uglyURLs), func(t *testing.T) {
t.Run(fmt.Sprintf("langPrefix=%q,uglyURLs=%t", langPrefix, uglyURLs),
func(t *testing.T) {
tests := []struct {
name string
@ -172,7 +172,5 @@ func TestPageTargetPath(t *testing.T) {
}
})
}
})
}
}

View file

@ -206,9 +206,8 @@ func TestPaginationURLFactory(t *testing.T) {
cfg.Set("paginatePath", "zoo")
for _, uglyURLs := range []bool{false, true} {
t.Run(fmt.Sprintf("uglyURLs=%t", uglyURLs), func(t *testing.T) {
for _, canonifyURLs := range []bool{false, true} {
t.Run(fmt.Sprintf("canonifyURLs=%t", canonifyURLs), func(t *testing.T) {
t.Run(fmt.Sprintf("uglyURLs=%t,canonifyURLs=%t", uglyURLs, canonifyURLs), func(t *testing.T) {
tests := []struct {
name string
@ -255,9 +254,7 @@ func TestPaginationURLFactory(t *testing.T) {
}
})
}
})
}
}
func TestPaginator(t *testing.T) {

View file

@ -53,14 +53,11 @@ func TestByCountOrderOfTaxonomies(t *testing.T) {
//
func TestTaxonomiesWithAndWithoutContentFile(t *testing.T) {
for _, uglyURLs := range []bool{false, true} {
t.Run(fmt.Sprintf("uglyURLs=%t", uglyURLs), func(t *testing.T) {
for _, preserveTaxonomyNames := range []bool{false, true} {
t.Run(fmt.Sprintf("preserveTaxonomyNames=%t", preserveTaxonomyNames), func(t *testing.T) {
t.Run(fmt.Sprintf("uglyURLs=%t,preserveTaxonomyNames=%t", uglyURLs, preserveTaxonomyNames), func(t *testing.T) {
doTestTaxonomiesWithAndWithoutContentFile(t, preserveTaxonomyNames, uglyURLs)
})
}
})
}
}