Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide_ssr/src/tests.rs')
| -rw-r--r-- | crates/ide_ssr/src/tests.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/crates/ide_ssr/src/tests.rs b/crates/ide_ssr/src/tests.rs index 0b0c1111c4..30eda9d56c 100644 --- a/crates/ide_ssr/src/tests.rs +++ b/crates/ide_ssr/src/tests.rs @@ -332,6 +332,15 @@ fn ssr_struct_lit() { } #[test] +fn ssr_struct_def() { + assert_ssr_transform( + "struct Foo { $f: $t } ==>> struct Foo($t);", + r#"struct Foo { field: i32 }"#, + expect![[r#"struct Foo(i32);"#]], + ) +} + +#[test] fn ignores_whitespace() { assert_matches("1+2", "fn f() -> i32 {1 + 2}", &["1 + 2"]); assert_matches("1 + 2", "fn f() -> i32 {1+2}", &["1+2"]); @@ -792,6 +801,19 @@ fn replace_type() { "struct Result<T, E> {} struct Option<T> {} fn f1() -> Option<Vec<Error>> {foo()}" ]], ); + assert_ssr_transform( + "dyn Trait<$a> ==>> DynTrait<$a>", + r#" +trait Trait<T> {} +struct DynTrait<T> {} +fn f1() -> dyn Trait<Vec<Error>> {foo()} +"#, + expect![[r#" +trait Trait<T> {} +struct DynTrait<T> {} +fn f1() -> DynTrait<Vec<Error>> {foo()} +"#]], + ); } #[test] |