mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
hugolib: Fix some more Golint warnings
This commit is contained in:
parent
8a60571fd2
commit
937592cb85
4 changed files with 13 additions and 12 deletions
|
@ -18,13 +18,13 @@ import (
|
|||
"testing"
|
||||
)
|
||||
|
||||
var PAGE_YAML_WITH_TAXONOMIES_A = `---
|
||||
var pageYamlWithTaxonomiesA = `---
|
||||
tags: ['a', 'B', 'c']
|
||||
categories: 'd'
|
||||
---
|
||||
YAML frontmatter with tags and categories taxonomy.`
|
||||
|
||||
var PAGE_YAML_WITH_TAXONOMIES_B = `---
|
||||
var pageYamlWithTaxonomiesB = `---
|
||||
tags:
|
||||
- "a"
|
||||
- "B"
|
||||
|
@ -33,13 +33,13 @@ categories: 'd'
|
|||
---
|
||||
YAML frontmatter with tags and categories taxonomy.`
|
||||
|
||||
var PAGE_YAML_WITH_TAXONOMIES_C = `---
|
||||
var pageYamlWithTaxonomiesC = `---
|
||||
tags: 'E'
|
||||
categories: 'd'
|
||||
---
|
||||
YAML frontmatter with tags and categories taxonomy.`
|
||||
|
||||
var PAGE_JSON_WITH_TAXONOMIES = `{
|
||||
var pageJSONWithTaxonomies = `{
|
||||
"categories": "D",
|
||||
"tags": [
|
||||
"a",
|
||||
|
@ -49,18 +49,18 @@ var PAGE_JSON_WITH_TAXONOMIES = `{
|
|||
}
|
||||
JSON Front Matter with tags and categories`
|
||||
|
||||
var PAGE_TOML_WITH_TAXONOMIES = `+++
|
||||
var pageTomlWithTaxonomies = `+++
|
||||
tags = [ "a", "B", "c" ]
|
||||
categories = "d"
|
||||
+++
|
||||
TOML Front Matter with tags and categories`
|
||||
|
||||
func TestParseTaxonomies(t *testing.T) {
|
||||
for _, test := range []string{PAGE_TOML_WITH_TAXONOMIES,
|
||||
PAGE_JSON_WITH_TAXONOMIES,
|
||||
PAGE_YAML_WITH_TAXONOMIES_A,
|
||||
PAGE_YAML_WITH_TAXONOMIES_B,
|
||||
PAGE_YAML_WITH_TAXONOMIES_C,
|
||||
for _, test := range []string{pageTomlWithTaxonomies,
|
||||
pageJSONWithTaxonomies,
|
||||
pageYamlWithTaxonomiesA,
|
||||
pageYamlWithTaxonomiesB,
|
||||
pageYamlWithTaxonomiesC,
|
||||
} {
|
||||
|
||||
p, _ := NewPage("page/with/taxonomy")
|
||||
|
|
|
@ -534,7 +534,7 @@ func BenchmarkReplaceShortcodeTokens(b *testing.B) {
|
|||
{strings.Repeat("A ", 3000) + " {#{#HUGOSHORTCODE-1#}#}." + strings.Repeat("BC ", 1000) + " {#{#HUGOSHORTCODE-1#}#}.", map[string]string{"{#{#HUGOSHORTCODE-1#}#}": "Hello World"}, []byte(strings.Repeat("A ", 3000) + " Hello World." + strings.Repeat("BC ", 1000) + " Hello World.")},
|
||||
}
|
||||
|
||||
var in []input = make([]input, b.N*len(data))
|
||||
var in = make([]input, b.N*len(data))
|
||||
var cnt = 0
|
||||
for i := 0; i < b.N; i++ {
|
||||
for _, this := range data {
|
||||
|
|
|
@ -18,6 +18,7 @@ import (
|
|||
jww "github.com/spf13/jwalterweatherman"
|
||||
)
|
||||
|
||||
// Sitemap configures the sitemap to be generated.
|
||||
type Sitemap struct {
|
||||
ChangeFreq string
|
||||
Priority float64
|
||||
|
|
|
@ -20,7 +20,7 @@ import (
|
|||
|
||||
func TestSitePossibleTaxonomies(t *testing.T) {
|
||||
site := new(Site)
|
||||
page, _ := NewPageFrom(strings.NewReader(PAGE_YAML_WITH_TAXONOMIES_A), "path/to/page")
|
||||
page, _ := NewPageFrom(strings.NewReader(pageYamlWithTaxonomiesA), "path/to/page")
|
||||
site.Pages = append(site.Pages, page)
|
||||
taxonomies := site.possibleTaxonomies()
|
||||
if !compareStringSlice(taxonomies, []string{"tags", "categories"}) {
|
||||
|
|
Loading…
Reference in a new issue