Update test to use new group ids and new ordering of diagnostics.
This commit is contained in:
parent
bd4d7551a5
commit
ddf2f2cb0a
3 changed files with 37 additions and 33 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -4592,6 +4592,7 @@ dependencies = [
|
||||||
"lsp",
|
"lsp",
|
||||||
"parking_lot 0.11.2",
|
"parking_lot 0.11.2",
|
||||||
"postage",
|
"postage",
|
||||||
|
"pretty_assertions",
|
||||||
"pulldown-cmark",
|
"pulldown-cmark",
|
||||||
"rand 0.8.5",
|
"rand 0.8.5",
|
||||||
"regex",
|
"regex",
|
||||||
|
|
|
@ -57,6 +57,7 @@ thiserror = "1.0.29"
|
||||||
toml = "0.5"
|
toml = "0.5"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
pretty_assertions = "1.3.0"
|
||||||
client = { path = "../client", features = ["test-support"] }
|
client = { path = "../client", features = ["test-support"] }
|
||||||
collections = { path = "../collections", features = ["test-support"] }
|
collections = { path = "../collections", features = ["test-support"] }
|
||||||
db = { path = "../db", features = ["test-support"] }
|
db = { path = "../db", features = ["test-support"] }
|
||||||
|
|
|
@ -8,6 +8,7 @@ use language::{
|
||||||
OffsetRangeExt, Point, ToPoint,
|
OffsetRangeExt, Point, ToPoint,
|
||||||
};
|
};
|
||||||
use lsp::Url;
|
use lsp::Url;
|
||||||
|
use pretty_assertions::assert_eq;
|
||||||
use serde_json::json;
|
use serde_json::json;
|
||||||
use std::{cell::RefCell, os::unix, rc::Rc, task::Poll};
|
use std::{cell::RefCell, os::unix, rc::Rc, task::Poll};
|
||||||
use unindent::Unindent as _;
|
use unindent::Unindent as _;
|
||||||
|
@ -2846,7 +2847,7 @@ async fn test_grouped_diagnostics(cx: &mut gpui::TestAppContext) {
|
||||||
diagnostic: Diagnostic {
|
diagnostic: Diagnostic {
|
||||||
severity: DiagnosticSeverity::WARNING,
|
severity: DiagnosticSeverity::WARNING,
|
||||||
message: "error 1".to_string(),
|
message: "error 1".to_string(),
|
||||||
group_id: 0,
|
group_id: 1,
|
||||||
is_primary: true,
|
is_primary: true,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}
|
}
|
||||||
|
@ -2856,7 +2857,7 @@ async fn test_grouped_diagnostics(cx: &mut gpui::TestAppContext) {
|
||||||
diagnostic: Diagnostic {
|
diagnostic: Diagnostic {
|
||||||
severity: DiagnosticSeverity::HINT,
|
severity: DiagnosticSeverity::HINT,
|
||||||
message: "error 1 hint 1".to_string(),
|
message: "error 1 hint 1".to_string(),
|
||||||
group_id: 0,
|
group_id: 1,
|
||||||
is_primary: false,
|
is_primary: false,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}
|
}
|
||||||
|
@ -2866,7 +2867,7 @@ async fn test_grouped_diagnostics(cx: &mut gpui::TestAppContext) {
|
||||||
diagnostic: Diagnostic {
|
diagnostic: Diagnostic {
|
||||||
severity: DiagnosticSeverity::HINT,
|
severity: DiagnosticSeverity::HINT,
|
||||||
message: "error 2 hint 1".to_string(),
|
message: "error 2 hint 1".to_string(),
|
||||||
group_id: 1,
|
group_id: 0,
|
||||||
is_primary: false,
|
is_primary: false,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}
|
}
|
||||||
|
@ -2876,7 +2877,7 @@ async fn test_grouped_diagnostics(cx: &mut gpui::TestAppContext) {
|
||||||
diagnostic: Diagnostic {
|
diagnostic: Diagnostic {
|
||||||
severity: DiagnosticSeverity::HINT,
|
severity: DiagnosticSeverity::HINT,
|
||||||
message: "error 2 hint 2".to_string(),
|
message: "error 2 hint 2".to_string(),
|
||||||
group_id: 1,
|
group_id: 0,
|
||||||
is_primary: false,
|
is_primary: false,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}
|
}
|
||||||
|
@ -2886,7 +2887,7 @@ async fn test_grouped_diagnostics(cx: &mut gpui::TestAppContext) {
|
||||||
diagnostic: Diagnostic {
|
diagnostic: Diagnostic {
|
||||||
severity: DiagnosticSeverity::ERROR,
|
severity: DiagnosticSeverity::ERROR,
|
||||||
message: "error 2".to_string(),
|
message: "error 2".to_string(),
|
||||||
group_id: 1,
|
group_id: 0,
|
||||||
is_primary: true,
|
is_primary: true,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}
|
}
|
||||||
|
@ -2896,38 +2897,13 @@ async fn test_grouped_diagnostics(cx: &mut gpui::TestAppContext) {
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
buffer.diagnostic_group::<Point>(0).collect::<Vec<_>>(),
|
buffer.diagnostic_group::<Point>(0).collect::<Vec<_>>(),
|
||||||
&[
|
|
||||||
DiagnosticEntry {
|
|
||||||
range: Point::new(1, 8)..Point::new(1, 9),
|
|
||||||
diagnostic: Diagnostic {
|
|
||||||
severity: DiagnosticSeverity::WARNING,
|
|
||||||
message: "error 1".to_string(),
|
|
||||||
group_id: 0,
|
|
||||||
is_primary: true,
|
|
||||||
..Default::default()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
DiagnosticEntry {
|
|
||||||
range: Point::new(1, 8)..Point::new(1, 9),
|
|
||||||
diagnostic: Diagnostic {
|
|
||||||
severity: DiagnosticSeverity::HINT,
|
|
||||||
message: "error 1 hint 1".to_string(),
|
|
||||||
group_id: 0,
|
|
||||||
is_primary: false,
|
|
||||||
..Default::default()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
]
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
buffer.diagnostic_group::<Point>(1).collect::<Vec<_>>(),
|
|
||||||
&[
|
&[
|
||||||
DiagnosticEntry {
|
DiagnosticEntry {
|
||||||
range: Point::new(1, 13)..Point::new(1, 15),
|
range: Point::new(1, 13)..Point::new(1, 15),
|
||||||
diagnostic: Diagnostic {
|
diagnostic: Diagnostic {
|
||||||
severity: DiagnosticSeverity::HINT,
|
severity: DiagnosticSeverity::HINT,
|
||||||
message: "error 2 hint 1".to_string(),
|
message: "error 2 hint 1".to_string(),
|
||||||
group_id: 1,
|
group_id: 0,
|
||||||
is_primary: false,
|
is_primary: false,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}
|
}
|
||||||
|
@ -2937,7 +2913,7 @@ async fn test_grouped_diagnostics(cx: &mut gpui::TestAppContext) {
|
||||||
diagnostic: Diagnostic {
|
diagnostic: Diagnostic {
|
||||||
severity: DiagnosticSeverity::HINT,
|
severity: DiagnosticSeverity::HINT,
|
||||||
message: "error 2 hint 2".to_string(),
|
message: "error 2 hint 2".to_string(),
|
||||||
group_id: 1,
|
group_id: 0,
|
||||||
is_primary: false,
|
is_primary: false,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}
|
}
|
||||||
|
@ -2947,13 +2923,39 @@ async fn test_grouped_diagnostics(cx: &mut gpui::TestAppContext) {
|
||||||
diagnostic: Diagnostic {
|
diagnostic: Diagnostic {
|
||||||
severity: DiagnosticSeverity::ERROR,
|
severity: DiagnosticSeverity::ERROR,
|
||||||
message: "error 2".to_string(),
|
message: "error 2".to_string(),
|
||||||
group_id: 1,
|
group_id: 0,
|
||||||
is_primary: true,
|
is_primary: true,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
buffer.diagnostic_group::<Point>(1).collect::<Vec<_>>(),
|
||||||
|
&[
|
||||||
|
DiagnosticEntry {
|
||||||
|
range: Point::new(1, 8)..Point::new(1, 9),
|
||||||
|
diagnostic: Diagnostic {
|
||||||
|
severity: DiagnosticSeverity::WARNING,
|
||||||
|
message: "error 1".to_string(),
|
||||||
|
group_id: 1,
|
||||||
|
is_primary: true,
|
||||||
|
..Default::default()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
DiagnosticEntry {
|
||||||
|
range: Point::new(1, 8)..Point::new(1, 9),
|
||||||
|
diagnostic: Diagnostic {
|
||||||
|
severity: DiagnosticSeverity::HINT,
|
||||||
|
message: "error 1 hint 1".to_string(),
|
||||||
|
group_id: 1,
|
||||||
|
is_primary: false,
|
||||||
|
..Default::default()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[gpui::test]
|
#[gpui::test]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue