mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-12 20:13:59 +02:00
parser/pageparser: Don't store the byte slices
On its own this change doesn't do any magic, but this is part of a bigger picture about making Hugo leaner in the memory usage department.
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
package pageparser
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
@@ -88,3 +89,15 @@ func TestFormatFromFrontMatterType(t *testing.T) {
|
||||
c.Assert(FormatFromFrontMatterType(test.typ), qt.Equals, test.expect)
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsProbablyItemsSource(t *testing.T) {
|
||||
c := qt.New(t)
|
||||
|
||||
input := ` {{< foo >}} `
|
||||
items := collectStringMain(input)
|
||||
|
||||
c.Assert(IsProbablySourceOfItems([]byte(input), items), qt.IsTrue)
|
||||
c.Assert(IsProbablySourceOfItems(bytes.Repeat([]byte(" "), len(input)), items), qt.IsFalse)
|
||||
c.Assert(IsProbablySourceOfItems([]byte(`{{< foo >}} `), items), qt.IsFalse)
|
||||
c.Assert(IsProbablySourceOfItems([]byte(``), items), qt.IsFalse)
|
||||
}
|
||||
|
Reference in New Issue
Block a user