assert path ends with executable. On Windows the process executable contains the full path
This commit is contained in:
parent
577c4643dd
commit
7e83e46556
1 changed files with 6 additions and 2 deletions
|
@ -8,6 +8,7 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
use std::slice::SliceExt;
|
||||||
use std::io::{Command, fs, USER_RWX};
|
use std::io::{Command, fs, USER_RWX};
|
||||||
use std::os;
|
use std::os;
|
||||||
use std::path::BytesContainer;
|
use std::path::BytesContainer;
|
||||||
|
@ -17,8 +18,11 @@ fn main() {
|
||||||
// If we're the child, make sure we were invoked correctly
|
// If we're the child, make sure we were invoked correctly
|
||||||
let args = os::args();
|
let args = os::args();
|
||||||
if args.len() > 1 && args[1].as_slice() == "child" {
|
if args.len() > 1 && args[1].as_slice() == "child" {
|
||||||
return assert_eq!(args[0],
|
// FIXME: This should check the whole `args[0]` instead of just
|
||||||
format!("mytest{}", os::consts::EXE_SUFFIX));
|
// checking that it ends_with the executable name. This
|
||||||
|
// is needed because of Windows, which has a different behavior.
|
||||||
|
// See #15149 for more info.
|
||||||
|
return assert!(args[0].ends_with(&format!("mytest{}", os::consts::EXE_SUFFIX)[]));
|
||||||
}
|
}
|
||||||
|
|
||||||
test();
|
test();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue