mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-10 23:24:29 +00:00
Minor incremental tests cleanup
This commit is contained in:
parent
ece8fa81bb
commit
b7aaefb5a4
2 changed files with 10 additions and 10 deletions
|
@ -28,9 +28,9 @@ pub trait WithFixture: Default + SourceDatabaseExt + 'static {
|
|||
db
|
||||
}
|
||||
|
||||
fn with_position(fixture: &str) -> (Self, FilePosition) {
|
||||
fn with_position(ra_fixture: &str) -> (Self, FilePosition) {
|
||||
let mut db = Self::default();
|
||||
let pos = with_files(&mut db, fixture);
|
||||
let pos = with_files(&mut db, ra_fixture);
|
||||
(db, pos.unwrap())
|
||||
}
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ use ra_db::SourceDatabaseExt;
|
|||
|
||||
use super::*;
|
||||
|
||||
fn check_def_map_is_not_recomputed(initial: &str, file_change: &str) {
|
||||
let (mut db, pos) = TestDB::with_position(initial);
|
||||
fn check_def_map_is_not_recomputed(ra_fixture_initial: &str, ra_fixture_change: &str) {
|
||||
let (mut db, pos) = TestDB::with_position(ra_fixture_initial);
|
||||
let krate = db.test_crate();
|
||||
{
|
||||
let events = db.log_executed(|| {
|
||||
|
@ -13,7 +13,7 @@ fn check_def_map_is_not_recomputed(initial: &str, file_change: &str) {
|
|||
});
|
||||
assert!(format!("{:?}", events).contains("crate_def_map"), "{:#?}", events)
|
||||
}
|
||||
db.set_file_text(pos.file_id, Arc::new(file_change.to_string()));
|
||||
db.set_file_text(pos.file_id, Arc::new(ra_fixture_change.to_string()));
|
||||
|
||||
{
|
||||
let events = db.log_executed(|| {
|
||||
|
@ -26,7 +26,7 @@ fn check_def_map_is_not_recomputed(initial: &str, file_change: &str) {
|
|||
#[test]
|
||||
fn typing_inside_a_function_should_not_invalidate_def_map() {
|
||||
check_def_map_is_not_recomputed(
|
||||
"
|
||||
r"
|
||||
//- /lib.rs
|
||||
mod foo;<|>
|
||||
|
||||
|
@ -41,7 +41,7 @@ fn typing_inside_a_function_should_not_invalidate_def_map() {
|
|||
//- /foo/bar.rs
|
||||
pub struct Baz;
|
||||
",
|
||||
"
|
||||
r"
|
||||
mod foo;
|
||||
|
||||
use crate::foo::bar::Baz;
|
||||
|
@ -54,7 +54,7 @@ fn typing_inside_a_function_should_not_invalidate_def_map() {
|
|||
#[test]
|
||||
fn adding_inner_items_should_not_invalidate_def_map() {
|
||||
check_def_map_is_not_recomputed(
|
||||
"
|
||||
r"
|
||||
//- /lib.rs
|
||||
struct S { a: i32}
|
||||
enum E { A }
|
||||
|
@ -72,7 +72,7 @@ fn adding_inner_items_should_not_invalidate_def_map() {
|
|||
//- /foo/bar.rs
|
||||
pub struct Baz;
|
||||
",
|
||||
"
|
||||
r"
|
||||
struct S { a: i32, b: () }
|
||||
enum E { A, B }
|
||||
trait T {
|
||||
|
@ -92,7 +92,7 @@ fn adding_inner_items_should_not_invalidate_def_map() {
|
|||
#[test]
|
||||
fn typing_inside_a_macro_should_not_invalidate_def_map() {
|
||||
let (mut db, pos) = TestDB::with_position(
|
||||
"
|
||||
r"
|
||||
//- /lib.rs
|
||||
macro_rules! m {
|
||||
($ident:ident) => {
|
||||
|
|
Loading…
Reference in a new issue