summaryrefslogtreecommitdiffstats
path: root/hugolib/site_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-08-02 21:37:03 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-08-02 22:04:38 +0200
commit9891c0fb0eb274b8a95b62c40070a87a6e04088c (patch)
tree16c12115fceda9ef39e43dc3f7c6eee5965dc840 /hugolib/site_test.go
parent481924b34d23b0ce435778cce7bce77571b22f9d (diff)
Remove sourceRelativeLinks
Fixes #3766
Diffstat (limited to 'hugolib/site_test.go')
-rw-r--r--hugolib/site_test.go134
1 files changed, 1 insertions, 133 deletions
diff --git a/hugolib/site_test.go b/hugolib/site_test.go
index bffdec1a9..d7ca66827 100644
--- a/hugolib/site_test.go
+++ b/hugolib/site_test.go
@@ -938,8 +938,7 @@ func setupLinkingMockSite(t *testing.T) *Site {
cfg.Set("pluralizeListTitles", false)
cfg.Set("canonifyURLs", false)
cfg.Set("blackfriday",
- map[string]interface{}{
- "sourceRelativeLinksProjectFolder": "/docs"})
+ map[string]interface{}{})
writeSourcesToSource(t, "content", fs, sources...)
return buildSingleSite(t, deps.DepsCfg{Fs: fs, Cfg: cfg}, BuildCfg{})
@@ -973,134 +972,3 @@ func TestRefLinking(t *testing.T) {
// TODO: and then the failure cases.
}
-
-func TestSourceRelativeLinksing(t *testing.T) {
- t.Parallel()
- site := setupLinkingMockSite(t)
-
- type resultMap map[string]string
-
- okresults := map[string]resultMap{
- "index.md": map[string]string{
- "/docs/rootfile.md": "/rootfile/",
- "rootfile.md": "/rootfile/",
- // See #3396 -- this may potentially be ambiguous (i.e. name conflict with home page).
- // But the user have chosen so. This index.md patterns is more relevant in /sub-folders.
- "index.md": "/",
- "level2/2-root.md": "/level2/2-root/",
- "/docs/level2/2-root.md": "/level2/2-root/",
- "level2/level3/3-root.md": "/level2/level3/3-root/",
- "/docs/level2/level3/3-root.md": "/level2/level3/3-root/",
- "/docs/level2/2-root/": "/level2/2-root/",
- "/docs/level2/2-root": "/level2/2-root/",
- "/level2/2-root/": "/level2/2-root/",
- "/level2/2-root": "/level2/2-root/",
- }, "rootfile.md": map[string]string{
- "/docs/rootfile.md": "/rootfile/",
- "rootfile.md": "/rootfile/",
- "level2/2-root.md": "/level2/2-root/",
- "/docs/level2/2-root.md": "/level2/2-root/",
- "level2/level3/3-root.md": "/level2/level3/3-root/",
- "/docs/level2/level3/3-root.md": "/level2/level3/3-root/",
- }, "level2/2-root.md": map[string]string{
- "../rootfile.md": "/rootfile/",
- "/docs/rootfile.md": "/rootfile/",
- "2-root.md": "/level2/2-root/",
- "../level2/2-root.md": "/level2/2-root/",
- "./2-root.md": "/level2/2-root/",
- "/docs/level2/2-root.md": "/level2/2-root/",
- "level3/3-root.md": "/level2/level3/3-root/",
- "../level2/level3/3-root.md": "/level2/level3/3-root/",
- "/docs/level2/level3/3-root.md": "/level2/level3/3-root/",
- }, "level2/index.md": map[string]string{
- "../rootfile.md": "/rootfile/",
- "/docs/rootfile.md": "/rootfile/",
- "2-root.md": "/level2/2-root/",
- "../level2/2-root.md": "/level2/2-root/",
- "./2-root.md": "/level2/2-root/",
- "/docs/level2/2-root.md": "/level2/2-root/",
- "level3/3-root.md": "/level2/level3/3-root/",
- "../level2/level3/3-root.md": "/level2/level3/3-root/",
- "/docs/level2/level3/3-root.md": "/level2/level3/3-root/",
- }, "level2/level3/3-root.md": map[string]string{
- "../../rootfile.md": "/rootfile/",
- "/docs/rootfile.md": "/rootfile/",
- "../2-root.md": "/level2/2-root/",
- "/docs/level2/2-root.md": "/level2/2-root/",
- "3-root.md": "/level2/level3/3-root/",
- "./3-root.md": "/level2/level3/3-root/",
- "/docs/level2/level3/3-root.md": "/level2/level3/3-root/",
- }, "level2/level3/index.md": map[string]string{
- "../../rootfile.md": "/rootfile/",
- "/docs/rootfile.md": "/rootfile/",
- "../2-root.md": "/level2/2-root/",
- "/docs/level2/2-root.md": "/level2/2-root/",
- "3-root.md": "/level2/level3/3-root/",
- "./3-root.md": "/level2/level3/3-root/",
- "/docs/level2/level3/3-root.md": "/level2/level3/3-root/",
- },
- }
-
- for currentFile, results := range okresults {
- currentPage := findPage(site, currentFile)
- if currentPage == nil {
- t.Fatalf("failed to find current page in site")
- }
- for link, url := range results {
- if out, err := site.Info.SourceRelativeLink(link, currentPage); err != nil || out != url {
- t.Errorf("Expected %s to resolve to (%s), got (%s) - error: %s", link, url, out, err)
- } else {
- //t.Logf("tested ok %s maps to %s", link, out)
- }
- }
- }
- // TODO: and then the failure cases.
- // "https://docker.com": "",
- // site_test.go:1094: Expected https://docker.com to resolve to (), got () - error: Not a plain filepath link (https://docker.com)
-
-}
-
-func TestSourceRelativeLinkFileing(t *testing.T) {
- t.Parallel()
- site := setupLinkingMockSite(t)
-
- type resultMap map[string]string
-
- okresults := map[string]resultMap{
- "index.md": map[string]string{
- "/root-image.png": "/root-image.png",
- "root-image.png": "/root-image.png",
- }, "rootfile.md": map[string]string{
- "/root-image.png": "/root-image.png",
- }, "level2/2-root.md": map[string]string{
- "/root-image.png": "/root-image.png",
- "common.png": "/level2/common.png",
- }, "level2/index.md": map[string]string{
- "/root-image.png": "/root-image.png",
- "common.png": "/level2/common.png",
- "./common.png": "/level2/common.png",
- }, "level2/level3/3-root.md": map[string]string{
- "/root-image.png": "/root-image.png",
- "common.png": "/level2/level3/common.png",
- "../common.png": "/level2/common.png",
- }, "level2/level3/index.md": map[string]string{
- "/root-image.png": "/root-image.png",
- "common.png": "/level2/level3/common.png",
- "../common.png": "/level2/common.png",
- },
- }
-
- for currentFile, results := range okresults {
- currentPage := findPage(site, currentFile)
- if currentPage == nil {
- t.Fatalf("failed to find current page in site")
- }
- for link, url := range results {
- if out, err := site.Info.SourceRelativeLinkFile(link, currentPage); err != nil || out != url {
- t.Errorf("Expected %s to resolve to (%s), got (%s) - error: %s", link, url, out, err)
- } else {
- //t.Logf("tested ok %s maps to %s", link, out)
- }
- }
- }
-}