mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Simplify
This commit is contained in:
parent
04fe512f0d
commit
5e7a1a1203
4 changed files with 38 additions and 47 deletions
|
@ -104,7 +104,7 @@ fn syntax_tree_for_token(node: &SyntaxToken, text_range: TextRange) -> Option<St
|
|||
mod tests {
|
||||
use test_utils::assert_eq_text;
|
||||
|
||||
use crate::mock_analysis::{single_file, single_file_with_range};
|
||||
use crate::mock_analysis::{single_file, analysis_and_range};
|
||||
|
||||
#[test]
|
||||
fn test_syntax_tree_without_range() {
|
||||
|
@ -184,7 +184,7 @@ SOURCE_FILE@0..60
|
|||
|
||||
#[test]
|
||||
fn test_syntax_tree_with_range() {
|
||||
let (analysis, range) = single_file_with_range(r#"<|>fn foo() {}<|>"#.trim());
|
||||
let (analysis, range) = analysis_and_range(r#"<|>fn foo() {}<|>"#.trim());
|
||||
let syn = analysis.syntax_tree(range.file_id, Some(range.range)).unwrap();
|
||||
|
||||
assert_eq_text!(
|
||||
|
@ -206,7 +206,7 @@ FN_DEF@0..11
|
|||
.trim()
|
||||
);
|
||||
|
||||
let (analysis, range) = single_file_with_range(
|
||||
let (analysis, range) = analysis_and_range(
|
||||
r#"fn test() {
|
||||
<|>assert!("
|
||||
fn foo() {
|
||||
|
@ -242,7 +242,7 @@ EXPR_STMT@16..58
|
|||
|
||||
#[test]
|
||||
fn test_syntax_tree_inside_string() {
|
||||
let (analysis, range) = single_file_with_range(
|
||||
let (analysis, range) = analysis_and_range(
|
||||
r#"fn test() {
|
||||
assert!("
|
||||
<|>fn foo() {
|
||||
|
@ -276,7 +276,7 @@ SOURCE_FILE@0..12
|
|||
);
|
||||
|
||||
// With a raw string
|
||||
let (analysis, range) = single_file_with_range(
|
||||
let (analysis, range) = analysis_and_range(
|
||||
r###"fn test() {
|
||||
assert!(r#"
|
||||
<|>fn foo() {
|
||||
|
@ -310,7 +310,7 @@ SOURCE_FILE@0..12
|
|||
);
|
||||
|
||||
// With a raw string
|
||||
let (analysis, range) = single_file_with_range(
|
||||
let (analysis, range) = analysis_and_range(
|
||||
r###"fn test() {
|
||||
assert!(r<|>#"
|
||||
fn foo() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue