@@ -15,8 +15,8 @@ fn test_dead_link() {
1515 predicate:: str:: is_match (
1616 r#"^Reading files
1717Checking 1 links from 1 files \(1 documents\)
18- \... index\.html
19- error: bad link . bar.html
18+ \..index\.html
19+ error: bad link / bar.html
2020
2121Found 1 bad links
2222"# ,
@@ -40,8 +40,8 @@ fn test_dead_anchor() {
4040 predicate:: str:: is_match (
4141 r#"^Reading files
4242Checking 1 links from 2 files \(2 documents\)
43- \... index\.html
44- error: bad link . bar.html#goo
43+ \..index\.html
44+ error: bad link / bar.html#goo
4545
4646Found 0 bad links
4747Found 1 bad anchors
@@ -65,81 +65,3 @@ fn test_bad_dir() {
6565 "Error: IO error for operation on non_existing_dir:" ,
6666 ) ) ;
6767}
68-
69- #[ test]
70- fn test_redirects ( ) {
71- let site = assert_fs:: TempDir :: new ( ) . unwrap ( ) ;
72-
73- site. child ( "_redirects" )
74- . write_str (
75- "# This is a comment\n \
76- \n \
77- /old-page /new-page.html 301\n \
78- /external https://example.com/page\n \
79- /broken /missing-page.html\n \
80- /another /target.html",
81- )
82- . unwrap ( ) ;
83-
84- site. child ( "new-page.html" ) . touch ( ) . unwrap ( ) ;
85- site. child ( "target.html" ) . touch ( ) . unwrap ( ) ;
86-
87- site. child ( "index.html" )
88- . write_str ( "<a href='/old-page'>link</a>" )
89- . unwrap ( ) ;
90-
91- let mut cmd = Command :: cargo_bin ( "hyperlink" ) . unwrap ( ) ;
92- cmd. current_dir ( site. path ( ) ) . arg ( "." ) ;
93-
94- cmd. assert ( ) . failure ( ) . code ( 1 ) . stdout (
95- predicate:: str:: is_match (
96- r#"^Reading files
97- Checking 4 links from 4 files \(4 documents\)
98- \....._redirects
99- error: bad link .missing-page\.html
100-
101- Found 1 bad links
102- "# ,
103- )
104- . unwrap ( ) ,
105- ) ;
106-
107- site. close ( ) . unwrap ( ) ;
108- }
109-
110- #[ test]
111- fn test_redirects_only_at_root ( ) {
112- let site = assert_fs:: TempDir :: new ( ) . unwrap ( ) ;
113-
114- site. child ( "_redirects" )
115- . write_str ( "/old-page /new-page.html" )
116- . unwrap ( ) ;
117-
118- site. child ( "subdir/_redirects" )
119- . write_str ( "/sub-old /sub-new.html" )
120- . unwrap ( ) ;
121-
122- site. child ( "new-page.html" ) . touch ( ) . unwrap ( ) ;
123-
124- site. child ( "index.html" )
125- . write_str ( "<a href='/old-page'>link to old</a><a href='/sub-old'>link to sub</a>" )
126- . unwrap ( ) ;
127-
128- let mut cmd = Command :: cargo_bin ( "hyperlink" ) . unwrap ( ) ;
129- cmd. current_dir ( site. path ( ) ) . arg ( "." ) ;
130-
131- cmd. assert ( ) . failure ( ) . code ( 1 ) . stdout (
132- predicate:: str:: is_match (
133- r#"^Reading files
134- Checking 3 links from 4 files \(3 documents\)
135- \./index\.html
136- error: bad link /sub-old
137-
138- Found 1 bad links
139- "# ,
140- )
141- . unwrap ( ) ,
142- ) ;
143-
144- site. close ( ) . unwrap ( ) ;
145- }
0 commit comments