From d79dc38e99f522be79b776b4b10090ecf175013c Mon Sep 17 00:00:00 2001 From: Phil Ellison Date: Mon, 29 Jul 2019 19:02:03 +0100 Subject: Move assist test, add literal type inference test --- crates/ra_assists/src/add_explicit_type.rs | 15 --------------- crates/ra_hir/src/ty/tests.rs | 26 +++++++++++++++----------- 2 files changed, 15 insertions(+), 26 deletions(-) (limited to 'crates') diff --git a/crates/ra_assists/src/add_explicit_type.rs b/crates/ra_assists/src/add_explicit_type.rs index 2ed03e5e9..88970929f 100644 --- a/crates/ra_assists/src/add_explicit_type.rs +++ b/crates/ra_assists/src/add_explicit_type.rs @@ -69,21 +69,6 @@ mod tests { ); } - // https://github.com/rust-analyzer/rust-analyzer/issues/1592 - #[test] - fn add_explicit_type_infers_correct_type_for_floating_point_literal() { - check_assist( - add_explicit_type, - "fn f() { let a<|> = 42f64; }", - "fn f() { let a<|>: f64 = 42f64; }", - ); - check_assist( - add_explicit_type, - "fn f() { let a<|> = 42f32; }", - "fn f() { let a<|>: f32 = 42f32; }", - ); - } - #[test] fn add_explicit_type_not_applicable_if_ty_not_inferred() { check_assist_not_applicable(add_explicit_type, "fn f() { let a<|> = None; }"); diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs index 676711d0a..36dea17a3 100644 --- a/crates/ra_hir/src/ty/tests.rs +++ b/crates/ra_hir/src/ty/tests.rs @@ -334,6 +334,8 @@ fn infer_literals() { infer(r##" fn test() { 5i32; + 5f32; + 5f64; "hello"; b"bytes"; 'c'; @@ -351,18 +353,20 @@ fn test() { } "##), @r###" -[11; 201) '{ ...o"#; }': () +[11; 221) '{ ...o"#; }': () [17; 21) '5i32': i32 -[27; 34) '"hello"': &str -[40; 48) 'b"bytes"': &[u8] -[54; 57) ''c'': char -[63; 67) 'b'b'': u8 -[73; 77) '3.14': f64 -[83; 87) '5000': i32 -[93; 98) 'false': bool -[104; 108) 'true': bool -[114; 182) 'r#" ... "#': &str -[188; 198) 'br#"yolo"#': &[u8]"### +[27; 31) '5f32': f32 +[37; 41) '5f64': f64 +[47; 54) '"hello"': &str +[60; 68) 'b"bytes"': &[u8] +[74; 77) ''c'': char +[83; 87) 'b'b'': u8 +[93; 97) '3.14': f64 +[103; 107) '5000': i32 +[113; 118) 'false': bool +[124; 128) 'true': bool +[134; 202) 'r#" ... "#': &str +[208; 218) 'br#"yolo"#': &[u8]"### ); } -- cgit v1.2.3