mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-17 21:01:26 +02:00
@@ -138,6 +138,16 @@ title: Simple
|
||||
Summary Same Line<!--more-->
|
||||
|
||||
Some more text
|
||||
`
|
||||
|
||||
SIMPLE_PAGE_WITH_FIVE_MULTIBYTE_UFT8_RUNES = `---
|
||||
title: Simple
|
||||
---
|
||||
|
||||
|
||||
€ € € € €
|
||||
|
||||
|
||||
`
|
||||
|
||||
SIMPLE_PAGE_WITH_LONG_CONTENT = `---
|
||||
@@ -470,6 +480,21 @@ func TestPageWithDate(t *testing.T) {
|
||||
checkPageDate(t, p, d)
|
||||
}
|
||||
|
||||
func TestRuneCount(t *testing.T) {
|
||||
p, _ := NewPage("simple.md")
|
||||
_, err := p.ReadFrom(strings.NewReader(SIMPLE_PAGE_WITH_FIVE_MULTIBYTE_UFT8_RUNES))
|
||||
p.Convert()
|
||||
p.analyzePage()
|
||||
if err != nil {
|
||||
t.Fatalf("Unable to create a page with frontmatter and body content: %s", err)
|
||||
}
|
||||
|
||||
if p.RuneCount() != 5 {
|
||||
t.Fatalf("incorrect rune count for content '%s'. expected %v, got %v", p.plain, 1, p.RuneCount())
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
func TestWordCount(t *testing.T) {
|
||||
p, _ := NewPage("simple.md")
|
||||
_, err := p.ReadFrom(strings.NewReader(SIMPLE_PAGE_WITH_LONG_CONTENT))
|
||||
|
Reference in New Issue
Block a user