mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00
Make hg
optional for tests.
This commit is contained in:
parent
dd761226d9
commit
6d13bcce44
@ -2,6 +2,7 @@ use crate::support;
|
||||
use std::env;
|
||||
use std::fs::{self, File};
|
||||
use std::io::prelude::*;
|
||||
use std::process::Command;
|
||||
|
||||
use crate::support::{paths, Execs};
|
||||
|
||||
@ -11,6 +12,18 @@ fn cargo_process(s: &str) -> Execs {
|
||||
execs
|
||||
}
|
||||
|
||||
fn mercurial_available() -> bool {
|
||||
let result = Command::new("hg")
|
||||
.arg("--version")
|
||||
.output()
|
||||
.map(|o| o.status.success())
|
||||
.unwrap_or(false);
|
||||
if !result {
|
||||
println!("`hg` not available, skipping test");
|
||||
}
|
||||
result
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn simple_lib() {
|
||||
cargo_process("init --lib --vcs none --edition 2015")
|
||||
@ -467,6 +480,9 @@ fn terminating_newline_in_new_git_ignore() {
|
||||
|
||||
#[test]
|
||||
fn terminating_newline_in_new_mercurial_ignore() {
|
||||
if !mercurial_available() {
|
||||
return;
|
||||
}
|
||||
cargo_process("init --vcs hg --lib")
|
||||
.env("USER", "foo")
|
||||
.run();
|
||||
|
Loading…
x
Reference in New Issue
Block a user