aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_batch/src
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2019-02-10 10:44:53 +0000
committerFlorian Diebold <[email protected]>2019-02-10 10:44:53 +0000
commit6f81a372db9e402126dcc36a725e9b1d71491955 (patch)
tree8efdb65944b46495c02c4a366c69b93a8064dcc8 /crates/ra_batch/src
parent6964a88e8c90f06220498d3e9194b7e2073c1e32 (diff)
Add a smoke test for ra_batch
Diffstat (limited to 'crates/ra_batch/src')
-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}