Add Page tests with UTF8 paths

See #988
This commit is contained in:
Takuya Wakisaka
2015-05-09 19:12:30 +09:00
committed by bep
parent befa26b152
commit 8a96234b1f
2 changed files with 78 additions and 33 deletions

View File

@@ -212,39 +212,6 @@ func TestRenderThingOrDefault(t *testing.T) {
}
}
func TestTargetPath(t *testing.T) {
tests := []struct {
doc string
content string
expectedOutFile string
expectedSection string
}{
{"content/a/file.md", PAGE_URL_SPECIFIED, "mycategory/my-whatever-content/index.html", "a"},
{"content/x/y/deepfile.md", SIMPLE_PAGE, "x/y/deepfile.html", "x/y"},
{"content/x/y/z/deeperfile.md", SIMPLE_PAGE, "x/y/z/deeperfile.html", "x/y/z"},
{"content/b/file.md", SIMPLE_PAGE, "b/file.html", "b"},
{"a/file.md", SIMPLE_PAGE, "a/file.html", "a"},
{"file.md", SIMPLE_PAGE, "file.html", ""},
}
if true {
return
}
for _, test := range tests {
p := pageMust(NewPageFrom(strings.NewReader(test.content), helpers.AbsPathify(filepath.FromSlash(test.doc))))
expected := filepath.FromSlash(test.expectedOutFile)
if p.TargetPath() != expected {
t.Errorf("%s => OutFile expected: '%s', got: '%s'", test.doc, expected, p.TargetPath())
}
if p.Section() != test.expectedSection {
t.Errorf("%s => p.Section expected: %s, got: %s", test.doc, test.expectedSection, p.Section())
}
}
}
func TestDraftAndFutureRender(t *testing.T) {
hugofs.DestinationFS = new(afero.MemMapFs)