mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-23 21:53:09 +02:00
@@ -17,6 +17,10 @@ import (
|
||||
"fmt"
|
||||
"html/template"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/gohugoio/hugo/markup/rst"
|
||||
|
||||
@@ -26,11 +30,6 @@ import (
|
||||
|
||||
"github.com/gohugoio/hugo/common/loggers"
|
||||
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/gohugoio/hugo/hugofs"
|
||||
|
||||
"github.com/gohugoio/hugo/resources/page"
|
||||
@@ -370,7 +369,6 @@ func normalizeExpected(ext, str string) string {
|
||||
|
||||
func testAllMarkdownEnginesForPages(t *testing.T,
|
||||
assertFunc func(t *testing.T, ext string, pages page.Pages), settings map[string]interface{}, pageSources ...string) {
|
||||
|
||||
engines := []struct {
|
||||
ext string
|
||||
shouldExecute func() bool
|
||||
@@ -391,7 +389,6 @@ func testAllMarkdownEnginesForPages(t *testing.T,
|
||||
cfg.Set(k, v)
|
||||
}
|
||||
return nil
|
||||
|
||||
})
|
||||
|
||||
contentDir := "content"
|
||||
@@ -430,7 +427,6 @@ func testAllMarkdownEnginesForPages(t *testing.T,
|
||||
b.Assert(content(home), qt.Contains, "Home Page Content")
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Issue #1076
|
||||
@@ -492,7 +488,6 @@ categories: ["cool stuff"]
|
||||
checkDated(p, p.Kind())
|
||||
}
|
||||
checkDate(s.Info.LastChange(), "site")
|
||||
|
||||
}
|
||||
|
||||
func TestPageDatesSections(t *testing.T) {
|
||||
@@ -646,7 +641,6 @@ Simple Page With Some Date`
|
||||
for _, p := range pages {
|
||||
c.Assert(hasDate(p), qt.Equals, true)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fields := []string{"date", "publishdate", "pubdate", "published"}
|
||||
@@ -677,7 +671,6 @@ title: Raw
|
||||
p := s.RegularPages()[0]
|
||||
|
||||
c.Assert("**Raw**", qt.Equals, p.RawContent())
|
||||
|
||||
}
|
||||
|
||||
func TestPageWithShortCodeInSummary(t *testing.T) {
|
||||
@@ -714,7 +707,6 @@ func TestPageWithAdditionalExtension(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestTableOfContents(t *testing.T) {
|
||||
|
||||
cfg, fs := newTestCfg()
|
||||
c := qt.New(t)
|
||||
|
||||
@@ -738,7 +730,6 @@ func TestPageWithMoreTag(t *testing.T) {
|
||||
checkPageContent(t, p, normalizeExpected(ext, "<p>Summary Same Line</p>\n\n<p>Some more text</p>\n"))
|
||||
checkPageSummary(t, p, normalizeExpected(ext, "<p>Summary Same Line</p>"))
|
||||
checkPageType(t, p, "page")
|
||||
|
||||
}
|
||||
|
||||
testAllMarkdownEnginesForPages(t, assertFunc, nil, simplePageWithSummaryDelimiterSameLine)
|
||||
@@ -746,7 +737,6 @@ func TestPageWithMoreTag(t *testing.T) {
|
||||
|
||||
// #2973
|
||||
func TestSummaryWithHTMLTagsOnNextLine(t *testing.T) {
|
||||
|
||||
assertFunc := func(t *testing.T, ext string, pages page.Pages) {
|
||||
c := qt.New(t)
|
||||
p := pages[0]
|
||||
@@ -838,7 +828,6 @@ func TestPageWithLastmodFromGitInfo(t *testing.T) {
|
||||
|
||||
// 2018-08-11 is the Git author date for testsite/content_nn/first-post.md
|
||||
c.Assert(nnSite.RegularPages()[0].Lastmod().Format("2006-01-02"), qt.Equals, "2018-08-11")
|
||||
|
||||
}
|
||||
|
||||
func TestPageWithFrontMatterConfig(t *testing.T) {
|
||||
@@ -904,7 +893,6 @@ Content
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestWordCountWithAllCJKRunesWithoutHasCJKLanguage(t *testing.T) {
|
||||
@@ -970,7 +958,6 @@ func TestWordCountWithIsCJKLanguageFalse(t *testing.T) {
|
||||
}
|
||||
|
||||
testAllMarkdownEnginesForPages(t, assertFunc, settings, simplePageWithIsCJKLanguageFalse)
|
||||
|
||||
}
|
||||
|
||||
func TestWordCount(t *testing.T) {
|
||||
@@ -988,7 +975,6 @@ func TestWordCount(t *testing.T) {
|
||||
if p.ReadingTime() != 3 {
|
||||
t.Fatalf("[%s] incorrect min read. expected %v, got %v", ext, 3, p.ReadingTime())
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
testAllMarkdownEnginesForPages(t, assertFunc, nil, simplePageWithLongContent)
|
||||
@@ -1052,7 +1038,6 @@ func TestTranslationKey(t *testing.T) {
|
||||
p2 := s.RegularPages()[1]
|
||||
|
||||
c.Assert(p2.TranslationKey(), qt.Equals, "page/sect/simple")
|
||||
|
||||
}
|
||||
|
||||
func TestChompBOM(t *testing.T) {
|
||||
@@ -1125,7 +1110,6 @@ but if you like it, hit :+1: and get subscribed!
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestPageHTMLContent(t *testing.T) {
|
||||
@@ -1162,7 +1146,6 @@ title: "HTML Content"
|
||||
"Summary: \n<p>This is summary</p>\n|Truncated: true",
|
||||
"|<p>This is the main content.</p>|",
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
// https://github.com/gohugoio/hugo/issues/5381
|
||||
@@ -1278,7 +1261,6 @@ Content:{{ .Content }}
|
||||
"Title: hello",
|
||||
"Content:<p>This is the content.</p>",
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
// https://github.com/gohugoio/hugo/issues/5781
|
||||
@@ -1305,11 +1287,11 @@ Content.
|
||||
|
||||
func TestShouldBuild(t *testing.T) {
|
||||
t.Parallel()
|
||||
var past = time.Date(2009, 11, 17, 20, 34, 58, 651387237, time.UTC)
|
||||
var future = time.Date(2037, 11, 17, 20, 34, 58, 651387237, time.UTC)
|
||||
var zero = time.Time{}
|
||||
past := time.Date(2009, 11, 17, 20, 34, 58, 651387237, time.UTC)
|
||||
future := time.Date(2037, 11, 17, 20, 34, 58, 651387237, time.UTC)
|
||||
zero := time.Time{}
|
||||
|
||||
var publishSettings = []struct {
|
||||
publishSettings := []struct {
|
||||
buildFuture bool
|
||||
buildExpired bool
|
||||
buildDrafts bool
|
||||
@@ -1434,7 +1416,6 @@ tags:
|
||||
} else {
|
||||
c.Assert(p.RelPermalink(), qt.Equals, "/post/test0.dot/")
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -1442,7 +1423,6 @@ tags:
|
||||
|
||||
// https://github.com/gohugoio/hugo/issues/4675
|
||||
func TestWordCountAndSimilarVsSummary(t *testing.T) {
|
||||
|
||||
t.Parallel()
|
||||
c := qt.New(t)
|
||||
|
||||
@@ -1534,7 +1514,6 @@ Summary: In Chinese, 好 means good.
|
||||
b.AssertFileContent("public/p4/index.html", "WordCount: 7\nFuzzyWordCount: 100\nReadingTime: 1\nLen Plain: 638\nLen PlainWords: 7\nTruncated: true\nLen Summary: 43\nLen Content: 651")
|
||||
b.AssertFileContent("public/p5/index.html", "WordCount: 206\nFuzzyWordCount: 300\nReadingTime: 1\nLen Plain: 638\nLen PlainWords: 7\nTruncated: true\nLen Summary: 229\nLen Content: 652")
|
||||
b.AssertFileContent("public/p6/index.html", "WordCount: 7\nFuzzyWordCount: 100\nReadingTime: 1\nLen Plain: 638\nLen PlainWords: 7\nTruncated: false\nLen Summary: 637\nLen Content: 652")
|
||||
|
||||
}
|
||||
|
||||
func TestScratchSite(t *testing.T) {
|
||||
@@ -1619,7 +1598,6 @@ author = "Jo Nesbø"
|
||||
"Author name page string: Kurt Vonnegut|",
|
||||
"Author page string: Jo Nesbø|",
|
||||
"Author site config: Kurt Vonnegut")
|
||||
|
||||
}
|
||||
|
||||
func TestGoldmark(t *testing.T) {
|
||||
@@ -1742,7 +1720,6 @@ $$$
|
||||
|
||||
for i, ext := range []string{"md", "html"} {
|
||||
b.WithContent(fmt.Sprintf("page%d.%s", i+1, ext), content)
|
||||
|
||||
}
|
||||
|
||||
b.Build(BuildCfg{})
|
||||
|
Reference in New Issue
Block a user