about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorest31 <MTest31@outlook.com>2017-01-11 02:21:49 +0100
committerest31 <MTest31@outlook.com>2017-01-12 23:53:02 +0100
commit3f6964e22db1a63c7244a9e841254c41e1a88540 (patch)
tree4e5698e62516cf3e28eb3cab4ae4aa988c1ae714 /src
parent6795ddf342ceffc155be3a587dac9951269ef7f8 (diff)
downloadrust-3f6964e22db1a63c7244a9e841254c41e1a88540.tar.gz
rust-3f6964e22db1a63c7244a9e841254c41e1a88540.zip
Automatically treat test files "feature-gate-$f.rs" as gate tests for feature $f
Diffstat (limited to 'src')
-rw-r--r--src/tools/tidy/src/features.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/tools/tidy/src/features.rs b/src/tools/tidy/src/features.rs
index 8e14bcdebc8..abc6ecf1b06 100644
--- a/src/tools/tidy/src/features.rs
+++ b/src/tools/tidy/src/features.rs
@@ -124,6 +124,9 @@ pub fn check(path: &Path, bad: &mut bool) {
             return;
         }
 
+        let filen_underscore = filename.replace("-","_").replace(".rs","");
+        test_filen_gate(&filen_underscore, &mut features);
+
         contents.truncate(0);
         t!(t!(File::open(&file), &file).read_to_string(&mut contents));
 
@@ -214,6 +217,19 @@ fn find_attr_val<'a>(line: &'a str, attr: &str) -> Option<&'a str> {
         .map(|(i, j)| &line[i..j])
 }
 
+fn test_filen_gate(filen_underscore: &str,
+                   features: &mut HashMap<String, Feature>) -> bool {
+    if filen_underscore.starts_with("feature_gate") {
+        for (n, f) in features.iter_mut() {
+            if filen_underscore == format!("feature_gate_{}", n) {
+                f.has_gate_test = true;
+                return true;
+            }
+        }
+    }
+    return false;
+}
+
 fn collect_lang_features(path: &Path) -> HashMap<String, Feature> {
     let mut contents = String::new();
     t!(t!(File::open(path)).read_to_string(&mut contents));