about summary refs log tree commit diff
path: root/src/librustpkg/package_source.rs
diff options
context:
space:
mode:
authorTim Chevalier <chevalier@alum.wellesley.edu>2013-09-26 16:04:49 -0700
committerTim Chevalier <chevalier@alum.wellesley.edu>2013-09-27 09:38:22 -0700
commit96bdcd07fe9ec44fac8dedb2425ae7783e4108ce (patch)
tree7a869afd91bd58594abb6c94c2c3c81f551cbde5 /src/librustpkg/package_source.rs
parentf210a1671883d5fe97a2b06ebbe9270fa9a6943a (diff)
rustpkg: Implement `rustpkg test`
Towards #7401
Diffstat (limited to 'src/librustpkg/package_source.rs')
-rw-r--r--src/librustpkg/package_source.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/librustpkg/package_source.rs b/src/librustpkg/package_source.rs
index c2fddafd5fe..006a58e042f 100644
--- a/src/librustpkg/package_source.rs
+++ b/src/librustpkg/package_source.rs
@@ -246,13 +246,17 @@ impl PkgSrc {
     /// Infers crates to build. Called only in the case where there
     /// is no custom build logic
     pub fn find_crates(&mut self) {
+        self.find_crates_with_filter(|_| true);
+    }
+
+    pub fn find_crates_with_filter(&mut self, filter: &fn(&str) -> bool) {
         use conditions::missing_pkg_files::cond;
 
         let prefix = self.start_dir.components.len();
         debug!("Matching against %s", self.id.short_name);
         do os::walk_dir(&self.start_dir) |pth| {
             let maybe_known_crate_set = match pth.filename() {
-                Some(filename) => match filename {
+                Some(filename) if filter(filename) => match filename {
                     "lib.rs" => Some(&mut self.libs),
                     "main.rs" => Some(&mut self.mains),
                     "test.rs" => Some(&mut self.tests),