File tree Expand file tree Collapse file tree 3 files changed +19
-1
lines changed Expand file tree Collapse file tree 3 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -118,9 +118,11 @@ impl<'a> FakeRelease<'a> {
118
118
}
119
119
120
120
pub ( crate ) fn add_platform < S : Into < String > > ( mut self , platform : S ) -> Self {
121
+ let platform = platform. into ( ) ;
121
122
let name = self . package . targets [ 0 ] . name . clone ( ) ;
122
- let target = Target :: dummy_lib ( name, Some ( platform. into ( ) ) ) ;
123
+ let target = Target :: dummy_lib ( name, Some ( platform. clone ( ) ) ) ;
123
124
self . package . targets . push ( target) ;
125
+ self . doc_targets . push ( platform) ;
124
126
self
125
127
}
126
128
Original file line number Diff line number Diff line change @@ -93,6 +93,8 @@ pub(crate) struct TestEnvironment {
93
93
94
94
impl TestEnvironment {
95
95
fn new ( ) -> Self {
96
+ // If this fails it's probably already initialized
97
+ let _ = env_logger:: try_init ( ) ;
96
98
Self {
97
99
db : OnceCell :: new ( ) ,
98
100
frontend : OnceCell :: new ( ) ,
Original file line number Diff line number Diff line change @@ -675,6 +675,7 @@ mod test {
675
675
. name ( "dummy" )
676
676
. version ( "0.1.0" )
677
677
. add_platform ( "x86_64-pc-windows-msvc" )
678
+ . rustdoc_file ( "dummy/struct.Blah.html" , b"lah" )
678
679
. create ( )
679
680
. unwrap ( ) ;
680
681
db. fake_release ( )
@@ -700,9 +701,22 @@ mod test {
700
701
"/dummy/0.2.0/x86_64-pc-windows-msvc/dummy/index.html"
701
702
) ;
702
703
704
+ // With deleted file platform specific redirect also handles search
705
+ let redirect = latest_version_redirect (
706
+ "/dummy/0.1.0/x86_64-pc-windows-msvc/dummy/struct.Blah.html" ,
707
+ web,
708
+ ) ?;
709
+ assert_eq ! ( redirect, "/dummy/0.2.0/x86_64-pc-windows-msvc?search=Blah" ) ;
710
+ assert_redirect (
711
+ & redirect,
712
+ "/dummy/0.2.0/x86_64-pc-windows-msvc/dummy/?search=Blah" ,
713
+ web,
714
+ ) ?;
715
+
703
716
Ok ( ( ) )
704
717
} )
705
718
}
719
+
706
720
#[ test]
707
721
fn redirect_latest_goes_to_crate_if_build_failed ( ) {
708
722
wrapper ( |env| {
You can’t perform that action at this time.
0 commit comments