mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-28 17:53:56 +00:00
Merge #8559
8559: Add some more error messages to fixture failure cases r=Veykril a=Veykril Follow up for #8557 bors r+ Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
This commit is contained in:
commit
19fc1f333f
@ -35,7 +35,7 @@ pub trait WithFixture: Default + SourceDatabaseExt + 'static {
|
||||
fn with_position(ra_fixture: &str) -> (Self, FilePosition) {
|
||||
let (db, file_id, range_or_offset) = Self::with_range_or_offset(ra_fixture);
|
||||
let offset = match range_or_offset {
|
||||
RangeOrOffset::Range(_) => panic!(),
|
||||
RangeOrOffset::Range(_) => panic!("Expected a cursor position, got a range instead"),
|
||||
RangeOrOffset::Offset(it) => it,
|
||||
};
|
||||
(db, FilePosition { file_id, offset })
|
||||
@ -45,7 +45,7 @@ pub trait WithFixture: Default + SourceDatabaseExt + 'static {
|
||||
let (db, file_id, range_or_offset) = Self::with_range_or_offset(ra_fixture);
|
||||
let range = match range_or_offset {
|
||||
RangeOrOffset::Range(it) => it,
|
||||
RangeOrOffset::Offset(_) => panic!(),
|
||||
RangeOrOffset::Offset(_) => panic!("Expected a cursor range, got a position instead"),
|
||||
};
|
||||
(db, FileRange { file_id, range })
|
||||
}
|
||||
|
@ -84,7 +84,8 @@ fn check_doc_test(assist_id: &str, before: &str, after: &str) {
|
||||
});
|
||||
|
||||
let actual = {
|
||||
let source_change = assist.source_change.unwrap();
|
||||
let source_change =
|
||||
assist.source_change.expect("Assist did not contain any source changes");
|
||||
let mut actual = before;
|
||||
if let Some(source_file_edit) = source_change.get_source_edit(file_id) {
|
||||
source_file_edit.apply(&mut actual);
|
||||
@ -121,7 +122,8 @@ fn check(handler: Handler, before: &str, expected: ExpectedResult, assist_label:
|
||||
|
||||
match (assist, expected) {
|
||||
(Some(assist), ExpectedResult::After(after)) => {
|
||||
let source_change = assist.source_change.unwrap();
|
||||
let source_change =
|
||||
assist.source_change.expect("Assist did not contain any source changes");
|
||||
assert!(!source_change.source_file_edits.is_empty());
|
||||
let skip_header = source_change.source_file_edits.len() == 1
|
||||
&& source_change.file_system_edits.len() == 0;
|
||||
|
Loading…
Reference in New Issue
Block a user