1
1
//! Tests for the `cargo rustdoc` command.
2
2
3
- use cargo_test_support:: { basic_manifest, project} ;
3
+ use cargo_test_support:: { basic_manifest, cross_compile , project} ;
4
4
5
5
#[ cargo_test]
6
6
fn rustdoc_simple ( ) {
@@ -13,7 +13,7 @@ fn rustdoc_simple() {
13
13
[RUNNING] `rustdoc [..]--crate-name foo src/lib.rs [..]\
14
14
-o [CWD]/target/doc \
15
15
[..] \
16
- -L dependency=[CWD]/target/debug/deps`
16
+ -L dependency=[CWD]/target/debug/deps [..] `
17
17
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
18
18
" ,
19
19
)
@@ -32,7 +32,7 @@ fn rustdoc_args() {
32
32
-o [CWD]/target/doc \
33
33
[..] \
34
34
--cfg=foo \
35
- -L dependency=[CWD]/target/debug/deps`
35
+ -L dependency=[CWD]/target/debug/deps [..] `
36
36
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
37
37
" ,
38
38
)
@@ -122,7 +122,7 @@ fn rustdoc_only_bar_dependency() {
122
122
-o [CWD]/target/doc \
123
123
[..] \
124
124
--cfg=foo \
125
- -L dependency=[CWD]/target/debug/deps`
125
+ -L dependency=[CWD]/target/debug/deps [..] `
126
126
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
127
127
" ,
128
128
)
@@ -144,7 +144,7 @@ fn rustdoc_same_name_documents_lib() {
144
144
-o [CWD]/target/doc \
145
145
[..] \
146
146
--cfg=foo \
147
- -L dependency=[CWD]/target/debug/deps`
147
+ -L dependency=[CWD]/target/debug/deps [..] `
148
148
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
149
149
" ,
150
150
)
@@ -203,21 +203,26 @@ fn proc_macro_crate_type() {
203
203
}
204
204
205
205
#[ cargo_test]
206
- #[ cfg( all( target_arch = "x86_64" , target_os = "linux" , target_env = "gnu" ) ) ]
207
206
fn rustdoc_target ( ) {
207
+ if cross_compile:: disabled ( ) {
208
+ return ;
209
+ }
210
+
208
211
let p = project ( ) . file ( "src/lib.rs" , "" ) . build ( ) ;
209
212
210
- p. cargo ( "rustdoc --verbose --target x86_64-unknown-linux-gnu" )
211
- . with_stderr (
213
+ p. cargo ( "rustdoc --verbose --target" )
214
+ . arg ( cross_compile:: alternate ( ) )
215
+ . with_stderr ( format ! (
212
216
"\
213
217
[DOCUMENTING] foo v0.0.1 ([..])
214
218
[RUNNING] `rustdoc [..]--crate-name foo src/lib.rs [..]\
215
- --target x86_64-unknown-linux-gnu \
216
- -o [CWD]/target/x86_64-unknown-linux-gnu /doc \
219
+ --target {target} \
220
+ -o [CWD]/target/{target} /doc \
217
221
[..] \
218
- -L dependency=[CWD]/target/x86_64-unknown-linux-gnu /debug/deps \
219
- -L dependency=[CWD]/target/debug/deps`
222
+ -L dependency=[CWD]/target/{target} /debug/deps \
223
+ -L dependency=[CWD]/target/debug/deps[..] `
220
224
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]" ,
221
- )
225
+ target = cross_compile:: alternate( )
226
+ ) )
222
227
. run ( ) ;
223
228
}
0 commit comments