Add a smoke test for ra_batch

This commit is contained in:
Florian Diebold 2019-02-10 11:44:53 +01:00
parent 6964a88e8c
commit 6f81a372db

View File

@ -126,3 +126,27 @@ impl BatchDatabase {
Ok((db, local_roots))
}
}
#[cfg(test)]
mod tests {
use ra_hir::Crate;
use super::*;
#[test]
fn test_loading_rust_analyzer() {
let mut path = std::env::current_exe().unwrap();
while !path.join("Cargo.toml").is_file() {
path = path.parent().unwrap().to_owned();
}
let (db, roots) = BatchDatabase::load_cargo(path).unwrap();
let mut num_crates = 0;
for root in roots {
for _krate in Crate::source_root_crates(&db, root) {
num_crates += 1;
}
}
// RA has quite a few crates, but the exact count doesn't matter
assert!(num_crates > 20);
}
}