Move redirect gui tests to its own book

This commit is contained in:
Eric Huss 2025-10-13 20:43:24 -07:00
parent 9b5c57bf48
commit 98a093a0ff
8 changed files with 65 additions and 53 deletions

View file

@ -0,0 +1,3 @@
# Redirect
This GUI test book tests the redirect configuration.

View file

@ -0,0 +1,28 @@
[book]
title = "redirect"
[output.html.redirect]
"/inner/old.html" = "../new-chapter.html"
# This is a source without a fragment, and one with a fragment that goes to
# the same place. The redirect with the fragment is not necessary, since that
# is the default behavior.
"/pointless-fragment.html" = "new-chapter.html"
"/pointless-fragment.html#foo" = "new-chapter.html#foo"
"/rename-page-and-fragment.html" = "new-chapter.html"
"/rename-page-and-fragment.html#orig" = "new-chapter.html#new"
"/rename-page-fragment-elsewhere.html" = "new-chapter.html"
"/rename-page-fragment-elsewhere.html#orig" = "other-chapter.html#new"
# Rename fragment on an existing page.
"/new-chapter.html#orig" = "new-chapter.html#new"
# Rename fragment on an existing page to another page.
"/new-chapter.html#orig-new-chapter" = "other-chapter.html#new"
"/full-url-with-fragment.html" = "https://www.rust-lang.org/#fragment"
"/full-url-with-fragment-map.html" = "https://www.rust-lang.org/"
"/full-url-with-fragment-map.html#a" = "https://www.rust-lang.org/#new1"
"/full-url-with-fragment-map.html#b" = "https://www.rust-lang.org/#new2"

View file

@ -0,0 +1,4 @@
# Summary
- [New chapter](new-chapter.md)
- [Other chapter](other-chapter.md)

View file

@ -0,0 +1 @@
# Chapter 1

View file

@ -0,0 +1 @@
# New chapter

View file

@ -0,0 +1 @@
# Other chapter

View file

@ -23,29 +23,3 @@ boost-hierarchy = 2
boost-paragraph = 1
expand = true
heading-split-level = 2
[output.html.redirect]
"/format/config.html" = "../prefix.html"
# This is a source without a fragment, and one with a fragment that goes to
# the same place. The redirect with the fragment is not necessary, since that
# is the default behavior.
"/pointless-fragment.html" = "prefix.html"
"/pointless-fragment.html#foo" = "prefix.html#foo"
"/rename-page-and-fragment.html" = "prefix.html"
"/rename-page-and-fragment.html#orig" = "prefix.html#new"
"/rename-page-fragment-elsewhere.html" = "prefix.html"
"/rename-page-fragment-elsewhere.html#orig" = "suffix.html#new"
# Rename fragment on an existing page.
"/prefix.html#orig" = "prefix.html#new"
# Rename fragment on an existing page to another page.
"/prefix.html#orig-new-page" = "suffix.html#new"
"/full-url-with-fragment.html" = "https://www.rust-lang.org/#fragment"
"/full-url-with-fragment-map.html" = "https://www.rust-lang.org/"
"/full-url-with-fragment-map.html#a" = "https://www.rust-lang.org/#new1"
"/full-url-with-fragment-map.html#b" = "https://www.rust-lang.org/#new2"

View file

