File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change 1+ // For some reason on Windows, the PATH to the libstd dylib doesn't seem to
2+ // carry over to running the runtool.
3+ //@ no-prefer-dynamic
4+
5+ use std:: path:: Path ;
6+ use std:: process:: Command ;
7+
8+ fn main ( ) {
9+ let args: Vec < _ > = std:: env:: args ( ) . collect ( ) ;
10+ eprintln ! ( "{args:#?}" ) ;
11+ assert_eq ! ( args. len( ) , 4 ) ;
12+ assert_eq ! ( args[ 1 ] , "arg1" ) ;
13+ assert_eq ! ( args[ 2 ] , "arg2 with space" ) ;
14+ let path = Path :: new ( & args[ 3 ] ) ;
15+ let output = Command :: new ( path) . output ( ) . unwrap ( ) ;
16+ // Should fail without env var.
17+ assert ! ( !output. status. success( ) ) ;
18+ let output = Command :: new ( path) . env ( "DOCTEST_RUNTOOL_CHECK" , "xyz" ) . output ( ) . unwrap ( ) ;
19+ // Should pass with env var.
20+ assert ! ( output. status. success( ) ) ;
21+ }
Original file line number Diff line number Diff line change 1+ // Tests that the --runtool argument works.
2+
3+ //@ ignore-cross-compile
4+ //@ aux-bin: doctest-runtool.rs
5+ //@ compile-flags: --test
6+ //@ compile-flags: --runtool=auxiliary/bin/doctest-runtool
7+ //@ compile-flags: --runtool-arg=arg1 --runtool-arg
8+ //@ compile-flags: 'arg2 with space'
9+ //@ compile-flags: -Zunstable-options
10+
11+ /// ```
12+ /// assert_eq!(std::env::var("DOCTEST_RUNTOOL_CHECK"), Ok("xyz".to_string()));
13+ /// ```
14+ pub fn main ( ) { }
You can’t perform that action at this time.
0 commit comments