File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -437,6 +437,42 @@ fn no_cross_doctests() {
437
437
. run ( ) ;
438
438
}
439
439
440
+ #[ cargo_test]
441
+ fn cross_doctests ( ) {
442
+ if cross_compile:: disabled ( ) || !cross_compile:: can_run_on_host ( ) || !is_nightly ( ) {
443
+ return ;
444
+ }
445
+
446
+ let p = project ( )
447
+ . file (
448
+ "src/lib.rs" ,
449
+ r#"
450
+ //! ```
451
+ //! extern crate foo;
452
+ //! assert!(true);
453
+ //! ```
454
+ "# ,
455
+ )
456
+ . build ( ) ;
457
+
458
+ let target = cross_compile:: alternate ( ) ;
459
+
460
+ // This tests the library and runs the doc tests.
461
+ p. cargo ( "test -v -Z doctest-xcompile --target" )
462
+ . arg ( & target)
463
+ . with_stderr ( & format ! (
464
+ "\
465
+ [COMPILING] foo v0.0.1 ([CWD])
466
+ [RUNNING] `rustc --crate-name foo [..]--test[..]
467
+ [FINISHED] test [unoptimized + debuginfo] target(s) in [..]
468
+ [RUNNING] `[CWD]/target/{triple}/debug/deps/foo-[..][EXE]`
469
+ [DOCTEST] foo
470
+ " ,
471
+ triple = target
472
+ ) )
473
+ . run ( ) ;
474
+ }
475
+
440
476
#[ cargo_test]
441
477
fn simple_cargo_run ( ) {
442
478
if !cross_compile:: can_run_on_host ( ) {
You can’t perform that action at this time.
0 commit comments