@ -1,41 +1,41 @@
go-to: |DOC_PATH| + "test_book/format/config.html"
assert-window-property: ({"location": |DOC_PATH| + "test_book/prefix.html"})
go-to: |DOC_PATH| + "redirect/inner/old.html"
assert-window-property: ({"location": |DOC_PATH| + "redirect/new-chapter.html"})
// Check that it preserves fragments when redirecting.
go-to: |DOC_PATH| + "test_book/format/config.html#fragment"
assert-window-property: ({"location": |DOC_PATH| + "test_book/prefix.html#fragment"})
go-to: |DOC_PATH| + "redirect/inner/old.html#fragment"
assert-window-property: ({"location": |DOC_PATH| + "redirect/new-chapter.html#fragment"})
// The fragment one here isn't necessary, but should still work.
go-to: |DOC_PATH| + "test_book/pointless-fragment.html"
assert-window-property: ({"location": |DOC_PATH| + "test_book/prefix.html"})
go-to: |DOC_PATH| + "test_book/pointless-fragment.html#foo"
assert-window-property: ({"location": |DOC_PATH| + "test_book/prefix.html#foo"})
go-to: |DOC_PATH| + "redirect/pointless-fragment.html"
assert-window-property: ({"location": |DOC_PATH| + "redirect/new-chapter.html"})
go-to: |DOC_PATH| + "redirect/pointless-fragment.html#foo"
assert-window-property: ({"location": |DOC_PATH| + "redirect/new-chapter.html#foo"})
// Page rename, and a fragment rename.
go-to: |DOC_PATH| + "test_book/rename-page-and-fragment.html"
assert-window-property: ({"location": |DOC_PATH| + "test_book/prefix.html"})
go-to: |DOC_PATH| + "test_book/rename-page-and-fragment.html#orig"
assert-window-property: ({"location": |DOC_PATH| + "test_book/prefix.html#new"})
go-to: |DOC_PATH| + "redirect/rename-page-and-fragment.html"
assert-window-property: ({"location": |DOC_PATH| + "redirect/new-chapter.html"})
go-to: |DOC_PATH| + "redirect/rename-page-and-fragment.html#orig"
assert-window-property: ({"location": |DOC_PATH| + "redirect/new-chapter.html#new"})
// Page rename, and the fragment goes to a *different* page from the default.
go-to: |DOC_PATH| + "test_book/rename-page-fragment-elsewhere.html"
assert-window-property: ({"location": |DOC_PATH| + "test_book/prefix.html"})
go-to: |DOC_PATH| + "test_book/rename-page-fragment-elsewhere.html#orig"
assert-window-property: ({"location": |DOC_PATH| + "test_book/suffix.html#new"})
go-to: |DOC_PATH| + "redirect/rename-page-fragment-elsewhere.html"
assert-window-property: ({"location": |DOC_PATH| + "redirect/new-chapter.html"})
go-to: |DOC_PATH| + "redirect/rename-page-fragment-elsewhere.html#orig"
assert-window-property: ({"location": |DOC_PATH| + "redirect/other-chapter.html#new"})
// Rename fragment on an existing page.
go-to: |DOC_PATH| + "test_book/prefix.html#orig"
assert-window-property: ({"location": |DOC_PATH| + "test_book/prefix.html#new"})
go-to: |DOC_PATH| + "redirect/new-chapter.html#orig"
assert-window-property: ({"location": |DOC_PATH| + "redirect/new-chapter.html#new"})
// Other fragments aren't affected.
go-to: |DOC_PATH| + "test_book/index.html" // Reset page since redirects are processed on load.
go-to: |DOC_PATH| + "test_book/prefix.html"
assert-window-property: ({"location": |DOC_PATH| + "test_book/prefix.html"})
go-to: |DOC_PATH| + "test_book/index.html" // Reset page since redirects are processed on load.
go-to: |DOC_PATH| + "test_book/prefix.html#dont-change"
assert-window-property: ({"location": |DOC_PATH| + "test_book/prefix.html#dont-change"})
go-to: |DOC_PATH| + "redirect/index.html" // Reset page since redirects are processed on load.
go-to: |DOC_PATH| + "redirect/new-chapter.html"
assert-window-property: ({"location": |DOC_PATH| + "redirect/new-chapter.html"})
go-to: |DOC_PATH| + "redirect/index.html" // Reset page since redirects are processed on load.
go-to: |DOC_PATH| + "redirect/new-chapter.html#dont-change"
assert-window-property: ({"location": |DOC_PATH| + "redirect/new-chapter.html#dont-change"})
// Rename fragment on an existing page to another page.
go-to: |DOC_PATH| + "test_book/index.html" // Reset page since redirects are processed on load.
go-to: |DOC_PATH| + "test_book/prefix.html#orig-new-page"
assert-window-property: ({"location": |DOC_PATH| + "test_book/suffix.html#new"})
go-to: |DOC_PATH| + "redirect/index.html" // Reset page since redirects are processed on load.
go-to: |DOC_PATH| + "redirect/new-chapter.html#orig-new-chapter"
assert-window-property: ({"location": |DOC_PATH| + "redirect/other-chapter.html#new"})