diff options
Diffstat (limited to 'hugolib/hugo_sites_build_test.go')
-rw-r--r-- | hugolib/hugo_sites_build_test.go | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/hugolib/hugo_sites_build_test.go b/hugolib/hugo_sites_build_test.go index 7ef59bc26..3498de67f 100644 --- a/hugolib/hugo_sites_build_test.go +++ b/hugolib/hugo_sites_build_test.go @@ -83,8 +83,8 @@ func doTestMultiSitesMainLangInRoot(t *testing.T, defaultInSubDir bool) { require.Equal(t, "/blog/en/foo", enSite.Info.pathSpec.RelURL("foo", true)) - doc1en := enSite.regularPages[0] - doc1fr := frSite.regularPages[0] + doc1en := enSite.RegularPages[0] + doc1fr := frSite.RegularPages[0] enPerm, _ := doc1en.Permalink() enRelPerm, _ := doc1en.RelPermalink() @@ -216,24 +216,24 @@ func doTestMultiSitesBuild(t *testing.T, configTemplate, configSuffix string) { assert.Equal(t, "en", enSite.Language.Lang) - if len(enSite.regularPages) != 4 { + if len(enSite.RegularPages) != 4 { t.Fatal("Expected 4 english pages") } assert.Len(t, enSite.Source.Files(), 14, "should have 13 source files") assert.Len(t, enSite.AllPages, 28, "should have 28 total pages (including translations and index types)") - doc1en := enSite.regularPages[0] + doc1en := enSite.RegularPages[0] permalink, err := doc1en.Permalink() assert.NoError(t, err, "permalink call failed") assert.Equal(t, "http://example.com/blog/en/sect/doc1-slug/", permalink, "invalid doc1.en permalink") assert.Len(t, doc1en.Translations(), 1, "doc1-en should have one translation, excluding itself") - doc2 := enSite.regularPages[1] + doc2 := enSite.RegularPages[1] permalink, err = doc2.Permalink() assert.NoError(t, err, "permalink call failed") assert.Equal(t, "http://example.com/blog/en/sect/doc2/", permalink, "invalid doc2 permalink") - doc3 := enSite.regularPages[2] + doc3 := enSite.RegularPages[2] permalink, err = doc3.Permalink() assert.NoError(t, err, "permalink call failed") // Note that /superbob is a custom URL set in frontmatter. @@ -276,10 +276,10 @@ func doTestMultiSitesBuild(t *testing.T, configTemplate, configSuffix string) { frSite := sites.Sites[1] assert.Equal(t, "fr", frSite.Language.Lang) - assert.Len(t, frSite.regularPages, 3, "should have 3 pages") + assert.Len(t, frSite.RegularPages, 3, "should have 3 pages") assert.Len(t, frSite.AllPages, 28, "should have 28 total pages (including translations and nodes)") - for _, frenchPage := range frSite.regularPages { + for _, frenchPage := range frSite.RegularPages { assert.Equal(t, "fr", frenchPage.Lang()) } @@ -386,8 +386,8 @@ func TestMultiSitesRebuild(t *testing.T) { enSite := sites.Sites[0] frSite := sites.Sites[1] - require.Len(t, enSite.regularPages, 4) - require.Len(t, frSite.regularPages, 3) + require.Len(t, enSite.RegularPages, 4) + require.Len(t, frSite.RegularPages, 3) // Verify translations assertFileContent(t, "public/en/sect/doc1-slug/index.html", true, "Hello") @@ -413,7 +413,7 @@ func TestMultiSitesRebuild(t *testing.T) { nil, []fsnotify.Event{{Name: "content/sect/doc2.en.md", Op: fsnotify.Remove}}, func(t *testing.T) { - require.Len(t, enSite.regularPages, 3, "1 en removed") + require.Len(t, enSite.RegularPages, 3, "1 en removed") // Check build stats require.Equal(t, 1, enSite.draftCount, "Draft") @@ -436,12 +436,12 @@ func TestMultiSitesRebuild(t *testing.T) { {Name: "content/new1.fr.md", Op: fsnotify.Create}, }, func(t *testing.T) { - require.Len(t, enSite.regularPages, 5) + require.Len(t, enSite.RegularPages, 5) require.Len(t, enSite.AllPages, 30) - require.Len(t, frSite.regularPages, 4) - require.Equal(t, "new_fr_1", frSite.regularPages[3].Title) - require.Equal(t, "new_en_2", enSite.regularPages[0].Title) - require.Equal(t, "new_en_1", enSite.regularPages[1].Title) + require.Len(t, frSite.RegularPages, 4) + require.Equal(t, "new_fr_1", frSite.RegularPages[3].Title) + require.Equal(t, "new_en_2", enSite.RegularPages[0].Title) + require.Equal(t, "new_en_1", enSite.RegularPages[1].Title) rendered := readDestination(t, "public/en/new1/index.html") require.True(t, strings.Contains(rendered, "new_en_1"), rendered) @@ -456,7 +456,7 @@ func TestMultiSitesRebuild(t *testing.T) { }, []fsnotify.Event{{Name: "content/sect/doc1.en.md", Op: fsnotify.Write}}, func(t *testing.T) { - require.Len(t, enSite.regularPages, 5) + require.Len(t, enSite.RegularPages, 5) doc1 := readDestination(t, "public/en/sect/doc1-slug/index.html") require.True(t, strings.Contains(doc1, "CHANGED"), doc1) @@ -474,8 +474,8 @@ func TestMultiSitesRebuild(t *testing.T) { {Name: "content/new1.en.md", Op: fsnotify.Rename}, }, func(t *testing.T) { - require.Len(t, enSite.regularPages, 5, "Rename") - require.Equal(t, "new_en_1", enSite.regularPages[1].Title) + require.Len(t, enSite.RegularPages, 5, "Rename") + require.Equal(t, "new_en_1", enSite.RegularPages[1].Title) rendered := readDestination(t, "public/en/new1renamed/index.html") require.True(t, strings.Contains(rendered, "new_en_1"), rendered) }}, @@ -489,9 +489,9 @@ func TestMultiSitesRebuild(t *testing.T) { }, []fsnotify.Event{{Name: "layouts/_default/single.html", Op: fsnotify.Write}}, func(t *testing.T) { - require.Len(t, enSite.regularPages, 5) + require.Len(t, enSite.RegularPages, 5) require.Len(t, enSite.AllPages, 30) - require.Len(t, frSite.regularPages, 4) + require.Len(t, frSite.RegularPages, 4) doc1 := readDestination(t, "public/en/sect/doc1-slug/index.html") require.True(t, strings.Contains(doc1, "Template Changed"), doc1) }, @@ -506,9 +506,9 @@ func TestMultiSitesRebuild(t *testing.T) { }, []fsnotify.Event{{Name: "i18n/fr.yaml", Op: fsnotify.Write}}, func(t *testing.T) { - require.Len(t, enSite.regularPages, 5) + require.Len(t, enSite.RegularPages, 5) require.Len(t, enSite.AllPages, 30) - require.Len(t, frSite.regularPages, 4) + require.Len(t, frSite.RegularPages, 4) docEn := readDestination(t, "public/en/sect/doc1-slug/index.html") require.True(t, strings.Contains(docEn, "Hello"), "No Hello") docFr := readDestination(t, "public/fr/sect/doc1/index.html") @@ -530,9 +530,9 @@ func TestMultiSitesRebuild(t *testing.T) { {Name: "layouts/shortcodes/shortcode.html", Op: fsnotify.Write}, }, func(t *testing.T) { - require.Len(t, enSite.regularPages, 5) + require.Len(t, enSite.RegularPages, 5) require.Len(t, enSite.AllPages, 30) - require.Len(t, frSite.regularPages, 4) + require.Len(t, frSite.RegularPages, 4) assertFileContent(t, "public/fr/sect/doc1/index.html", true, "Single", "Modified Shortcode: Salut") assertFileContent(t, "public/en/sect/doc1-slug/index.html", true, "Single", "Modified Shortcode: Hello") }, @@ -626,12 +626,12 @@ title = "Svenska" require.Len(t, homeEn.Translations(), 4) require.Equal(t, "sv", homeEn.Translations()[0].Lang()) - require.Len(t, enSite.regularPages, 4) - require.Len(t, frSite.regularPages, 3) + require.Len(t, enSite.RegularPages, 4) + require.Len(t, frSite.RegularPages, 3) // Veriy Swedish site - require.Len(t, svSite.regularPages, 1) - svPage := svSite.regularPages[0] + require.Len(t, svSite.RegularPages, 1) + svPage := svSite.RegularPages[0] require.Equal(t, "Swedish Contentfile", svPage.Title) require.Equal(t, "sv", svPage.Lang()) require.Len(t, svPage.Translations(), 2) |