Skip to content

Commit 6f81a37

Browse files
committed
Add a smoke test for ra_batch
1 parent 6964a88 commit 6f81a37

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

crates/ra_batch/src/lib.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,27 @@ impl BatchDatabase {
126126
Ok((db, local_roots))
127127
}
128128
}
129+
130+
#[cfg(test)]
131+
mod 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+
}

0 commit comments

Comments
 (0)