Add #[track_caller]
to test utilities that involve marked text (#32043)
Release Notes: - N/A
This commit is contained in:
parent
030d4d2631
commit
48eacf3f2a
7 changed files with 12 additions and 0 deletions
|
@ -21227,6 +21227,7 @@ fn empty_range(row: usize, column: usize) -> Range<DisplayPoint> {
|
|||
point..point
|
||||
}
|
||||
|
||||
#[track_caller]
|
||||
fn assert_selection_ranges(marked_text: &str, editor: &mut Editor, cx: &mut Context<Editor>) {
|
||||
let (text, ranges) = marked_text_ranges(marked_text, true);
|
||||
assert_eq!(editor.text(cx), text);
|
||||
|
|
|
@ -45,6 +45,7 @@ pub fn test_font() -> Font {
|
|||
}
|
||||
|
||||
// Returns a snapshot from text containing '|' character markers with the markers removed, and DisplayPoints for each one.
|
||||
#[track_caller]
|
||||
pub fn marked_display_snapshot(
|
||||
text: &str,
|
||||
cx: &mut gpui::App,
|
||||
|
@ -83,6 +84,7 @@ pub fn marked_display_snapshot(
|
|||
(snapshot, markers)
|
||||
}
|
||||
|
||||
#[track_caller]
|
||||
pub fn select_ranges(
|
||||
editor: &mut Editor,
|
||||
marked_text: &str,
|
||||
|
|
|
@ -109,6 +109,7 @@ impl EditorTestContext {
|
|||
}
|
||||
}
|
||||
|
||||
#[track_caller]
|
||||
pub fn new_multibuffer<const COUNT: usize>(
|
||||
cx: &mut gpui::TestAppContext,
|
||||
excerpts: [&str; COUNT],
|
||||
|
@ -351,6 +352,7 @@ impl EditorTestContext {
|
|||
/// editor state was needed to cause the failure.
|
||||
///
|
||||
/// See the `util::test::marked_text_ranges` function for more information.
|
||||
#[track_caller]
|
||||
pub fn set_state(&mut self, marked_text: &str) -> ContextHandle {
|
||||
let state_context = self.add_assertion_context(format!(
|
||||
"Initial Editor State: \"{}\"",
|
||||
|
@ -367,6 +369,7 @@ impl EditorTestContext {
|
|||
}
|
||||
|
||||
/// Only change the editor's selections
|
||||
#[track_caller]
|
||||
pub fn set_selections_state(&mut self, marked_text: &str) -> ContextHandle {
|
||||
let state_context = self.add_assertion_context(format!(
|
||||
"Initial Editor State: \"{}\"",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue