mirror of
				https://github.com/gohugoio/hugo.git
				synced 2024-05-11 05:54:58 +00:00 
			
		
		
		
	
				
					committed by
					
						
						Bjørn Erik Pedersen
					
				
			
			
				
	
			
			
			
						parent
						
							75e55cd06f
						
					
				
				
					commit
					32336e9ec6
				
			@@ -19,14 +19,14 @@ import (
 | 
			
		||||
	"testing"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
var SIMPLE_PAGE_YAML = `---
 | 
			
		||||
var simplePageYAML = `---
 | 
			
		||||
contenttype: ""
 | 
			
		||||
---
 | 
			
		||||
Sample Text
 | 
			
		||||
`
 | 
			
		||||
 | 
			
		||||
func TestDegenerateMissingFolderInPageFilename(t *testing.T) {
 | 
			
		||||
	p, err := NewPageFrom(strings.NewReader(SIMPLE_PAGE_YAML), filepath.Join("foobar"))
 | 
			
		||||
	p, err := NewPageFrom(strings.NewReader(simplePageYAML), filepath.Join("foobar"))
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		t.Fatalf("Error in NewPageFrom")
 | 
			
		||||
	}
 | 
			
		||||
@@ -48,9 +48,9 @@ func TestNewPageWithFilePath(t *testing.T) {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	for i, el := range toCheck {
 | 
			
		||||
		p, err := NewPageFrom(strings.NewReader(SIMPLE_PAGE_YAML), el.input)
 | 
			
		||||
		p, err := NewPageFrom(strings.NewReader(simplePageYAML), el.input)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			t.Errorf("[%d] Reading from SIMPLE_PAGE_YAML resulted in an error: %s", i, err)
 | 
			
		||||
			t.Errorf("[%d] Reading from simplePageYAML resulted in an error: %s", i, err)
 | 
			
		||||
		}
 | 
			
		||||
		if p.Section() != el.section {
 | 
			
		||||
			t.Errorf("[%d] Section incorrect page %s. got %s but expected %s", i, el.input, p.Section(), el.section)
 | 
			
		||||
 
 | 
			
		||||
@@ -23,7 +23,7 @@ import (
 | 
			
		||||
	"github.com/spf13/viper"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
const SITEMAP_TEMPLATE = `<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
 | 
			
		||||
const sitemapTemplate = `<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
 | 
			
		||||
  {{ range .Data.Pages }}
 | 
			
		||||
  <url>
 | 
			
		||||
    <loc>{{ .Permalink }}</loc>
 | 
			
		||||
@@ -56,7 +56,7 @@ func doTestSitemapOutput(t *testing.T, internal bool) {
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	} else {
 | 
			
		||||
		if err := buildAndRenderSite(s, "sitemap.xml", SITEMAP_TEMPLATE); err != nil {
 | 
			
		||||
		if err := buildAndRenderSite(s, "sitemap.xml", sitemapTemplate); err != nil {
 | 
			
		||||
			t.Fatalf("Failed to build site: %s", err)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user