Only run test on nightly
This commit is contained in:
parent
47a0f78b3b
commit
4ac0d35ebb
@ -259,9 +259,9 @@ fn assert_output(source: &Path, expected_filename: &Path) {
|
||||
#[test]
|
||||
fn idempotence_tests() {
|
||||
run_test_with(&TestSetting::default(), || {
|
||||
match option_env!("CFG_RELEASE_CHANNEL") {
|
||||
None | Some("nightly") => {}
|
||||
_ => return, // these tests require nightly
|
||||
// these tests require nightly
|
||||
if !is_nightly() {
|
||||
return;
|
||||
}
|
||||
// Get all files in the tests/target directory.
|
||||
let files = get_test_files(Path::new("tests/target"), true);
|
||||
@ -277,9 +277,9 @@ fn idempotence_tests() {
|
||||
// no warnings are emitted.
|
||||
#[test]
|
||||
fn self_tests() {
|
||||
match option_env!("CFG_RELEASE_CHANNEL") {
|
||||
None | Some("nightly") => {}
|
||||
_ => return, // Issue-3443: these tests require nightly
|
||||
// Issue-3443: these tests require nightly
|
||||
if !is_nightly() {
|
||||
return;
|
||||
}
|
||||
let mut files = get_test_files(Path::new("tests"), false);
|
||||
let bin_directories = vec!["cargo-fmt", "git-rustfmt", "bin", "format-diff"];
|
||||
@ -313,6 +313,11 @@ fn self_tests() {
|
||||
);
|
||||
}
|
||||
|
||||
fn is_nightly() -> bool {
|
||||
let release_channel = option_env!("CFG_RELEASE_CHANNEL");
|
||||
release_channel.is_none() || release_channel == Some("nightly")
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn stdin_formatting_smoke_test() {
|
||||
let input = Input::Text("fn main () {}".to_owned());
|
||||
@ -426,6 +431,16 @@ fn check_files(files: Vec<PathBuf>, opt_config: &Option<PathBuf>) -> (Vec<Format
|
||||
let mut reports = vec![];
|
||||
|
||||
for file_name in files {
|
||||
let sig_comments = read_significant_comments(&file_name);
|
||||
if sig_comments.contains_key("unstable") && !is_nightly() {
|
||||
debug!(
|
||||
"Skipping '{}' because it requires unstable \
|
||||
features which are only available on nightly...",
|
||||
file_name.display()
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
debug!("Testing '{}'...", file_name.display());
|
||||
|
||||
match idempotent_check(&file_name, &opt_config) {
|
||||
|
@ -1,3 +1,5 @@
|
||||
// rustfmt-unstable: true
|
||||
|
||||
#[doc = "This comment
|
||||
is split
|
||||
on multiple lines"]
|
||||
|
@ -1,3 +1,5 @@
|
||||
// rustfmt-unstable: true
|
||||
|
||||
///This comment
|
||||
///is split
|
||||
///on multiple lines
|
||||
|
Loading…
x
Reference in New Issue
Block a user