From a2521106163d3aaeeecfb28cae42d6aba99bba3f Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Mon, 21 Jan 2019 22:52:35 +0100 Subject: Use insta for ty tests --- crates/ra_hir/Cargo.toml | 1 + crates/ra_hir/src/ty/snapshots/tests__bug_484.snap | 10 +++ crates/ra_hir/src/ty/snapshots/tests__bug_585.snap | 13 ++++ .../src/ty/snapshots/tests__infer_adt_pattern.snap | 27 ++++++++ .../src/ty/snapshots/tests__infer_array.snap | 57 ++++++++++++++++ .../src/ty/snapshots/tests__infer_backwards.snap | 25 +++++++ .../src/ty/snapshots/tests__infer_basics.snap | 18 +++++ .../src/ty/snapshots/tests__infer_binary_op.snap | 51 +++++++++++++++ .../ra_hir/src/ty/snapshots/tests__infer_enum.snap | 9 +++ .../ty/snapshots/tests__infer_field_autoderef.snap | 48 ++++++++++++++ .../snapshots/tests__infer_function_generics.snap | 19 ++++++ .../ty/snapshots/tests__infer_generic_chain.snap | 34 ++++++++++ .../tests__infer_generics_in_patterns.snap | 22 +++++++ .../ty/snapshots/tests__infer_inherent_method.snap | 23 +++++++ .../ra_hir/src/ty/snapshots/tests__infer_let.snap | 12 ++++ .../src/ty/snapshots/tests__infer_literals.snap | 17 +++++ .../src/ty/snapshots/tests__infer_paths.snap | 14 ++++ .../src/ty/snapshots/tests__infer_pattern.snap | 52 +++++++++++++++ .../ra_hir/src/ty/snapshots/tests__infer_refs.snap | 28 ++++++++ .../ra_hir/src/ty/snapshots/tests__infer_self.snap | 11 ++++ .../src/ty/snapshots/tests__infer_struct.snap | 21 ++++++ .../ty/snapshots/tests__infer_struct_generics.snap | 20 ++++++ .../src/ty/snapshots/tests__infer_tuple.snap | 32 +++++++++ .../src/ty/snapshots/tests__infer_unary_op.snap | 33 ++++++++++ .../tests__no_panic_on_field_of_enum.snap | 9 +++ crates/ra_hir/src/ty/tests.rs | 76 +++++++++------------- crates/ra_hir/src/ty/tests/data/adt_pattern.txt | 22 ------- crates/ra_hir/src/ty/tests/data/array.txt | 52 --------------- crates/ra_hir/src/ty/tests/data/backwards.txt | 20 ------ crates/ra_hir/src/ty/tests/data/basics.txt | 13 ---- crates/ra_hir/src/ty/tests/data/binary_op.txt | 46 ------------- crates/ra_hir/src/ty/tests/data/bug_484.txt | 5 -- crates/ra_hir/src/ty/tests/data/bug_585.txt | 8 --- crates/ra_hir/src/ty/tests/data/enum.txt | 4 -- .../ra_hir/src/ty/tests/data/field_autoderef.txt | 43 ------------ .../ra_hir/src/ty/tests/data/function_generics.txt | 14 ---- crates/ra_hir/src/ty/tests/data/generic_chain.txt | 29 --------- .../src/ty/tests/data/generics_in_patterns.txt | 17 ----- .../ra_hir/src/ty/tests/data/inherent_method.txt | 18 ----- crates/ra_hir/src/ty/tests/data/let.txt | 7 -- crates/ra_hir/src/ty/tests/data/literals.txt | 12 ---- .../ty/tests/data/no_panic_on_field_of_enum.txt | 4 -- crates/ra_hir/src/ty/tests/data/paths.txt | 9 --- crates/ra_hir/src/ty/tests/data/pattern.txt | 47 ------------- crates/ra_hir/src/ty/tests/data/refs_and_ptrs.txt | 23 ------- crates/ra_hir/src/ty/tests/data/self.txt | 6 -- crates/ra_hir/src/ty/tests/data/struct.txt | 16 ----- .../ra_hir/src/ty/tests/data/struct_generics.txt | 15 ----- crates/ra_hir/src/ty/tests/data/tuple.txt | 27 -------- crates/ra_hir/src/ty/tests/data/unary_op.txt | 28 -------- 50 files changed, 635 insertions(+), 532 deletions(-) create mode 100644 crates/ra_hir/src/ty/snapshots/tests__bug_484.snap create mode 100644 crates/ra_hir/src/ty/snapshots/tests__bug_585.snap create mode 100644 crates/ra_hir/src/ty/snapshots/tests__infer_adt_pattern.snap create mode 100644 crates/ra_hir/src/ty/snapshots/tests__infer_array.snap create mode 100644 crates/ra_hir/src/ty/snapshots/tests__infer_backwards.snap create mode 100644 crates/ra_hir/src/ty/snapshots/tests__infer_basics.snap create mode 100644 crates/ra_hir/src/ty/snapshots/tests__infer_binary_op.snap create mode 100644 crates/ra_hir/src/ty/snapshots/tests__infer_enum.snap create mode 100644 crates/ra_hir/src/ty/snapshots/tests__infer_field_autoderef.snap create mode 100644 crates/ra_hir/src/ty/snapshots/tests__infer_function_generics.snap create mode 100644 crates/ra_hir/src/ty/snapshots/tests__infer_generic_chain.snap create mode 100644 crates/ra_hir/src/ty/snapshots/tests__infer_generics_in_patterns.snap create mode 100644 crates/ra_hir/src/ty/snapshots/tests__infer_inherent_method.snap create mode 100644 crates/ra_hir/src/ty/snapshots/tests__infer_let.snap create mode 100644 crates/ra_hir/src/ty/snapshots/tests__infer_literals.snap create mode 100644 crates/ra_hir/src/ty/snapshots/tests__infer_paths.snap create mode 100644 crates/ra_hir/src/ty/snapshots/tests__infer_pattern.snap create mode 100644 crates/ra_hir/src/ty/snapshots/tests__infer_refs.snap create mode 100644 crates/ra_hir/src/ty/snapshots/tests__infer_self.snap create mode 100644 crates/ra_hir/src/ty/snapshots/tests__infer_struct.snap create mode 100644 crates/ra_hir/src/ty/snapshots/tests__infer_struct_generics.snap create mode 100644 crates/ra_hir/src/ty/snapshots/tests__infer_tuple.snap create mode 100644 crates/ra_hir/src/ty/snapshots/tests__infer_unary_op.snap create mode 100644 crates/ra_hir/src/ty/snapshots/tests__no_panic_on_field_of_enum.snap delete mode 100644 crates/ra_hir/src/ty/tests/data/adt_pattern.txt delete mode 100644 crates/ra_hir/src/ty/tests/data/array.txt delete mode 100644 crates/ra_hir/src/ty/tests/data/backwards.txt delete mode 100644 crates/ra_hir/src/ty/tests/data/basics.txt delete mode 100644 crates/ra_hir/src/ty/tests/data/binary_op.txt delete mode 100644 crates/ra_hir/src/ty/tests/data/bug_484.txt delete mode 100644 crates/ra_hir/src/ty/tests/data/bug_585.txt delete mode 100644 crates/ra_hir/src/ty/tests/data/enum.txt delete mode 100644 crates/ra_hir/src/ty/tests/data/field_autoderef.txt delete mode 100644 crates/ra_hir/src/ty/tests/data/function_generics.txt delete mode 100644 crates/ra_hir/src/ty/tests/data/generic_chain.txt delete mode 100644 crates/ra_hir/src/ty/tests/data/generics_in_patterns.txt delete mode 100644 crates/ra_hir/src/ty/tests/data/inherent_method.txt delete mode 100644 crates/ra_hir/src/ty/tests/data/let.txt delete mode 100644 crates/ra_hir/src/ty/tests/data/literals.txt delete mode 100644 crates/ra_hir/src/ty/tests/data/no_panic_on_field_of_enum.txt delete mode 100644 crates/ra_hir/src/ty/tests/data/paths.txt delete mode 100644 crates/ra_hir/src/ty/tests/data/pattern.txt delete mode 100644 crates/ra_hir/src/ty/tests/data/refs_and_ptrs.txt delete mode 100644 crates/ra_hir/src/ty/tests/data/self.txt delete mode 100644 crates/ra_hir/src/ty/tests/data/struct.txt delete mode 100644 crates/ra_hir/src/ty/tests/data/struct_generics.txt delete mode 100644 crates/ra_hir/src/ty/tests/data/tuple.txt delete mode 100644 crates/ra_hir/src/ty/tests/data/unary_op.txt (limited to 'crates/ra_hir') diff --git a/crates/ra_hir/Cargo.toml b/crates/ra_hir/Cargo.toml index 87d2e98e9..3d5dddc6a 100644 --- a/crates/ra_hir/Cargo.toml +++ b/crates/ra_hir/Cargo.toml @@ -19,3 +19,4 @@ test_utils = { path = "../test_utils" } [dev-dependencies] flexi_logger = "0.10.0" +insta = "0.1.4" diff --git a/crates/ra_hir/src/ty/snapshots/tests__bug_484.snap b/crates/ra_hir/src/ty/snapshots/tests__bug_484.snap new file mode 100644 index 000000000..eeb3061d3 --- /dev/null +++ b/crates/ra_hir/src/ty/snapshots/tests__bug_484.snap @@ -0,0 +1,10 @@ +Created: 2019-01-21T21:48:20.662863951+00:00 +Creator: insta@0.1.4 +Source: crates/ra_hir/src/ty/tests.rs + +[11; 37) '{ l... {}; }': () +[20; 21) 'x': () +[24; 34) 'if true {}': () +[27; 31) 'true': bool +[32; 34) '{}': () + diff --git a/crates/ra_hir/src/ty/snapshots/tests__bug_585.snap b/crates/ra_hir/src/ty/snapshots/tests__bug_585.snap new file mode 100644 index 000000000..073009bbc --- /dev/null +++ b/crates/ra_hir/src/ty/snapshots/tests__bug_585.snap @@ -0,0 +1,13 @@ +Created: 2019-01-21T21:48:20.662863969+00:00 +Creator: insta@0.1.4 +Source: crates/ra_hir/src/ty/tests.rs + +[11; 89) '{ ... } }': () +[17; 21) 'X {}': [unknown] +[27; 87) 'match ... }': () +[33; 34) 'x': [unknown] +[45; 52) 'A::B {}': [unknown] +[56; 58) '()': () +[68; 74) 'A::Y()': [unknown] +[78; 80) '()': () + diff --git a/crates/ra_hir/src/ty/snapshots/tests__infer_adt_pattern.snap b/crates/ra_hir/src/ty/snapshots/tests__infer_adt_pattern.snap new file mode 100644 index 000000000..fb261f1c0 --- /dev/null +++ b/crates/ra_hir/src/ty/snapshots/tests__infer_adt_pattern.snap @@ -0,0 +1,27 @@ +Created: 2019-01-21T21:48:20.662935249+00:00 +Creator: insta@0.1.4 +Source: crates/ra_hir/src/ty/tests.rs + +[68; 262) '{ ... d; }': () +[78; 79) 'e': E +[82; 95) 'E::A { x: 3 }': E +[92; 93) '3': usize +[106; 113) 'S(y, z)': S +[108; 109) 'y': u32 +[111; 112) 'z': E +[116; 119) 'foo': S +[129; 148) 'E::A {..._var }': E +[139; 146) 'new_var': usize +[151; 152) 'e': E +[159; 218) 'match ... }': usize +[165; 166) 'e': E +[177; 187) 'E::A { x }': E +[184; 185) 'x': usize +[191; 192) 'x': usize +[202; 206) 'E::B': E +[210; 211) '1': usize +[229; 248) 'ref d ...{ .. }': &E +[237; 248) 'E::A { .. }': E +[251; 252) 'e': E +[258; 259) 'd': &E + diff --git a/crates/ra_hir/src/ty/snapshots/tests__infer_array.snap b/crates/ra_hir/src/ty/snapshots/tests__infer_array.snap new file mode 100644 index 000000000..2fc613e26 --- /dev/null +++ b/crates/ra_hir/src/ty/snapshots/tests__infer_array.snap @@ -0,0 +1,57 @@ +Created: 2019-01-21T21:48:20.662961921+00:00 +Creator: insta@0.1.4 +Source: crates/ra_hir/src/ty/tests.rs + +[9; 10) 'x': &str +[18; 19) 'y': isize +[28; 293) '{ ... []; }': () +[38; 39) 'a': [&str] +[42; 45) '[x]': [&str] +[43; 44) 'x': &str +[55; 56) 'b': [[&str]] +[59; 65) '[a, a]': [[&str]] +[60; 61) 'a': [&str] +[63; 64) 'a': [&str] +[75; 76) 'c': [[[&str]]] +[79; 85) '[b, b]': [[[&str]]] +[80; 81) 'b': [[&str]] +[83; 84) 'b': [[&str]] +[96; 97) 'd': [isize] +[100; 112) '[y, 1, 2, 3]': [isize] +[101; 102) 'y': isize +[104; 105) '1': isize +[107; 108) '2': isize +[110; 111) '3': isize +[122; 123) 'd': [isize] +[126; 138) '[1, y, 2, 3]': [isize] +[127; 128) '1': isize +[130; 131) 'y': isize +[133; 134) '2': isize +[136; 137) '3': isize +[148; 149) 'e': [isize] +[152; 155) '[y]': [isize] +[153; 154) 'y': isize +[165; 166) 'f': [[isize]] +[169; 175) '[d, d]': [[isize]] +[170; 171) 'd': [isize] +[173; 174) 'd': [isize] +[185; 186) 'g': [[isize]] +[189; 195) '[e, e]': [[isize]] +[190; 191) 'e': [isize] +[193; 194) 'e': [isize] +[206; 207) 'h': [i32] +[210; 216) '[1, 2]': [i32] +[211; 212) '1': i32 +[214; 215) '2': i32 +[226; 227) 'i': [&str] +[230; 240) '["a", "b"]': [&str] +[231; 234) '"a"': &str +[236; 239) '"b"': &str +[251; 252) 'b': [[&str]] +[255; 265) '[a, ["b"]]': [[&str]] +[256; 257) 'a': [&str] +[259; 264) '["b"]': [&str] +[260; 263) '"b"': &str +[275; 276) 'x': [u8] +[288; 290) '[]': [u8] + diff --git a/crates/ra_hir/src/ty/snapshots/tests__infer_backwards.snap b/crates/ra_hir/src/ty/snapshots/tests__infer_backwards.snap new file mode 100644 index 000000000..12f0d8c90 --- /dev/null +++ b/crates/ra_hir/src/ty/snapshots/tests__infer_backwards.snap @@ -0,0 +1,25 @@ +Created: 2019-01-21T21:48:20.662902243+00:00 +Creator: insta@0.1.4 +Source: crates/ra_hir/src/ty/tests.rs + +[14; 15) 'x': u32 +[22; 24) '{}': () +[78; 231) '{ ...t &c }': &mut &f64 +[88; 89) 'a': u32 +[92; 108) 'unknow...nction': [unknown] +[92; 110) 'unknow...tion()': u32 +[116; 125) 'takes_u32': fn(u32) -> () +[116; 128) 'takes_u32(a)': () +[126; 127) 'a': u32 +[138; 139) 'b': i32 +[142; 158) 'unknow...nction': [unknown] +[142; 160) 'unknow...tion()': i32 +[166; 184) 'S { i3...d: b }': S +[181; 182) 'b': i32 +[194; 195) 'c': f64 +[198; 214) 'unknow...nction': [unknown] +[198; 216) 'unknow...tion()': f64 +[222; 229) '&mut &c': &mut &f64 +[227; 229) '&c': &f64 +[228; 229) 'c': f64 + diff --git a/crates/ra_hir/src/ty/snapshots/tests__infer_basics.snap b/crates/ra_hir/src/ty/snapshots/tests__infer_basics.snap new file mode 100644 index 000000000..eba8126e9 --- /dev/null +++ b/crates/ra_hir/src/ty/snapshots/tests__infer_basics.snap @@ -0,0 +1,18 @@ +Created: 2019-01-21T21:48:20.662874226+00:00 +Creator: insta@0.1.4 +Source: crates/ra_hir/src/ty/tests.rs + +[9; 10) 'a': u32 +[17; 18) 'b': isize +[27; 28) 'c': ! +[33; 34) 'd': &str +[42; 121) '{ ...f32; }': () +[48; 49) 'a': u32 +[55; 56) 'b': isize +[62; 63) 'c': ! +[69; 70) 'd': &str +[76; 82) '1usize': usize +[88; 94) '1isize': isize +[100; 106) '"test"': &str +[112; 118) '1.0f32': f32 + diff --git a/crates/ra_hir/src/ty/snapshots/tests__infer_binary_op.snap b/crates/ra_hir/src/ty/snapshots/tests__infer_binary_op.snap new file mode 100644 index 000000000..3b750ec45 --- /dev/null +++ b/crates/ra_hir/src/ty/snapshots/tests__infer_binary_op.snap @@ -0,0 +1,51 @@ +Created: 2019-01-21T21:48:20.662972146+00:00 +Creator: insta@0.1.4 +Source: crates/ra_hir/src/ty/tests.rs + +[6; 7) 'x': bool +[22; 34) '{ 0i32 }': i32 +[28; 32) '0i32': i32 +[54; 350) '{ ... < 3 }': bool +[64; 65) 'x': bool +[68; 69) 'a': bool +[68; 74) 'a && b': bool +[73; 74) 'b': bool +[84; 85) 'y': bool +[88; 92) 'true': bool +[88; 101) 'true || false': bool +[96; 101) 'false': bool +[111; 112) 'z': bool +[115; 116) 'x': bool +[115; 121) 'x == y': bool +[120; 121) 'y': bool +[131; 142) 'minus_forty': isize +[152; 160) '-40isize': isize +[153; 160) '40isize': isize +[170; 171) 'h': bool +[174; 185) 'minus_forty': isize +[174; 196) 'minus_...ONST_2': bool +[189; 196) 'CONST_2': isize +[206; 207) 'c': i32 +[210; 211) 'f': fn(bool) -> i32 +[210; 219) 'f(z || y)': i32 +[210; 223) 'f(z || y) + 5': i32 +[212; 213) 'z': bool +[212; 218) 'z || y': bool +[217; 218) 'y': bool +[222; 223) '5': i32 +[233; 234) 'd': [unknown] +[237; 238) 'b': [unknown] +[248; 249) 'g': () +[252; 263) 'minus_forty': isize +[252; 268) 'minus_...y ^= i': () +[267; 268) 'i': isize +[278; 281) 'ten': usize +[291; 293) '10': usize +[303; 316) 'ten_is_eleven': bool +[319; 322) 'ten': usize +[319; 334) 'ten == some_num': bool +[326; 334) 'some_num': usize +[341; 344) 'ten': usize +[341; 348) 'ten < 3': bool +[347; 348) '3': usize + diff --git a/crates/ra_hir/src/ty/snapshots/tests__infer_enum.snap b/crates/ra_hir/src/ty/snapshots/tests__infer_enum.snap new file mode 100644 index 000000000..8018ff025 --- /dev/null +++ b/crates/ra_hir/src/ty/snapshots/tests__infer_enum.snap @@ -0,0 +1,9 @@ +Created: 2019-01-21T21:48:20.662949719+00:00 +Creator: insta@0.1.4 +Source: crates/ra_hir/src/ty/tests.rs + +[48; 82) '{ E:...:V2; }': () +[52; 70) 'E::V1 ...d: 1 }': E +[67; 68) '1': u32 +[74; 79) 'E::V2': E + diff --git a/crates/ra_hir/src/ty/snapshots/tests__infer_field_autoderef.snap b/crates/ra_hir/src/ty/snapshots/tests__infer_field_autoderef.snap new file mode 100644 index 000000000..1943ef079 --- /dev/null +++ b/crates/ra_hir/src/ty/snapshots/tests__infer_field_autoderef.snap @@ -0,0 +1,48 @@ +Created: 2019-01-21T21:48:20.671554939+00:00 +Creator: insta@0.1.4 +Source: crates/ra_hir/src/ty/tests.rs + +[44; 45) 'a': A +[50; 213) '{ ...5.b; }': () +[60; 62) 'a1': A +[65; 66) 'a': A +[72; 74) 'a1': A +[72; 76) 'a1.b': B +[86; 88) 'a2': &A +[91; 93) '&a': &A +[92; 93) 'a': A +[99; 101) 'a2': &A +[99; 103) 'a2.b': B +[113; 115) 'a3': &mut A +[118; 124) '&mut a': &mut A +[123; 124) 'a': A +[130; 132) 'a3': &mut A +[130; 134) 'a3.b': B +[144; 146) 'a4': &&&&&&&A +[149; 157) '&&&&&&&a': &&&&&&&A +[150; 157) '&&&&&&a': &&&&&&A +[151; 157) '&&&&&a': &&&&&A +[152; 157) '&&&&a': &&&&A +[153; 157) '&&&a': &&&A +[154; 157) '&&a': &&A +[155; 157) '&a': &A +[156; 157) 'a': A +[163; 165) 'a4': &&&&&&&A +[163; 167) 'a4.b': B +[177; 179) 'a5': &mut &&mut &&mut A +[182; 200) '&mut &...&mut a': &mut &&mut &&mut A +[187; 200) '&&mut &&mut a': &&mut &&mut A +[188; 200) '&mut &&mut a': &mut &&mut A +[193; 200) '&&mut a': &&mut A +[194; 200) '&mut a': &mut A +[199; 200) 'a': A +[206; 208) 'a5': &mut &&mut &&mut A +[206; 210) 'a5.b': B +[224; 226) 'a1': *const A +[238; 240) 'a2': *mut A +[250; 273) '{ ...2.b; }': () +[256; 258) 'a1': *const A +[256; 260) 'a1.b': B +[266; 268) 'a2': *mut A +[266; 270) 'a2.b': B + diff --git a/crates/ra_hir/src/ty/snapshots/tests__infer_function_generics.snap b/crates/ra_hir/src/ty/snapshots/tests__infer_function_generics.snap new file mode 100644 index 000000000..386acc0b3 --- /dev/null +++ b/crates/ra_hir/src/ty/snapshots/tests__infer_function_generics.snap @@ -0,0 +1,19 @@ +Created: 2019-01-21T21:48:20.669112954+00:00 +Creator: insta@0.1.4 +Source: crates/ra_hir/src/ty/tests.rs + +[10; 11) 't': [unknown] +[21; 26) '{ t }': [unknown] +[23; 24) 't': [unknown] +[38; 98) '{ ...(1); }': () +[44; 46) 'id': fn(T) -> T +[44; 52) 'id(1u32)': T +[47; 51) '1u32': u32 +[58; 68) 'id::': fn(T) -> T +[58; 71) 'id::(1)': T +[69; 70) '1': T +[81; 82) 'x': T +[90; 92) 'id': fn(T) -> T +[90; 95) 'id(1)': T +[93; 94) '1': T + diff --git a/crates/ra_hir/src/ty/snapshots/tests__infer_generic_chain.snap b/crates/ra_hir/src/ty/snapshots/tests__infer_generic_chain.snap new file mode 100644 index 000000000..7a64e4f95 --- /dev/null +++ b/crates/ra_hir/src/ty/snapshots/tests__infer_generic_chain.snap @@ -0,0 +1,34 @@ +Created: 2019-01-21T21:48:20.672467086+00:00 +Creator: insta@0.1.4 +Source: crates/ra_hir/src/ty/tests.rs + +[53; 57) 'self': A<[unknown]> +[65; 87) '{ ... }': [unknown] +[75; 79) 'self': A<[unknown]> +[75; 81) 'self.x': [unknown] +[99; 100) 't': [unknown] +[110; 115) '{ t }': [unknown] +[112; 113) 't': [unknown] +[135; 261) '{ ....x() }': i128 +[146; 147) 'x': T +[150; 151) '1': T +[162; 163) 'y': T +[166; 168) 'id': fn(T) -> T +[166; 171) 'id(x)': T +[169; 170) 'x': T +[182; 183) 'a': A +[186; 200) 'A { x: id(y) }': A +[193; 195) 'id': fn(T) -> T +[193; 198) 'id(y)': T +[196; 197) 'y': T +[211; 212) 'z': T +[215; 217) 'id': fn(T) -> T +[215; 222) 'id(a.x)': T +[218; 219) 'a': A +[218; 221) 'a.x': T +[233; 234) 'b': A +[237; 247) 'A { x: z }': A +[244; 245) 'z': T +[254; 255) 'b': A +[254; 259) 'b.x()': i128 + diff --git a/crates/ra_hir/src/ty/snapshots/tests__infer_generics_in_patterns.snap b/crates/ra_hir/src/ty/snapshots/tests__infer_generics_in_patterns.snap new file mode 100644 index 000000000..ae38ec2fb --- /dev/null +++ b/crates/ra_hir/src/ty/snapshots/tests__infer_generics_in_patterns.snap @@ -0,0 +1,22 @@ +Created: 2019-01-21T21:48:20.683908196+00:00 +Creator: insta@0.1.4 +Source: crates/ra_hir/src/ty/tests.rs + +[79; 81) 'a1': A +[91; 92) 'o': Option +[107; 244) '{ ... }; }': () +[117; 128) 'A { x: x2 }': A +[124; 126) 'x2': u32 +[131; 133) 'a1': A +[143; 161) 'A:: +[157; 159) 'x3': i64 +[164; 174) 'A { x: 1 }': A +[171; 172) '1': i64 +[180; 241) 'match ... }': u64 +[186; 187) 'o': Option +[198; 213) 'Option::Some(t)': Option +[211; 212) 't': u64 +[217; 218) 't': u64 +[228; 229) '_': Option +[233; 234) '1': u64 + diff --git a/crates/ra_hir/src/ty/snapshots/tests__infer_inherent_method.snap b/crates/ra_hir/src/ty/snapshots/tests__infer_inherent_method.snap new file mode 100644 index 000000000..298dac585 --- /dev/null +++ b/crates/ra_hir/src/ty/snapshots/tests__infer_inherent_method.snap @@ -0,0 +1,23 @@ +Created: 2019-01-21T21:48:20.670255659+00:00 +Creator: insta@0.1.4 +Source: crates/ra_hir/src/ty/tests.rs + +[32; 36) 'self': A +[38; 39) 'x': u32 +[53; 55) '{}': () +[103; 107) 'self': &A +[109; 110) 'x': u64 +[124; 126) '{}': () +[144; 145) 'a': A +[150; 198) '{ ...(1); }': () +[156; 157) 'a': A +[156; 164) 'a.foo(1)': i32 +[162; 163) '1': u32 +[170; 181) '(&a).bar(1)': i64 +[171; 173) '&a': &A +[172; 173) 'a': A +[179; 180) '1': u64 +[187; 188) 'a': A +[187; 195) 'a.bar(1)': i64 +[193; 194) '1': u64 + diff --git a/crates/ra_hir/src/ty/snapshots/tests__infer_let.snap b/crates/ra_hir/src/ty/snapshots/tests__infer_let.snap new file mode 100644 index 000000000..aa4e4cc63 --- /dev/null +++ b/crates/ra_hir/src/ty/snapshots/tests__infer_let.snap @@ -0,0 +1,12 @@ +Created: 2019-01-21T21:48:20.666406651+00:00 +Creator: insta@0.1.4 +Source: crates/ra_hir/src/ty/tests.rs + +[11; 71) '{ ...= b; }': () +[21; 22) 'a': isize +[25; 31) '1isize': isize +[41; 42) 'b': usize +[52; 53) '1': usize +[63; 64) 'c': usize +[67; 68) 'b': usize + diff --git a/crates/ra_hir/src/ty/snapshots/tests__infer_literals.snap b/crates/ra_hir/src/ty/snapshots/tests__infer_literals.snap new file mode 100644 index 000000000..00c7e639e --- /dev/null +++ b/crates/ra_hir/src/ty/snapshots/tests__infer_literals.snap @@ -0,0 +1,17 @@ +Created: 2019-01-21T21:48:20.666200994+00:00 +Creator: insta@0.1.4 +Source: crates/ra_hir/src/ty/tests.rs + +[11; 201) '{ ...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] + diff --git a/crates/ra_hir/src/ty/snapshots/tests__infer_paths.snap b/crates/ra_hir/src/ty/snapshots/tests__infer_paths.snap new file mode 100644 index 000000000..0924cdc80 --- /dev/null +++ b/crates/ra_hir/src/ty/snapshots/tests__infer_paths.snap @@ -0,0 +1,14 @@ +Created: 2019-01-21T21:48:20.671399345+00:00 +Creator: insta@0.1.4 +Source: crates/ra_hir/src/ty/tests.rs + +[15; 20) '{ 1 }': u32 +[17; 18) '1': u32 +[48; 53) '{ 1 }': u32 +[50; 51) '1': u32 +[67; 91) '{ ...c(); }': () +[73; 74) 'a': fn() -> u32 +[73; 76) 'a()': u32 +[82; 86) 'b::c': fn() -> u32 +[82; 88) 'b::c()': u32 + diff --git a/crates/ra_hir/src/ty/snapshots/tests__infer_pattern.snap b/crates/ra_hir/src/ty/snapshots/tests__infer_pattern.snap new file mode 100644 index 000000000..b22b71765 --- /dev/null +++ b/crates/ra_hir/src/ty/snapshots/tests__infer_pattern.snap @@ -0,0 +1,52 @@ +Created: 2019-01-21T21:48:20.677661229+00:00 +Creator: insta@0.1.4 +Source: crates/ra_hir/src/ty/tests.rs + +[9; 10) 'x': &i32 +[18; 369) '{ ...o_x; }': () +[28; 29) 'y': &i32 +[32; 33) 'x': &i32 +[43; 45) '&z': &i32 +[44; 45) 'z': i32 +[48; 49) 'x': &i32 +[59; 60) 'a': i32 +[63; 64) 'z': i32 +[74; 80) '(c, d)': (i32, &str) +[75; 76) 'c': i32 +[78; 79) 'd': &str +[83; 95) '(1, "hello")': (i32, &str) +[84; 85) '1': i32 +[87; 94) '"hello"': &str +[102; 152) 'for (e... }': () +[106; 112) '(e, f)': ([unknown], [unknown]) +[107; 108) 'e': [unknown] +[110; 111) 'f': [unknown] +[116; 125) 'some_iter': [unknown] +[126; 152) '{ ... }': () +[140; 141) 'g': [unknown] +[144; 145) 'e': [unknown] +[158; 205) 'if let... }': () +[165; 170) '[val]': [unknown] +[173; 176) 'opt': [unknown] +[177; 205) '{ ... }': () +[191; 192) 'h': [unknown] +[195; 198) 'val': [unknown] +[215; 221) 'lambda': [unknown] +[224; 256) '|a: u6...b; c }': [unknown] +[225; 226) 'a': u64 +[233; 234) 'b': u64 +[236; 237) 'c': i32 +[244; 256) '{ a + b; c }': i32 +[246; 247) 'a': u64 +[246; 251) 'a + b': u64 +[250; 251) 'b': u64 +[253; 254) 'c': i32 +[267; 279) 'ref ref_to_x': &&i32 +[282; 283) 'x': &i32 +[293; 302) 'mut mut_x': &i32 +[305; 306) 'x': &i32 +[316; 336) 'ref mu...f_to_x': &mut &i32 +[339; 340) 'x': &i32 +[350; 351) 'k': &mut &i32 +[354; 366) 'mut_ref_to_x': &mut &i32 + diff --git a/crates/ra_hir/src/ty/snapshots/tests__infer_refs.snap b/crates/ra_hir/src/ty/snapshots/tests__infer_refs.snap new file mode 100644 index 000000000..fc5bfe677 --- /dev/null +++ b/crates/ra_hir/src/ty/snapshots/tests__infer_refs.snap @@ -0,0 +1,28 @@ +Created: 2019-01-21T21:48:20.674183006+00:00 +Creator: insta@0.1.4 +Source: crates/ra_hir/src/ty/tests.rs + +[9; 10) 'a': &u32 +[18; 19) 'b': &mut u32 +[31; 32) 'c': *const u32 +[46; 47) 'd': *mut u32 +[59; 150) '{ ... *d; }': () +[65; 66) 'a': &u32 +[72; 74) '*a': u32 +[73; 74) 'a': &u32 +[80; 82) '&a': &&u32 +[81; 82) 'a': &u32 +[88; 94) '&mut a': &mut &u32 +[93; 94) 'a': &u32 +[100; 101) 'b': &mut u32 +[107; 109) '*b': u32 +[108; 109) 'b': &mut u32 +[115; 117) '&b': &&mut u32 +[116; 117) 'b': &mut u32 +[123; 124) 'c': *const u32 +[130; 132) '*c': u32 +[131; 132) 'c': *const u32 +[138; 139) 'd': *mut u32 +[145; 147) '*d': u32 +[146; 147) 'd': *mut u32 + diff --git a/crates/ra_hir/src/ty/snapshots/tests__infer_self.snap b/crates/ra_hir/src/ty/snapshots/tests__infer_self.snap new file mode 100644 index 000000000..76cb62055 --- /dev/null +++ b/crates/ra_hir/src/ty/snapshots/tests__infer_self.snap @@ -0,0 +1,11 @@ +Created: 2019-01-21T21:50:17.870325361+00:00 +Creator: insta@0.1.4 +Source: crates/ra_hir/src/ty/tests.rs + +[34; 38) 'self': &S +[40; 61) '{ ... }': () +[50; 54) 'self': &S +[75; 79) 'self': &S +[88; 109) '{ ... }': () +[98; 102) 'self': &S + diff --git a/crates/ra_hir/src/ty/snapshots/tests__infer_struct.snap b/crates/ra_hir/src/ty/snapshots/tests__infer_struct.snap new file mode 100644 index 000000000..0c94d6837 --- /dev/null +++ b/crates/ra_hir/src/ty/snapshots/tests__infer_struct.snap @@ -0,0 +1,21 @@ +Created: 2019-01-21T21:48:20.677495622+00:00 +Creator: insta@0.1.4 +Source: crates/ra_hir/src/ty/tests.rs + +[72; 154) '{ ...a.c; }': () +[82; 83) 'c': [unknown] +[86; 87) 'C': [unknown] +[86; 90) 'C(1)': [unknown] +[88; 89) '1': i32 +[96; 97) 'B': [unknown] +[107; 108) 'a': A +[114; 133) 'A { b:...C(1) }': A +[121; 122) 'B': B +[127; 128) 'C': [unknown] +[127; 131) 'C(1)': C +[129; 130) '1': i32 +[139; 140) 'a': A +[139; 142) 'a.b': B +[148; 149) 'a': A +[148; 151) 'a.c': C + diff --git a/crates/ra_hir/src/ty/snapshots/tests__infer_struct_generics.snap b/crates/ra_hir/src/ty/snapshots/tests__infer_struct_generics.snap new file mode 100644 index 000000000..7cf947d4d --- /dev/null +++ b/crates/ra_hir/src/ty/snapshots/tests__infer_struct_generics.snap @@ -0,0 +1,20 @@ +Created: 2019-01-21T21:48:20.678274444+00:00 +Creator: insta@0.1.4 +Source: crates/ra_hir/src/ty/tests.rs + +[36; 38) 'a1': A +[48; 49) 'i': i32 +[56; 147) '{ ...3.x; }': () +[62; 64) 'a1': A +[62; 66) 'a1.x': u32 +[76; 78) 'a2': A +[81; 91) 'A { x: i }': A +[88; 89) 'i': i32 +[97; 99) 'a2': A +[97; 101) 'a2.x': i32 +[111; 113) 'a3': A +[116; 134) 'A:: +[131; 132) '1': i128 +[140; 142) 'a3': A +[140; 144) 'a3.x': i128 + diff --git a/crates/ra_hir/src/ty/snapshots/tests__infer_tuple.snap b/crates/ra_hir/src/ty/snapshots/tests__infer_tuple.snap new file mode 100644 index 000000000..862644145 --- /dev/null +++ b/crates/ra_hir/src/ty/snapshots/tests__infer_tuple.snap @@ -0,0 +1,32 @@ +Created: 2019-01-21T21:48:20.676903109+00:00 +Creator: insta@0.1.4 +Source: crates/ra_hir/src/ty/tests.rs + +[9; 10) 'x': &str +[18; 19) 'y': isize +[28; 170) '{ ...d"); }': () +[38; 39) 'a': (u32, &str) +[55; 63) '(1, "a")': (u32, &str) +[56; 57) '1': u32 +[59; 62) '"a"': &str +[73; 74) 'b': ((u32, &str), &str) +[77; 83) '(a, x)': ((u32, &str), &str) +[78; 79) 'a': (u32, &str) +[81; 82) 'x': &str +[93; 94) 'c': (isize, &str) +[97; 103) '(y, x)': (isize, &str) +[98; 99) 'y': isize +[101; 102) 'x': &str +[113; 114) 'd': ((isize, &str), &str) +[117; 123) '(c, x)': ((isize, &str), &str) +[118; 119) 'c': (isize, &str) +[121; 122) 'x': &str +[133; 134) 'e': (i32, &str) +[137; 145) '(1, "e")': (i32, &str) +[138; 139) '1': i32 +[141; 144) '"e"': &str +[155; 156) 'f': ((i32, &str), &str) +[159; 167) '(e, "d")': ((i32, &str), &str) +[160; 161) 'e': (i32, &str) +[163; 166) '"d"': &str + diff --git a/crates/ra_hir/src/ty/snapshots/tests__infer_unary_op.snap b/crates/ra_hir/src/ty/snapshots/tests__infer_unary_op.snap new file mode 100644 index 000000000..8906bb9c0 --- /dev/null +++ b/crates/ra_hir/src/ty/snapshots/tests__infer_unary_op.snap @@ -0,0 +1,33 @@ +Created: 2019-01-21T21:48:20.676213204+00:00 +Creator: insta@0.1.4 +Source: crates/ra_hir/src/ty/tests.rs + +[27; 28) 'x': SomeType +[40; 197) '{ ...lo"; }': () +[50; 51) 'b': bool +[54; 59) 'false': bool +[69; 70) 'c': bool +[73; 75) '!b': bool +[74; 75) 'b': bool +[85; 86) 'a': i128 +[89; 92) '100': i128 +[102; 103) 'd': i128 +[112; 114) '-a': i128 +[113; 114) 'a': i128 +[124; 125) 'e': i32 +[128; 132) '-100': i32 +[129; 132) '100': i32 +[142; 143) 'f': bool +[146; 153) '!!!true': bool +[147; 153) '!!true': bool +[148; 153) '!true': bool +[149; 153) 'true': bool +[159; 164) '-3.14': f64 +[160; 164) '3.14': f64 +[170; 172) '-x': [unknown] +[171; 172) 'x': SomeType +[178; 180) '!x': [unknown] +[179; 180) 'x': SomeType +[186; 194) '-"hello"': [unknown] +[187; 194) '"hello"': &str + diff --git a/crates/ra_hir/src/ty/snapshots/tests__no_panic_on_field_of_enum.snap b/crates/ra_hir/src/ty/snapshots/tests__no_panic_on_field_of_enum.snap new file mode 100644 index 000000000..024fbf929 --- /dev/null +++ b/crates/ra_hir/src/ty/snapshots/tests__no_panic_on_field_of_enum.snap @@ -0,0 +1,9 @@ +Created: 2019-01-21T21:48:20.676654355+00:00 +Creator: insta@0.1.4 +Source: crates/ra_hir/src/ty/tests.rs + +[20; 21) 'x': X +[26; 47) '{ ...eld; }': () +[32; 33) 'x': X +[32; 44) 'x.some_field': [unknown] + diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs index dc9b626dc..9bf1fd3b2 100644 --- a/crates/ra_hir/src/ty/tests.rs +++ b/crates/ra_hir/src/ty/tests.rs @@ -1,11 +1,8 @@ use std::sync::Arc; use std::fmt::Write; -use std::path::{PathBuf, Path}; -use std::fs; use ra_db::{SyntaxDatabase, salsa::Database}; use ra_syntax::ast::{self, AstNode}; -use test_utils::{project_dir, assert_eq_text, read_text}; use crate::{ source_binder, @@ -13,14 +10,13 @@ use crate::{ }; // These tests compare the inference results for all expressions in a file -// against snapshots of the expected results. If you change something and these -// tests fail expectedly, you can update the comparison files by deleting them -// and running the tests again. Similarly, to add a new test, just write the -// test here in the same pattern and it will automatically write the snapshot. +// against snapshots of the expected results using insta. Run the tests with +// INSTA_UPDATE=1 to update the snapshots. #[test] fn infer_basics() { check_inference( + "infer_basics", r#" fn test(a: u32, b: isize, c: !, d: &str) { a; @@ -32,13 +28,13 @@ fn test(a: u32, b: isize, c: !, d: &str) { "test"; 1.0f32; }"#, - "basics.txt", ); } #[test] fn infer_let() { check_inference( + "infer_let", r#" fn test() { let a = 1isize; @@ -46,13 +42,13 @@ fn test() { let c = b; } }"#, - "let.txt", ); } #[test] fn infer_paths() { check_inference( + "infer_paths", r#" fn a() -> u32 { 1 } @@ -65,13 +61,13 @@ fn test() { b::c(); } }"#, - "paths.txt", ); } #[test] fn infer_struct() { check_inference( + "infer_struct", r#" struct A { b: B, @@ -88,13 +84,13 @@ fn test() { a.c; } "#, - "struct.txt", ); } #[test] fn infer_enum() { check_inference( + "infer_enum", r#" enum E { V1 { field: u32 }, @@ -104,13 +100,13 @@ fn test() { E::V1 { field: 1 }; E::V2; }"#, - "enum.txt", ); } #[test] fn infer_refs() { check_inference( + "infer_refs", r#" fn test(a: &u32, b: &mut u32, c: *const u32, d: *mut u32) { a; @@ -126,13 +122,13 @@ fn test(a: &u32, b: &mut u32, c: *const u32, d: *mut u32) { *d; } "#, - "refs_and_ptrs.txt", ); } #[test] fn infer_literals() { check_inference( + "infer_literals", r##" fn test() { 5i32; @@ -152,13 +148,13 @@ fn test() { br#"yolo"#; } "##, - "literals.txt", ); } #[test] fn infer_unary_op() { check_inference( + "infer_unary_op", r#" enum SomeType {} @@ -175,13 +171,13 @@ fn test(x: SomeType) { -"hello"; } "#, - "unary_op.txt", ); } #[test] fn infer_backwards() { check_inference( + "infer_backwards", r#" fn takes_u32(x: u32) {} @@ -196,13 +192,13 @@ fn test() -> &mut &f64 { &mut &c } "#, - "backwards.txt", ); } #[test] fn infer_self() { check_inference( + "infer_self", r#" struct S; @@ -215,13 +211,13 @@ impl S { } } "#, - "self.txt", ); } #[test] fn infer_binary_op() { check_inference( + "infer_binary_op", r#" fn f(x: bool) -> i32 { 0i32 @@ -242,13 +238,13 @@ fn test() -> bool { ten < 3 } "#, - "binary_op.txt", ); } #[test] fn infer_field_autoderef() { check_inference( + "infer_field_autoderef", r#" struct A { b: B, @@ -273,25 +269,25 @@ fn test2(a1: *const A, a2: *mut A) { a2.b; } "#, - "field_autoderef.txt", ); } #[test] -fn infer_bug_484() { +fn bug_484() { check_inference( + "bug_484", r#" fn test() { let x = if true {}; } "#, - "bug_484.txt", ); } #[test] fn infer_inherent_method() { check_inference( + "infer_inherent_method", r#" struct A; @@ -311,13 +307,13 @@ fn test(a: A) { a.bar(1); } "#, - "inherent_method.txt", ); } #[test] fn infer_tuple() { check_inference( + "infer_tuple", r#" fn test(x: &str, y: isize) { let a: (u32, &str) = (1, "a"); @@ -328,13 +324,13 @@ fn test(x: &str, y: isize) { let f = (e, "d"); } "#, - "tuple.txt", ); } #[test] fn infer_array() { check_inference( + "infer_array", r#" fn test(x: &str, y: isize) { let a = [x]; @@ -354,13 +350,13 @@ fn test(x: &str, y: isize) { let x: [u8; 0] = []; } "#, - "array.txt", ); } #[test] fn infer_pattern() { check_inference( + "infer_pattern", r#" fn test(x: &i32) { let y = x; @@ -384,13 +380,13 @@ fn test(x: &i32) { let k = mut_ref_to_x; } "#, - "pattern.txt", ); } #[test] fn infer_adt_pattern() { check_inference( + "infer_adt_pattern", r#" enum E { A { x: usize }, @@ -414,13 +410,13 @@ fn test() { d; } "#, - "adt_pattern.txt", ); } #[test] fn infer_struct_generics() { check_inference( + "infer_struct_generics", r#" struct A { x: T, @@ -434,13 +430,13 @@ fn test(a1: A, i: i32) { a3.x; } "#, - "struct_generics.txt", ); } #[test] fn infer_generics_in_patterns() { check_inference( + "infer_generics_in_patterns", r#" struct A { x: T, @@ -460,13 +456,13 @@ fn test(a1: A, o: Option) { }; } "#, - "generics_in_patterns.txt", ); } #[test] fn infer_function_generics() { check_inference( + "infer_function_generics", r#" fn id(t: T) -> T { t } @@ -476,13 +472,13 @@ fn test() { let x: u64 = id(1); } "#, - "function_generics.txt", ); } #[test] fn infer_generic_chain() { check_inference( + "infer_generic_chain", r#" struct A { x: T, @@ -503,13 +499,13 @@ fn test() -> i128 { b.x() } "#, - "generic_chain.txt", ); } #[test] fn no_panic_on_field_of_enum() { check_inference( + "no_panic_on_field_of_enum", r#" enum X {} @@ -517,13 +513,13 @@ fn test(x: X) { x.some_field; } "#, - "no_panic_on_field_of_enum.txt", ); } #[test] fn bug_585() { check_inference( + "bug_585", r#" fn test() { X {}; @@ -533,7 +529,6 @@ fn test() { } } "#, - "bug_585.txt", ); } @@ -581,19 +576,10 @@ fn infer(content: &str) -> String { acc } -fn check_inference(content: &str, data_file: impl AsRef) { - let data_file_path = test_data_dir().join(data_file); +fn check_inference(name: &str, content: &str) { let result = infer(content); - if !data_file_path.exists() { - println!("File with expected result doesn't exist, creating...\n"); - println!("{}\n{}", content, result); - fs::write(&data_file_path, &result).unwrap(); - panic!("File {:?} with expected result was created", data_file_path); - } - - let expected = read_text(&data_file_path); - assert_eq_text!(&expected, &result); + insta::assert_snapshot_matches!(&name, &result); } fn ellipsize(mut text: String, max_len: usize) -> String { @@ -614,10 +600,6 @@ fn ellipsize(mut text: String, max_len: usize) -> String { text } -fn test_data_dir() -> PathBuf { - project_dir().join("crates/ra_hir/src/ty/tests/data") -} - #[test] fn typing_whitespace_inside_a_function_should_not_invalidate_types() { let (mut db, pos) = MockDatabase::with_position( diff --git a/crates/ra_hir/src/ty/tests/data/adt_pattern.txt b/crates/ra_hir/src/ty/tests/data/adt_pattern.txt deleted file mode 100644 index 2daf9647b..000000000 --- a/crates/ra_hir/src/ty/tests/data/adt_pattern.txt +++ /dev/null @@ -1,22 +0,0 @@ -[68; 262) '{ ... d; }': () -[78; 79) 'e': E -[82; 95) 'E::A { x: 3 }': E -[92; 93) '3': usize -[106; 113) 'S(y, z)': S -[108; 109) 'y': u32 -[111; 112) 'z': E -[116; 119) 'foo': S -[129; 148) 'E::A {..._var }': E -[139; 146) 'new_var': usize -[151; 152) 'e': E -[159; 218) 'match ... }': usize -[165; 166) 'e': E -[177; 187) 'E::A { x }': E -[184; 185) 'x': usize -[191; 192) 'x': usize -[202; 206) 'E::B': E -[210; 211) '1': usize -[229; 248) 'ref d ...{ .. }': &E -[237; 248) 'E::A { .. }': E -[251; 252) 'e': E -[258; 259) 'd': &E diff --git a/crates/ra_hir/src/ty/tests/data/array.txt b/crates/ra_hir/src/ty/tests/data/array.txt deleted file mode 100644 index acdf74ba4..000000000 --- a/crates/ra_hir/src/ty/tests/data/array.txt +++ /dev/null @@ -1,52 +0,0 @@ -[9; 10) 'x': &str -[18; 19) 'y': isize -[28; 293) '{ ... []; }': () -[38; 39) 'a': [&str] -[42; 45) '[x]': [&str] -[43; 44) 'x': &str -[55; 56) 'b': [[&str]] -[59; 65) '[a, a]': [[&str]] -[60; 61) 'a': [&str] -[63; 64) 'a': [&str] -[75; 76) 'c': [[[&str]]] -[79; 85) '[b, b]': [[[&str]]] -[80; 81) 'b': [[&str]] -[83; 84) 'b': [[&str]] -[96; 97) 'd': [isize] -[100; 112) '[y, 1, 2, 3]': [isize] -[101; 102) 'y': isize -[104; 105) '1': isize -[107; 108) '2': isize -[110; 111) '3': isize -[122; 123) 'd': [isize] -[126; 138) '[1, y, 2, 3]': [isize] -[127; 128) '1': isize -[130; 131) 'y': isize -[133; 134) '2': isize -[136; 137) '3': isize -[148; 149) 'e': [isize] -[152; 155) '[y]': [isize] -[153; 154) 'y': isize -[165; 166) 'f': [[isize]] -[169; 175) '[d, d]': [[isize]] -[170; 171) 'd': [isize] -[173; 174) 'd': [isize] -[185; 186) 'g': [[isize]] -[189; 195) '[e, e]': [[isize]] -[190; 191) 'e': [isize] -[193; 194) 'e': [isize] -[206; 207) 'h': [i32] -[210; 216) '[1, 2]': [i32] -[211; 212) '1': i32 -[214; 215) '2': i32 -[226; 227) 'i': [&str] -[230; 240) '["a", "b"]': [&str] -[231; 234) '"a"': &str -[236; 239) '"b"': &str -[251; 252) 'b': [[&str]] -[255; 265) '[a, ["b"]]': [[&str]] -[256; 257) 'a': [&str] -[259; 264) '["b"]': [&str] -[260; 263) '"b"': &str -[275; 276) 'x': [u8] -[288; 290) '[]': [u8] diff --git a/crates/ra_hir/src/ty/tests/data/backwards.txt b/crates/ra_hir/src/ty/tests/data/backwards.txt deleted file mode 100644 index b8593cfd1..000000000 --- a/crates/ra_hir/src/ty/tests/data/backwards.txt +++ /dev/null @@ -1,20 +0,0 @@ -[14; 15) 'x': u32 -[22; 24) '{}': () -[78; 231) '{ ...t &c }': &mut &f64 -[88; 89) 'a': u32 -[92; 108) 'unknow...nction': [unknown] -[92; 110) 'unknow...tion()': u32 -[116; 125) 'takes_u32': fn(u32) -> () -[116; 128) 'takes_u32(a)': () -[126; 127) 'a': u32 -[138; 139) 'b': i32 -[142; 158) 'unknow...nction': [unknown] -[142; 160) 'unknow...tion()': i32 -[166; 184) 'S { i3...d: b }': S -[181; 182) 'b': i32 -[194; 195) 'c': f64 -[198; 214) 'unknow...nction': [unknown] -[198; 216) 'unknow...tion()': f64 -[222; 229) '&mut &c': &mut &f64 -[227; 229) '&c': &f64 -[228; 229) 'c': f64 diff --git a/crates/ra_hir/src/ty/tests/data/basics.txt b/crates/ra_hir/src/ty/tests/data/basics.txt deleted file mode 100644 index e65fe07aa..000000000 --- a/crates/ra_hir/src/ty/tests/data/basics.txt +++ /dev/null @@ -1,13 +0,0 @@ -[9; 10) 'a': u32 -[17; 18) 'b': isize -[27; 28) 'c': ! -[33; 34) 'd': &str -[42; 121) '{ ...f32; }': () -[48; 49) 'a': u32 -[55; 56) 'b': isize -[62; 63) 'c': ! -[69; 70) 'd': &str -[76; 82) '1usize': usize -[88; 94) '1isize': isize -[100; 106) '"test"': &str -[112; 118) '1.0f32': f32 diff --git a/crates/ra_hir/src/ty/tests/data/binary_op.txt b/crates/ra_hir/src/ty/tests/data/binary_op.txt deleted file mode 100644 index 58a727691..000000000 --- a/crates/ra_hir/src/ty/tests/data/binary_op.txt +++ /dev/null @@ -1,46 +0,0 @@ -[6; 7) 'x': bool -[22; 34) '{ 0i32 }': i32 -[28; 32) '0i32': i32 -[54; 350) '{ ... < 3 }': bool -[64; 65) 'x': bool -[68; 69) 'a': bool -[68; 74) 'a && b': bool -[73; 74) 'b': bool -[84; 85) 'y': bool -[88; 92) 'true': bool -[88; 101) 'true || false': bool -[96; 101) 'false': bool -[111; 112) 'z': bool -[115; 116) 'x': bool -[115; 121) 'x == y': bool -[120; 121) 'y': bool -[131; 142) 'minus_forty': isize -[152; 160) '-40isize': isize -[153; 160) '40isize': isize -[170; 171) 'h': bool -[174; 185) 'minus_forty': isize -[174; 196) 'minus_...ONST_2': bool -[189; 196) 'CONST_2': isize -[206; 207) 'c': i32 -[210; 211) 'f': fn(bool) -> i32 -[210; 219) 'f(z || y)': i32 -[210; 223) 'f(z || y) + 5': i32 -[212; 213) 'z': bool -[212; 218) 'z || y': bool -[217; 218) 'y': bool -[222; 223) '5': i32 -[233; 234) 'd': [unknown] -[237; 238) 'b': [unknown] -[248; 249) 'g': () -[252; 263) 'minus_forty': isize -[252; 268) 'minus_...y ^= i': () -[267; 268) 'i': isize -[278; 281) 'ten': usize -[291; 293) '10': usize -[303; 316) 'ten_is_eleven': bool -[319; 322) 'ten': usize -[319; 334) 'ten == some_num': bool -[326; 334) 'some_num': usize -[341; 344) 'ten': usize -[341; 348) 'ten < 3': bool -[347; 348) '3': usize diff --git a/crates/ra_hir/src/ty/tests/data/bug_484.txt b/crates/ra_hir/src/ty/tests/data/bug_484.txt deleted file mode 100644 index 300530551..000000000 --- a/crates/ra_hir/src/ty/tests/data/bug_484.txt +++ /dev/null @@ -1,5 +0,0 @@ -[11; 37) '{ l... {}; }': () -[20; 21) 'x': () -[24; 34) 'if true {}': () -[27; 31) 'true': bool -[32; 34) '{}': () diff --git a/crates/ra_hir/src/ty/tests/data/bug_585.txt b/crates/ra_hir/src/ty/tests/data/bug_585.txt deleted file mode 100644 index 627702a38..000000000 --- a/crates/ra_hir/src/ty/tests/data/bug_585.txt +++ /dev/null @@ -1,8 +0,0 @@ -[11; 89) '{ ... } }': () -[17; 21) 'X {}': [unknown] -[27; 87) 'match ... }': () -[33; 34) 'x': [unknown] -[45; 52) 'A::B {}': [unknown] -[56; 58) '()': () -[68; 74) 'A::Y()': [unknown] -[78; 80) '()': () diff --git a/crates/ra_hir/src/ty/tests/data/enum.txt b/crates/ra_hir/src/ty/tests/data/enum.txt deleted file mode 100644 index 481eb0bc7..000000000 --- a/crates/ra_hir/src/ty/tests/data/enum.txt +++ /dev/null @@ -1,4 +0,0 @@ -[48; 82) '{ E:...:V2; }': () -[52; 70) 'E::V1 ...d: 1 }': E -[67; 68) '1': u32 -[74; 79) 'E::V2': E diff --git a/crates/ra_hir/src/ty/tests/data/field_autoderef.txt b/crates/ra_hir/src/ty/tests/data/field_autoderef.txt deleted file mode 100644 index e1db1db40..000000000 --- a/crates/ra_hir/src/ty/tests/data/field_autoderef.txt +++ /dev/null @@ -1,43 +0,0 @@ -[44; 45) 'a': A -[50; 213) '{ ...5.b; }': () -[60; 62) 'a1': A -[65; 66) 'a': A -[72; 74) 'a1': A -[72; 76) 'a1.b': B -[86; 88) 'a2': &A -[91; 93) '&a': &A -[92; 93) 'a': A -[99; 101) 'a2': &A -[99; 103) 'a2.b': B -[113; 115) 'a3': &mut A -[118; 124) '&mut a': &mut A -[123; 124) 'a': A -[130; 132) 'a3': &mut A -[130; 134) 'a3.b': B -[144; 146) 'a4': &&&&&&&A -[149; 157) '&&&&&&&a': &&&&&&&A -[150; 157) '&&&&&&a': &&&&&&A -[151; 157) '&&&&&a': &&&&&A -[152; 157) '&&&&a': &&&&A -[153; 157) '&&&a': &&&A -[154; 157) '&&a': &&A -[155; 157) '&a': &A -[156; 157) 'a': A -[163; 165) 'a4': &&&&&&&A -[163; 167) 'a4.b': B -[177; 179) 'a5': &mut &&mut &&mut A -[182; 200) '&mut &...&mut a': &mut &&mut &&mut A -[187; 200) '&&mut &&mut a': &&mut &&mut A -[188; 200) '&mut &&mut a': &mut &&mut A -[193; 200) '&&mut a': &&mut A -[194; 200) '&mut a': &mut A -[199; 200) 'a': A -[206; 208) 'a5': &mut &&mut &&mut A -[206; 210) 'a5.b': B -[224; 226) 'a1': *const A -[238; 240) 'a2': *mut A -[250; 273) '{ ...2.b; }': () -[256; 258) 'a1': *const A -[256; 260) 'a1.b': B -[266; 268) 'a2': *mut A -[266; 270) 'a2.b': B diff --git a/crates/ra_hir/src/ty/tests/data/function_generics.txt b/crates/ra_hir/src/ty/tests/data/function_generics.txt deleted file mode 100644 index e44d26cfd..000000000 --- a/crates/ra_hir/src/ty/tests/data/function_generics.txt +++ /dev/null @@ -1,14 +0,0 @@ -[10; 11) 't': [unknown] -[21; 26) '{ t }': [unknown] -[23; 24) 't': [unknown] -[38; 98) '{ ...(1); }': () -[44; 46) 'id': fn(T) -> T -[44; 52) 'id(1u32)': T -[47; 51) '1u32': u32 -[58; 68) 'id::': fn(T) -> T -[58; 71) 'id::(1)': T -[69; 70) '1': T -[81; 82) 'x': T -[90; 92) 'id': fn(T) -> T -[90; 95) 'id(1)': T -[93; 94) '1': T diff --git a/crates/ra_hir/src/ty/tests/data/generic_chain.txt b/crates/ra_hir/src/ty/tests/data/generic_chain.txt deleted file mode 100644 index 568e00846..000000000 --- a/crates/ra_hir/src/ty/tests/data/generic_chain.txt +++ /dev/null @@ -1,29 +0,0 @@ -[53; 57) 'self': A<[unknown]> -[65; 87) '{ ... }': [unknown] -[75; 79) 'self': A<[unknown]> -[75; 81) 'self.x': [unknown] -[99; 100) 't': [unknown] -[110; 115) '{ t }': [unknown] -[112; 113) 't': [unknown] -[135; 261) '{ ....x() }': i128 -[146; 147) 'x': T -[150; 151) '1': T -[162; 163) 'y': T -[166; 168) 'id': fn(T) -> T -[166; 171) 'id(x)': T -[169; 170) 'x': T -[182; 183) 'a': A -[186; 200) 'A { x: id(y) }': A -[193; 195) 'id': fn(T) -> T -[193; 198) 'id(y)': T -[196; 197) 'y': T -[211; 212) 'z': T -[215; 217) 'id': fn(T) -> T -[215; 222) 'id(a.x)': T -[218; 219) 'a': A -[218; 221) 'a.x': T -[233; 234) 'b': A -[237; 247) 'A { x: z }': A -[244; 245) 'z': T -[254; 255) 'b': A -[254; 259) 'b.x()': i128 diff --git a/crates/ra_hir/src/ty/tests/data/generics_in_patterns.txt b/crates/ra_hir/src/ty/tests/data/generics_in_patterns.txt deleted file mode 100644 index 1b01ef19e..000000000 --- a/crates/ra_hir/src/ty/tests/data/generics_in_patterns.txt +++ /dev/null @@ -1,17 +0,0 @@ -[79; 81) 'a1': A -[91; 92) 'o': Option -[107; 244) '{ ... }; }': () -[117; 128) 'A { x: x2 }': A -[124; 126) 'x2': u32 -[131; 133) 'a1': A -[143; 161) 'A:: -[157; 159) 'x3': i64 -[164; 174) 'A { x: 1 }': A -[171; 172) '1': i64 -[180; 241) 'match ... }': u64 -[186; 187) 'o': Option -[198; 213) 'Option::Some(t)': Option -[211; 212) 't': u64 -[217; 218) 't': u64 -[228; 229) '_': Option -[233; 234) '1': u64 diff --git a/crates/ra_hir/src/ty/tests/data/inherent_method.txt b/crates/ra_hir/src/ty/tests/data/inherent_method.txt deleted file mode 100644 index 6e6f70357..000000000 --- a/crates/ra_hir/src/ty/tests/data/inherent_method.txt +++ /dev/null @@ -1,18 +0,0 @@ -[32; 36) 'self': A -[38; 39) 'x': u32 -[53; 55) '{}': () -[103; 107) 'self': &A -[109; 110) 'x': u64 -[124; 126) '{}': () -[144; 145) 'a': A -[150; 198) '{ ...(1); }': () -[156; 157) 'a': A -[156; 164) 'a.foo(1)': i32 -[162; 163) '1': u32 -[170; 181) '(&a).bar(1)': i64 -[171; 173) '&a': &A -[172; 173) 'a': A -[179; 180) '1': u64 -[187; 188) 'a': A -[187; 195) 'a.bar(1)': i64 -[193; 194) '1': u64 diff --git a/crates/ra_hir/src/ty/tests/data/let.txt b/crates/ra_hir/src/ty/tests/data/let.txt deleted file mode 100644 index 8815dba41..000000000 --- a/crates/ra_hir/src/ty/tests/data/let.txt +++ /dev/null @@ -1,7 +0,0 @@ -[11; 71) '{ ...= b; }': () -[21; 22) 'a': isize -[25; 31) '1isize': isize -[41; 42) 'b': usize -[52; 53) '1': usize -[63; 64) 'c': usize -[67; 68) 'b': usize diff --git a/crates/ra_hir/src/ty/tests/data/literals.txt b/crates/ra_hir/src/ty/tests/data/literals.txt deleted file mode 100644 index 84ee2c11b..000000000 --- a/crates/ra_hir/src/ty/tests/data/literals.txt +++ /dev/null @@ -1,12 +0,0 @@ -[11; 201) '{ ...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] diff --git a/crates/ra_hir/src/ty/tests/data/no_panic_on_field_of_enum.txt b/crates/ra_hir/src/ty/tests/data/no_panic_on_field_of_enum.txt deleted file mode 100644 index 4dca0b7f4..000000000 --- a/crates/ra_hir/src/ty/tests/data/no_panic_on_field_of_enum.txt +++ /dev/null @@ -1,4 +0,0 @@ -[20; 21) 'x': X -[26; 47) '{ ...eld; }': () -[32; 33) 'x': X -[32; 44) 'x.some_field': [unknown] diff --git a/crates/ra_hir/src/ty/tests/data/paths.txt b/crates/ra_hir/src/ty/tests/data/paths.txt deleted file mode 100644 index b22f4d4a5..000000000 --- a/crates/ra_hir/src/ty/tests/data/paths.txt +++ /dev/null @@ -1,9 +0,0 @@ -[15; 20) '{ 1 }': u32 -[17; 18) '1': u32 -[48; 53) '{ 1 }': u32 -[50; 51) '1': u32 -[67; 91) '{ ...c(); }': () -[73; 74) 'a': fn() -> u32 -[73; 76) 'a()': u32 -[82; 86) 'b::c': fn() -> u32 -[82; 88) 'b::c()': u32 diff --git a/crates/ra_hir/src/ty/tests/data/pattern.txt b/crates/ra_hir/src/ty/tests/data/pattern.txt deleted file mode 100644 index 966289aaf..000000000 --- a/crates/ra_hir/src/ty/tests/data/pattern.txt +++ /dev/null @@ -1,47 +0,0 @@ -[9; 10) 'x': &i32 -[18; 369) '{ ...o_x; }': () -[28; 29) 'y': &i32 -[32; 33) 'x': &i32 -[43; 45) '&z': &i32 -[44; 45) 'z': i32 -[48; 49) 'x': &i32 -[59; 60) 'a': i32 -[63; 64) 'z': i32 -[74; 80) '(c, d)': (i32, &str) -[75; 76) 'c': i32 -[78; 79) 'd': &str -[83; 95) '(1, "hello")': (i32, &str) -[84; 85) '1': i32 -[87; 94) '"hello"': &str -[102; 152) 'for (e... }': () -[106; 112) '(e, f)': ([unknown], [unknown]) -[107; 108) 'e': [unknown] -[110; 111) 'f': [unknown] -[116; 125) 'some_iter': [unknown] -[126; 152) '{ ... }': () -[140; 141) 'g': [unknown] -[144; 145) 'e': [unknown] -[158; 205) 'if let... }': () -[165; 170) '[val]': [unknown] -[173; 176) 'opt': [unknown] -[177; 205) '{ ... }': () -[191; 192) 'h': [unknown] -[195; 198) 'val': [unknown] -[215; 221) 'lambda': [unknown] -[224; 256) '|a: u6...b; c }': [unknown] -[225; 226) 'a': u64 -[233; 234) 'b': u64 -[236; 237) 'c': i32 -[244; 256) '{ a + b; c }': i32 -[246; 247) 'a': u64 -[246; 251) 'a + b': u64 -[250; 251) 'b': u64 -[253; 254) 'c': i32 -[267; 279) 'ref ref_to_x': &&i32 -[282; 283) 'x': &i32 -[293; 302) 'mut mut_x': &i32 -[305; 306) 'x': &i32 -[316; 336) 'ref mu...f_to_x': &mut &i32 -[339; 340) 'x': &i32 -[350; 351) 'k': &mut &i32 -[354; 366) 'mut_ref_to_x': &mut &i32 diff --git a/crates/ra_hir/src/ty/tests/data/refs_and_ptrs.txt b/crates/ra_hir/src/ty/tests/data/refs_and_ptrs.txt deleted file mode 100644 index afab343ea..000000000 --- a/crates/ra_hir/src/ty/tests/data/refs_and_ptrs.txt +++ /dev/null @@ -1,23 +0,0 @@ -[9; 10) 'a': &u32 -[18; 19) 'b': &mut u32 -[31; 32) 'c': *const u32 -[46; 47) 'd': *mut u32 -[59; 150) '{ ... *d; }': () -[65; 66) 'a': &u32 -[72; 74) '*a': u32 -[73; 74) 'a': &u32 -[80; 82) '&a': &&u32 -[81; 82) 'a': &u32 -[88; 94) '&mut a': &mut &u32 -[93; 94) 'a': &u32 -[100; 101) 'b': &mut u32 -[107; 109) '*b': u32 -[108; 109) 'b': &mut u32 -[115; 117) '&b': &&mut u32 -[116; 117) 'b': &mut u32 -[123; 124) 'c': *const u32 -[130; 132) '*c': u32 -[131; 132) 'c': *const u32 -[138; 139) 'd': *mut u32 -[145; 147) '*d': u32 -[146; 147) 'd': *mut u32 diff --git a/crates/ra_hir/src/ty/tests/data/self.txt b/crates/ra_hir/src/ty/tests/data/self.txt deleted file mode 100644 index c38029f97..000000000 --- a/crates/ra_hir/src/ty/tests/data/self.txt +++ /dev/null @@ -1,6 +0,0 @@ -[34; 38) 'self': &S -[40; 61) '{ ... }': () -[50; 54) 'self': &S -[75; 79) 'self': &S -[88; 109) '{ ... }': () -[98; 102) 'self': &S diff --git a/crates/ra_hir/src/ty/tests/data/struct.txt b/crates/ra_hir/src/ty/tests/data/struct.txt deleted file mode 100644 index be9e12d02..000000000 --- a/crates/ra_hir/src/ty/tests/data/struct.txt +++ /dev/null @@ -1,16 +0,0 @@ -[72; 154) '{ ...a.c; }': () -[82; 83) 'c': [unknown] -[86; 87) 'C': [unknown] -[86; 90) 'C(1)': [unknown] -[88; 89) '1': i32 -[96; 97) 'B': [unknown] -[107; 108) 'a': A -[114; 133) 'A { b:...C(1) }': A -[121; 122) 'B': B -[127; 128) 'C': [unknown] -[127; 131) 'C(1)': C -[129; 130) '1': i32 -[139; 140) 'a': A -[139; 142) 'a.b': B -[148; 149) 'a': A -[148; 151) 'a.c': C diff --git a/crates/ra_hir/src/ty/tests/data/struct_generics.txt b/crates/ra_hir/src/ty/tests/data/struct_generics.txt deleted file mode 100644 index 1024a39a9..000000000 --- a/crates/ra_hir/src/ty/tests/data/struct_generics.txt +++ /dev/null @@ -1,15 +0,0 @@ -[36; 38) 'a1': A -[48; 49) 'i': i32 -[56; 147) '{ ...3.x; }': () -[62; 64) 'a1': A -[62; 66) 'a1.x': u32 -[76; 78) 'a2': A -[81; 91) 'A { x: i }': A -[88; 89) 'i': i32 -[97; 99) 'a2': A -[97; 101) 'a2.x': i32 -[111; 113) 'a3': A -[116; 134) 'A:: -[131; 132) '1': i128 -[140; 142) 'a3': A -[140; 144) 'a3.x': i128 diff --git a/crates/ra_hir/src/ty/tests/data/tuple.txt b/crates/ra_hir/src/ty/tests/data/tuple.txt deleted file mode 100644 index a95d3c286..000000000 --- a/crates/ra_hir/src/ty/tests/data/tuple.txt +++ /dev/null @@ -1,27 +0,0 @@ -[9; 10) 'x': &str -[18; 19) 'y': isize -[28; 170) '{ ...d"); }': () -[38; 39) 'a': (u32, &str) -[55; 63) '(1, "a")': (u32, &str) -[56; 57) '1': u32 -[59; 62) '"a"': &str -[73; 74) 'b': ((u32, &str), &str) -[77; 83) '(a, x)': ((u32, &str), &str) -[78; 79) 'a': (u32, &str) -[81; 82) 'x': &str -[93; 94) 'c': (isize, &str) -[97; 103) '(y, x)': (isize, &str) -[98; 99) 'y': isize -[101; 102) 'x': &str -[113; 114) 'd': ((isize, &str), &str) -[117; 123) '(c, x)': ((isize, &str), &str) -[118; 119) 'c': (isize, &str) -[121; 122) 'x': &str -[133; 134) 'e': (i32, &str) -[137; 145) '(1, "e")': (i32, &str) -[138; 139) '1': i32 -[141; 144) '"e"': &str -[155; 156) 'f': ((i32, &str), &str) -[159; 167) '(e, "d")': ((i32, &str), &str) -[160; 161) 'e': (i32, &str) -[163; 166) '"d"': &str diff --git a/crates/ra_hir/src/ty/tests/data/unary_op.txt b/crates/ra_hir/src/ty/tests/data/unary_op.txt deleted file mode 100644 index 203022e82..000000000 --- a/crates/ra_hir/src/ty/tests/data/unary_op.txt +++ /dev/null @@ -1,28 +0,0 @@ -[27; 28) 'x': SomeType -[40; 197) '{ ...lo"; }': () -[50; 51) 'b': bool -[54; 59) 'false': bool -[69; 70) 'c': bool -[73; 75) '!b': bool -[74; 75) 'b': bool -[85; 86) 'a': i128 -[89; 92) '100': i128 -[102; 103) 'd': i128 -[112; 114) '-a': i128 -[113; 114) 'a': i128 -[124; 125) 'e': i32 -[128; 132) '-100': i32 -[129; 132) '100': i32 -[142; 143) 'f': bool -[146; 153) '!!!true': bool -[147; 153) '!!true': bool -[148; 153) '!true': bool -[149; 153) 'true': bool -[159; 164) '-3.14': f64 -[160; 164) '3.14': f64 -[170; 172) '-x': [unknown] -[171; 172) 'x': SomeType -[178; 180) '!x': [unknown] -[179; 180) 'x': SomeType -[186; 194) '-"hello"': [unknown] -[187; 194) '"hello"': &str -- cgit v1.2.3