From 6f81a372db9e402126dcc36a725e9b1d71491955 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sun, 10 Feb 2019 11:44:53 +0100 Subject: Add a smoke test for ra_batch --- crates/ra_batch/src/lib.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'crates/ra_batch/src') 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 { 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); + } +} -- cgit v1.2.3