aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_batch/src/lib.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/crates/ra_batch/src/lib.rs b/crates/ra_batch/src/lib.rs
index 014663546..c1cfb76bc 100644
--- a/crates/ra_batch/src/lib.rs
+++ b/crates/ra_batch/src/lib.rs
@@ -126,3 +126,27 @@ impl BatchDatabase {
126 Ok((db, local_roots)) 126 Ok((db, local_roots))
127 } 127 }
128} 128}
129
130#[cfg(test)]
131mod tests {
132 use ra_hir::Crate;
133 use super::*;
134
135 #[test]
136 fn test_loading_rust_analyzer() {
137 let mut path = std::env::current_exe().unwrap();
138 while !path.join("Cargo.toml").is_file() {
139 path = path.parent().unwrap().to_owned();
140 }
141 let (db, roots) = BatchDatabase::load_cargo(path).unwrap();
142 let mut num_crates = 0;
143 for root in roots {
144 for _krate in Crate::source_root_crates(&db, root) {
145 num_crates += 1;
146 }
147 }
148
149 // RA has quite a few crates, but the exact count doesn't matter
150 assert!(num_crates > 20);
151 }
152}