Update ide tests

This commit is contained in:
Lukas Wirth 2024-09-03 13:22:37 +02:00
parent bbaeeb8262
commit e9da1dce05
8 changed files with 197 additions and 196 deletions

View File

@ -1095,6 +1095,7 @@ fn main() {
#[test]
fn field_enum_cross_file() {
// FIXME: The import is missing
check_assist(
bool_to_enum,
r#"
@ -1132,7 +1133,7 @@ fn foo() {
}
//- /main.rs
use foo::{Bool, Foo};
use foo::Foo;
mod foo;

View File

@ -1853,8 +1853,8 @@ fn f() { A { bar: b$0 }; }
expect![[r#"
fn bar() [type+name]
fn baz() [type]
ex baz() [type]
ex bar() [type]
ex baz() [type]
st A []
fn f() []
"#]],

View File

@ -286,6 +286,20 @@ fn main() {
),
},
},
Annotation {
range: 53..57,
kind: HasReferences {
pos: FilePositionWrapper {
file_id: FileId(
0,
),
offset: 53,
},
data: Some(
[],
),
},
},
Annotation {
range: 53..57,
kind: Runnable(
@ -305,20 +319,6 @@ fn main() {
},
),
},
Annotation {
range: 53..57,
kind: HasReferences {
pos: FilePositionWrapper {
file_id: FileId(
0,
),
offset: 53,
},
data: Some(
[],
),
},
},
]
"#]],
);
@ -336,6 +336,20 @@ fn main() {
"#,
expect![[r#"
[
Annotation {
range: 7..11,
kind: HasImpls {
pos: FilePositionWrapper {
file_id: FileId(
0,
),
offset: 7,
},
data: Some(
[],
),
},
},
Annotation {
range: 7..11,
kind: HasReferences {
@ -358,13 +372,13 @@ fn main() {
},
},
Annotation {
range: 7..11,
kind: HasImpls {
range: 17..21,
kind: HasReferences {
pos: FilePositionWrapper {
file_id: FileId(
0,
),
offset: 7,
offset: 17,
},
data: Some(
[],
@ -390,20 +404,6 @@ fn main() {
},
),
},
Annotation {
range: 17..21,
kind: HasReferences {
pos: FilePositionWrapper {
file_id: FileId(
0,
),
offset: 17,
},
data: Some(
[],
),
},
},
]
"#]],
);
@ -425,6 +425,30 @@ fn main() {
"#,
expect![[r#"
[
Annotation {
range: 7..11,
kind: HasImpls {
pos: FilePositionWrapper {
file_id: FileId(
0,
),
offset: 7,
},
data: Some(
[
NavigationTarget {
file_id: FileId(
0,
),
full_range: 36..64,
focus_range: 57..61,
name: "impl",
kind: Impl,
},
],
),
},
},
Annotation {
range: 7..11,
kind: HasReferences {
@ -452,30 +476,6 @@ fn main() {
),
},
},
Annotation {
range: 7..11,
kind: HasImpls {
pos: FilePositionWrapper {
file_id: FileId(
0,
),
offset: 7,
},
data: Some(
[
NavigationTarget {
file_id: FileId(
0,
),
full_range: 36..64,
focus_range: 57..61,
name: "impl",
kind: Impl,
},
],
),
},
},
Annotation {
range: 20..31,
kind: HasImpls {
@ -521,20 +521,6 @@ fn main() {
),
},
},
Annotation {
range: 69..73,
kind: HasReferences {
pos: FilePositionWrapper {
file_id: FileId(
0,
),
offset: 69,
},
data: Some(
[],
),
},
},
Annotation {
range: 69..73,
kind: Runnable(
@ -554,6 +540,20 @@ fn main() {
},
),
},
Annotation {
range: 69..73,
kind: HasReferences {
pos: FilePositionWrapper {
file_id: FileId(
0,
),
offset: 69,
},
data: Some(
[],
),
},
},
]
"#]],
);
@ -567,6 +567,20 @@ fn main() {}
"#,
expect![[r#"
[
Annotation {
range: 3..7,
kind: HasReferences {
pos: FilePositionWrapper {
file_id: FileId(
0,
),
offset: 3,
},
data: Some(
[],
),
},
},
Annotation {
range: 3..7,
kind: Runnable(
@ -586,20 +600,6 @@ fn main() {}
},
),
},
Annotation {
range: 3..7,
kind: HasReferences {
pos: FilePositionWrapper {
file_id: FileId(
0,
),
offset: 3,
},
data: Some(
[],
),
},
},
]
"#]],
);
@ -621,6 +621,30 @@ fn main() {
"#,
expect![[r#"
[
Annotation {
range: 7..11,
kind: HasImpls {
pos: FilePositionWrapper {
file_id: FileId(
0,
),
offset: 7,
},
data: Some(
[
NavigationTarget {
file_id: FileId(
0,
),
full_range: 14..56,
focus_range: 19..23,
name: "impl",
kind: Impl,
},
],
),
},
},
Annotation {
range: 7..11,
kind: HasReferences {
@ -648,30 +672,6 @@ fn main() {
),
},
},
Annotation {
range: 7..11,
kind: HasImpls {
pos: FilePositionWrapper {
file_id: FileId(
0,
),
offset: 7,
},
data: Some(
[
NavigationTarget {
file_id: FileId(
0,
),
full_range: 14..56,
focus_range: 19..23,
name: "impl",
kind: Impl,
},
],
),
},
},
Annotation {
range: 33..44,
kind: HasReferences {
@ -693,20 +693,6 @@ fn main() {
),
},
},
Annotation {
range: 61..65,
kind: HasReferences {
pos: FilePositionWrapper {
file_id: FileId(
0,
),
offset: 61,
},
data: Some(
[],
),
},
},
Annotation {
range: 61..65,
kind: Runnable(
@ -726,6 +712,20 @@ fn main() {
},
),
},
Annotation {
range: 61..65,
kind: HasReferences {
pos: FilePositionWrapper {
file_id: FileId(
0,
),
offset: 61,
},
data: Some(
[],
),
},
},
]
"#]],
);
@ -744,20 +744,6 @@ mod tests {
"#,
expect![[r#"
[
Annotation {
range: 3..7,
kind: HasReferences {
pos: FilePositionWrapper {
file_id: FileId(
0,
),
offset: 3,
},
data: Some(
[],
),
},
},
Annotation {
range: 3..7,
kind: Runnable(
@ -777,6 +763,20 @@ mod tests {
},
),
},
Annotation {
range: 3..7,
kind: HasReferences {
pos: FilePositionWrapper {
file_id: FileId(
0,
),
offset: 3,
},
data: Some(
[],
),
},
},
Annotation {
range: 18..23,
kind: Runnable(
@ -876,7 +876,7 @@ struct Foo;
[
Annotation {
range: 0..71,
kind: HasReferences {
kind: HasImpls {
pos: FilePositionWrapper {
file_id: FileId(
0,
@ -890,7 +890,7 @@ struct Foo;
},
Annotation {
range: 0..71,
kind: HasImpls {
kind: HasReferences {
pos: FilePositionWrapper {
file_id: FileId(
0,

View File

@ -1350,18 +1350,18 @@ mod tests {
file_id: FileId(
0,
),
full_range: 121..185,
focus_range: 136..145,
name: "foo2_test",
full_range: 52..115,
focus_range: 67..75,
name: "foo_test",
kind: Function,
},
NavigationTarget {
file_id: FileId(
0,
),
full_range: 52..115,
focus_range: 67..75,
name: "foo_test",
full_range: 121..185,
focus_range: 136..145,
name: "foo2_test",
kind: Function,
},
]

View File

@ -46,14 +46,14 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
.unresolved_reference { color: #FC5555; text-decoration: wavy underline; }
</style>
<pre><code><span class="keyword">fn</span> <span class="function declaration">main</span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="brace">{</span>
<span class="keyword">let</span> <span class="variable declaration reference" data-binding-hash="8384512769119783714" style="color: hsl(59,93%,58%);">hello</span> <span class="operator">=</span> <span class="string_literal">"hello"</span><span class="semicolon">;</span>
<span class="keyword">let</span> <span class="variable declaration" data-binding-hash="17360984456076382725" style="color: hsl(95,79%,86%);">x</span> <span class="operator">=</span> <span class="variable reference" data-binding-hash="8384512769119783714" style="color: hsl(59,93%,58%);">hello</span><span class="operator">.</span><span class="unresolved_reference">to_string</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="semicolon">;</span>
<span class="keyword">let</span> <span class="variable declaration" data-binding-hash="17186414787327620935" style="color: hsl(196,64%,89%);">y</span> <span class="operator">=</span> <span class="variable reference" data-binding-hash="8384512769119783714" style="color: hsl(59,93%,58%);">hello</span><span class="operator">.</span><span class="unresolved_reference">to_string</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="semicolon">;</span>
<span class="keyword">let</span> <span class="variable declaration reference" data-binding-hash="16711699953829236520" style="color: hsl(345,54%,46%);">hello</span> <span class="operator">=</span> <span class="string_literal">"hello"</span><span class="semicolon">;</span>
<span class="keyword">let</span> <span class="variable declaration" data-binding-hash="10753541418856619067" style="color: hsl(51,52%,47%);">x</span> <span class="operator">=</span> <span class="variable reference" data-binding-hash="16711699953829236520" style="color: hsl(345,54%,46%);">hello</span><span class="operator">.</span><span class="unresolved_reference">to_string</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="semicolon">;</span>
<span class="keyword">let</span> <span class="variable declaration" data-binding-hash="9865812862466303869" style="color: hsl(329,86%,55%);">y</span> <span class="operator">=</span> <span class="variable reference" data-binding-hash="16711699953829236520" style="color: hsl(345,54%,46%);">hello</span><span class="operator">.</span><span class="unresolved_reference">to_string</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="semicolon">;</span>
<span class="keyword">let</span> <span class="variable declaration reference" data-binding-hash="4786021388930833562" style="color: hsl(137,61%,87%);">x</span> <span class="operator">=</span> <span class="string_literal">"other color please!"</span><span class="semicolon">;</span>
<span class="keyword">let</span> <span class="variable declaration" data-binding-hash="18017815841345165192" style="color: hsl(39,76%,89%);">y</span> <span class="operator">=</span> <span class="variable reference" data-binding-hash="4786021388930833562" style="color: hsl(137,61%,87%);">x</span><span class="operator">.</span><span class="unresolved_reference">to_string</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="semicolon">;</span>
<span class="keyword">let</span> <span class="variable declaration reference" data-binding-hash="4890670724659097491" style="color: hsl(330,46%,45%);">x</span> <span class="operator">=</span> <span class="string_literal">"other color please!"</span><span class="semicolon">;</span>
<span class="keyword">let</span> <span class="variable declaration" data-binding-hash="4002942168268782293" style="color: hsl(114,87%,67%);">y</span> <span class="operator">=</span> <span class="variable reference" data-binding-hash="4890670724659097491" style="color: hsl(330,46%,45%);">x</span><span class="operator">.</span><span class="unresolved_reference">to_string</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="semicolon">;</span>
<span class="brace">}</span>
<span class="keyword">fn</span> <span class="function declaration">bar</span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="brace">{</span>
<span class="keyword">let</span> <span class="keyword">mut</span> <span class="variable declaration mutable reference" data-binding-hash="8384512769119783714" style="color: hsl(59,93%,58%);">hello</span> <span class="operator">=</span> <span class="string_literal">"hello"</span><span class="semicolon">;</span>
<span class="keyword">let</span> <span class="keyword">mut</span> <span class="variable declaration mutable reference" data-binding-hash="16711699953829236520" style="color: hsl(345,54%,46%);">hello</span> <span class="operator">=</span> <span class="string_literal">"hello"</span><span class="semicolon">;</span>
<span class="brace">}</span></code></pre>

View File

@ -55,7 +55,7 @@ fn benchmark_expand_macro_rules() {
})
.sum()
};
assert_eq!(hash, 69413);
assert_eq!(hash, 76353);
}
fn macro_rules_fixtures() -> FxHashMap<String, DeclarativeMacro> {

View File

@ -95,8 +95,8 @@ avoid checking unnecessary things.
Default:
----
{
"debug_assertions": null,
"miri": null
"miri": null,
"debug_assertions": null
}
----
List of cfg options to enable with the given values.
@ -321,18 +321,10 @@ Enables completions of private items and fields that are defined in the current
Default:
----
{
"Arc::new": {
"postfix": "arc",
"body": "Arc::new(${receiver})",
"requires": "std::sync::Arc",
"description": "Put the expression into an `Arc`",
"scope": "expr"
},
"Rc::new": {
"postfix": "rc",
"body": "Rc::new(${receiver})",
"requires": "std::rc::Rc",
"description": "Put the expression into an `Rc`",
"Ok": {
"postfix": "ok",
"body": "Ok(${receiver})",
"description": "Wrap the expression in a `Result::Ok`",
"scope": "expr"
},
"Box::pin": {
@ -342,10 +334,11 @@ Default:
"description": "Put the expression into a pinned `Box`",
"scope": "expr"
},
"Err": {
"postfix": "err",
"body": "Err(${receiver})",
"description": "Wrap the expression in a `Result::Err`",
"Arc::new": {
"postfix": "arc",
"body": "Arc::new(${receiver})",
"requires": "std::sync::Arc",
"description": "Put the expression into an `Arc`",
"scope": "expr"
},
"Some": {
@ -354,10 +347,17 @@ Default:
"description": "Wrap the expression in an `Option::Some`",
"scope": "expr"
},
"Ok": {
"postfix": "ok",
"body": "Ok(${receiver})",
"description": "Wrap the expression in a `Result::Ok`",
"Err": {
"postfix": "err",
"body": "Err(${receiver})",
"description": "Wrap the expression in a `Result::Err`",
"scope": "expr"
},
"Rc::new": {
"postfix": "rc",
"body": "Rc::new(${receiver})",
"requires": "std::rc::Rc",
"description": "Put the expression into an `Rc`",
"scope": "expr"
}
}

View File

@ -728,8 +728,8 @@
"rust-analyzer.cargo.cfgs": {
"markdownDescription": "List of cfg options to enable with the given values.",
"default": {
"debug_assertions": null,
"miri": null
"miri": null,
"debug_assertions": null
},
"type": "object"
}
@ -1152,18 +1152,10 @@
"rust-analyzer.completion.snippets.custom": {
"markdownDescription": "Custom completion snippets.",
"default": {
"Arc::new": {
"postfix": "arc",
"body": "Arc::new(${receiver})",
"requires": "std::sync::Arc",
"description": "Put the expression into an `Arc`",
"scope": "expr"
},
"Rc::new": {
"postfix": "rc",
"body": "Rc::new(${receiver})",
"requires": "std::rc::Rc",
"description": "Put the expression into an `Rc`",
"Ok": {
"postfix": "ok",
"body": "Ok(${receiver})",
"description": "Wrap the expression in a `Result::Ok`",
"scope": "expr"
},
"Box::pin": {
@ -1173,10 +1165,11 @@
"description": "Put the expression into a pinned `Box`",
"scope": "expr"
},
"Err": {
"postfix": "err",
"body": "Err(${receiver})",
"description": "Wrap the expression in a `Result::Err`",
"Arc::new": {
"postfix": "arc",
"body": "Arc::new(${receiver})",
"requires": "std::sync::Arc",
"description": "Put the expression into an `Arc`",
"scope": "expr"
},
"Some": {
@ -1185,10 +1178,17 @@
"description": "Wrap the expression in an `Option::Some`",
"scope": "expr"
},
"Ok": {
"postfix": "ok",
"body": "Ok(${receiver})",
"description": "Wrap the expression in a `Result::Ok`",
"Err": {
"postfix": "err",
"body": "Err(${receiver})",
"description": "Wrap the expression in a `Result::Err`",
"scope": "expr"
},
"Rc::new": {
"postfix": "rc",
"body": "Rc::new(${receiver})",
"requires": "std::rc::Rc",
"description": "Put the expression into an `Rc`",
"scope": "expr"
}
},