mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
Update the rest of the tests
This commit is contained in:
parent
e805e8c1d5
commit
bbc4dc9956
9 changed files with 311 additions and 446 deletions
|
@ -1,50 +1,41 @@
|
|||
use super::displayed_source_at_pos;
|
||||
use crate::test_db::TestDB;
|
||||
use ra_db::fixture::WithFixture;
|
||||
use super::check_types_source_code;
|
||||
|
||||
#[test]
|
||||
fn qualify_path_to_submodule() {
|
||||
let (db, pos) = TestDB::with_position(
|
||||
check_types_source_code(
|
||||
r#"
|
||||
//- /main.rs
|
||||
|
||||
mod foo {
|
||||
pub struct Foo;
|
||||
}
|
||||
|
||||
fn bar() {
|
||||
let foo: foo::Foo = foo::Foo;
|
||||
foo<|>
|
||||
}
|
||||
foo
|
||||
} //^ foo::Foo
|
||||
|
||||
"#,
|
||||
);
|
||||
assert_eq!("foo::Foo", displayed_source_at_pos(&db, pos));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn omit_default_type_parameters() {
|
||||
let (db, pos) = TestDB::with_position(
|
||||
r"
|
||||
//- /main.rs
|
||||
struct Foo<T = u8> { t: T }
|
||||
fn main() {
|
||||
let foo = Foo { t: 5u8 };
|
||||
foo<|>;
|
||||
}
|
||||
",
|
||||
check_types_source_code(
|
||||
r#"
|
||||
struct Foo<T = u8> { t: T }
|
||||
fn main() {
|
||||
let foo = Foo { t: 5u8 };
|
||||
foo;
|
||||
} //^ Foo
|
||||
"#,
|
||||
);
|
||||
assert_eq!("Foo", displayed_source_at_pos(&db, pos));
|
||||
|
||||
let (db, pos) = TestDB::with_position(
|
||||
r"
|
||||
//- /main.rs
|
||||
struct Foo<K, T = u8> { k: K, t: T }
|
||||
fn main() {
|
||||
let foo = Foo { k: 400, t: 5u8 };
|
||||
foo<|>;
|
||||
}
|
||||
",
|
||||
check_types_source_code(
|
||||
r#"
|
||||
struct Foo<K, T = u8> { k: K, t: T }
|
||||
fn main() {
|
||||
let foo = Foo { k: 400, t: 5u8 };
|
||||
foo;
|
||||
} //^ Foo<i32>
|
||||
"#,
|
||||
);
|
||||
assert_eq!("Foo<i32>", displayed_source_at_pos(&db, pos));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue