2020-06-29 15:22:47 +00:00
|
|
|
use super::check_types_source_code;
|
2020-04-25 14:57:59 +00:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn qualify_path_to_submodule() {
|
2020-06-29 15:22:47 +00:00
|
|
|
check_types_source_code(
|
2020-04-25 14:57:59 +00:00
|
|
|
r#"
|
|
|
|
mod foo {
|
|
|
|
pub struct Foo;
|
|
|
|
}
|
|
|
|
|
|
|
|
fn bar() {
|
|
|
|
let foo: foo::Foo = foo::Foo;
|
2020-06-29 15:22:47 +00:00
|
|
|
foo
|
|
|
|
} //^ foo::Foo
|
2020-04-25 14:57:59 +00:00
|
|
|
|
|
|
|
"#,
|
|
|
|
);
|
|
|
|
}
|
2020-05-10 16:09:22 +00:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn omit_default_type_parameters() {
|
2020-06-29 15:22:47 +00:00
|
|
|
check_types_source_code(
|
|
|
|
r#"
|
|
|
|
struct Foo<T = u8> { t: T }
|
|
|
|
fn main() {
|
|
|
|
let foo = Foo { t: 5u8 };
|
|
|
|
foo;
|
|
|
|
} //^ Foo
|
|
|
|
"#,
|
2020-05-10 16:09:22 +00:00
|
|
|
);
|
|
|
|
|
2020-06-29 15:22:47 +00:00
|
|
|
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>
|
|
|
|
"#,
|
2020-05-10 16:09:22 +00:00
|
|
|
);
|
|
|
|
}
|