Update tests to use new fold indicator
This commit is contained in:
parent
f8401394f5
commit
6cf62a5b02
4 changed files with 37 additions and 37 deletions
|
@ -1245,7 +1245,7 @@ pub mod tests {
|
|||
vec![
|
||||
("fn ".to_string(), None),
|
||||
("out".to_string(), Some(Color::blue())),
|
||||
("…".to_string(), None),
|
||||
("⋯".to_string(), None),
|
||||
(" fn ".to_string(), Some(Color::red())),
|
||||
("inner".to_string(), Some(Color::blue())),
|
||||
("() {}\n}".to_string(), Some(Color::red())),
|
||||
|
@ -1326,7 +1326,7 @@ pub mod tests {
|
|||
cx.update(|cx| syntax_chunks(1..4, &map, &theme, cx)),
|
||||
[
|
||||
("out".to_string(), Some(Color::blue())),
|
||||
("…\n".to_string(), None),
|
||||
("⋯\n".to_string(), None),
|
||||
(" \nfn ".to_string(), Some(Color::red())),
|
||||
("i\n".to_string(), Some(Color::blue()))
|
||||
]
|
||||
|
|
|
@ -1214,7 +1214,7 @@ mod tests {
|
|||
Point::new(0, 2)..Point::new(2, 2),
|
||||
Point::new(2, 4)..Point::new(4, 1),
|
||||
]);
|
||||
assert_eq!(snapshot2.text(), "aa…cc…eeeee");
|
||||
assert_eq!(snapshot2.text(), "aa⋯cc⋯eeeee");
|
||||
assert_eq!(
|
||||
edits,
|
||||
&[
|
||||
|
@ -1241,7 +1241,7 @@ mod tests {
|
|||
buffer.snapshot(cx)
|
||||
});
|
||||
let (snapshot3, edits) = map.read(buffer_snapshot, subscription.consume().into_inner());
|
||||
assert_eq!(snapshot3.text(), "123a…c123c…eeeee");
|
||||
assert_eq!(snapshot3.text(), "123a⋯c123c⋯eeeee");
|
||||
assert_eq!(
|
||||
edits,
|
||||
&[
|
||||
|
@ -1261,12 +1261,12 @@ mod tests {
|
|||
buffer.snapshot(cx)
|
||||
});
|
||||
let (snapshot4, _) = map.read(buffer_snapshot.clone(), subscription.consume().into_inner());
|
||||
assert_eq!(snapshot4.text(), "123a…c123456eee");
|
||||
assert_eq!(snapshot4.text(), "123a⋯c123456eee");
|
||||
|
||||
let (mut writer, _, _) = map.write(buffer_snapshot.clone(), vec![]);
|
||||
writer.unfold(Some(Point::new(0, 4)..Point::new(0, 4)), false);
|
||||
let (snapshot5, _) = map.read(buffer_snapshot.clone(), vec![]);
|
||||
assert_eq!(snapshot5.text(), "123a…c123456eee");
|
||||
assert_eq!(snapshot5.text(), "123a⋯c123456eee");
|
||||
|
||||
let (mut writer, _, _) = map.write(buffer_snapshot.clone(), vec![]);
|
||||
writer.unfold(Some(Point::new(0, 4)..Point::new(0, 4)), true);
|
||||
|
@ -1287,19 +1287,19 @@ mod tests {
|
|||
let (mut writer, _, _) = map.write(buffer_snapshot.clone(), vec![]);
|
||||
writer.fold(vec![5..8]);
|
||||
let (snapshot, _) = map.read(buffer_snapshot.clone(), vec![]);
|
||||
assert_eq!(snapshot.text(), "abcde…ijkl");
|
||||
assert_eq!(snapshot.text(), "abcde⋯ijkl");
|
||||
|
||||
// Create an fold adjacent to the start of the first fold.
|
||||
let (mut writer, _, _) = map.write(buffer_snapshot.clone(), vec![]);
|
||||
writer.fold(vec![0..1, 2..5]);
|
||||
let (snapshot, _) = map.read(buffer_snapshot.clone(), vec![]);
|
||||
assert_eq!(snapshot.text(), "…b…ijkl");
|
||||
assert_eq!(snapshot.text(), "⋯b⋯ijkl");
|
||||
|
||||
// Create an fold adjacent to the end of the first fold.
|
||||
let (mut writer, _, _) = map.write(buffer_snapshot.clone(), vec![]);
|
||||
writer.fold(vec![11..11, 8..10]);
|
||||
let (snapshot, _) = map.read(buffer_snapshot.clone(), vec![]);
|
||||
assert_eq!(snapshot.text(), "…b…kl");
|
||||
assert_eq!(snapshot.text(), "⋯b⋯kl");
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -1309,7 +1309,7 @@ mod tests {
|
|||
let (mut writer, _, _) = map.write(buffer_snapshot.clone(), vec![]);
|
||||
writer.fold(vec![0..2, 2..5]);
|
||||
let (snapshot, _) = map.read(buffer_snapshot, vec![]);
|
||||
assert_eq!(snapshot.text(), "…fghijkl");
|
||||
assert_eq!(snapshot.text(), "⋯fghijkl");
|
||||
|
||||
// Edit within one of the folds.
|
||||
let buffer_snapshot = buffer.update(cx, |buffer, cx| {
|
||||
|
@ -1317,7 +1317,7 @@ mod tests {
|
|||
buffer.snapshot(cx)
|
||||
});
|
||||
let (snapshot, _) = map.read(buffer_snapshot, subscription.consume().into_inner());
|
||||
assert_eq!(snapshot.text(), "12345…fghijkl");
|
||||
assert_eq!(snapshot.text(), "12345⋯fghijkl");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1334,7 +1334,7 @@ mod tests {
|
|||
Point::new(3, 1)..Point::new(4, 1),
|
||||
]);
|
||||
let (snapshot, _) = map.read(buffer_snapshot, vec![]);
|
||||
assert_eq!(snapshot.text(), "aa…eeeee");
|
||||
assert_eq!(snapshot.text(), "aa⋯eeeee");
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
|
@ -1351,14 +1351,14 @@ mod tests {
|
|||
Point::new(3, 1)..Point::new(4, 1),
|
||||
]);
|
||||
let (snapshot, _) = map.read(buffer_snapshot, vec![]);
|
||||
assert_eq!(snapshot.text(), "aa…cccc\nd…eeeee");
|
||||
assert_eq!(snapshot.text(), "aa⋯cccc\nd⋯eeeee");
|
||||
|
||||
let buffer_snapshot = buffer.update(cx, |buffer, cx| {
|
||||
buffer.edit([(Point::new(2, 2)..Point::new(3, 1), "")], None, cx);
|
||||
buffer.snapshot(cx)
|
||||
});
|
||||
let (snapshot, _) = map.read(buffer_snapshot, subscription.consume().into_inner());
|
||||
assert_eq!(snapshot.text(), "aa…eeeee");
|
||||
assert_eq!(snapshot.text(), "aa⋯eeeee");
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
|
@ -1450,7 +1450,7 @@ mod tests {
|
|||
|
||||
let mut expected_text: String = buffer_snapshot.text().to_string();
|
||||
for fold_range in map.merged_fold_ranges().into_iter().rev() {
|
||||
expected_text.replace_range(fold_range.start..fold_range.end, "…");
|
||||
expected_text.replace_range(fold_range.start..fold_range.end, "⋯");
|
||||
}
|
||||
|
||||
assert_eq!(snapshot.text(), expected_text);
|
||||
|
@ -1655,7 +1655,7 @@ mod tests {
|
|||
]);
|
||||
|
||||
let (snapshot, _) = map.read(buffer_snapshot, vec![]);
|
||||
assert_eq!(snapshot.text(), "aa…cccc\nd…eeeee\nffffff\n");
|
||||
assert_eq!(snapshot.text(), "aa⋯cccc\nd⋯eeeee\nffffff\n");
|
||||
assert_eq!(
|
||||
snapshot.buffer_rows(0).collect::<Vec<_>>(),
|
||||
[Some(0), Some(3), Some(5), Some(6)]
|
||||
|
|
|
@ -670,10 +670,10 @@ fn test_fold(cx: &mut gpui::MutableAppContext) {
|
|||
1
|
||||
}
|
||||
|
||||
fn b() {…
|
||||
fn b() {⋯
|
||||
}
|
||||
|
||||
fn c() {…
|
||||
fn c() {⋯
|
||||
}
|
||||
}
|
||||
"
|
||||
|
@ -684,7 +684,7 @@ fn test_fold(cx: &mut gpui::MutableAppContext) {
|
|||
assert_eq!(
|
||||
view.display_text(cx),
|
||||
"
|
||||
impl Foo {…
|
||||
impl Foo {⋯
|
||||
}
|
||||
"
|
||||
.unindent(),
|
||||
|
@ -701,10 +701,10 @@ fn test_fold(cx: &mut gpui::MutableAppContext) {
|
|||
1
|
||||
}
|
||||
|
||||
fn b() {…
|
||||
fn b() {⋯
|
||||
}
|
||||
|
||||
fn c() {…
|
||||
fn c() {⋯
|
||||
}
|
||||
}
|
||||
"
|
||||
|
@ -811,7 +811,7 @@ fn test_move_cursor_multibyte(cx: &mut gpui::MutableAppContext) {
|
|||
true,
|
||||
cx,
|
||||
);
|
||||
assert_eq!(view.display_text(cx), "ⓐⓑ…ⓔ\nab…e\nαβ…ε\n");
|
||||
assert_eq!(view.display_text(cx), "ⓐⓑ⋯ⓔ\nab⋯e\nαβ⋯ε\n");
|
||||
|
||||
view.move_right(&MoveRight, cx);
|
||||
assert_eq!(
|
||||
|
@ -826,13 +826,13 @@ fn test_move_cursor_multibyte(cx: &mut gpui::MutableAppContext) {
|
|||
view.move_right(&MoveRight, cx);
|
||||
assert_eq!(
|
||||
view.selections.display_ranges(cx),
|
||||
&[empty_range(0, "ⓐⓑ…".len())]
|
||||
&[empty_range(0, "ⓐⓑ⋯".len())]
|
||||
);
|
||||
|
||||
view.move_down(&MoveDown, cx);
|
||||
assert_eq!(
|
||||
view.selections.display_ranges(cx),
|
||||
&[empty_range(1, "ab…".len())]
|
||||
&[empty_range(1, "ab⋯".len())]
|
||||
);
|
||||
view.move_left(&MoveLeft, cx);
|
||||
assert_eq!(
|
||||
|
@ -858,28 +858,28 @@ fn test_move_cursor_multibyte(cx: &mut gpui::MutableAppContext) {
|
|||
view.move_right(&MoveRight, cx);
|
||||
assert_eq!(
|
||||
view.selections.display_ranges(cx),
|
||||
&[empty_range(2, "αβ…".len())]
|
||||
&[empty_range(2, "αβ⋯".len())]
|
||||
);
|
||||
view.move_right(&MoveRight, cx);
|
||||
assert_eq!(
|
||||
view.selections.display_ranges(cx),
|
||||
&[empty_range(2, "αβ…ε".len())]
|
||||
&[empty_range(2, "αβ⋯ε".len())]
|
||||
);
|
||||
|
||||
view.move_up(&MoveUp, cx);
|
||||
assert_eq!(
|
||||
view.selections.display_ranges(cx),
|
||||
&[empty_range(1, "ab…e".len())]
|
||||
&[empty_range(1, "ab⋯e".len())]
|
||||
);
|
||||
view.move_up(&MoveUp, cx);
|
||||
assert_eq!(
|
||||
view.selections.display_ranges(cx),
|
||||
&[empty_range(0, "ⓐⓑ…ⓔ".len())]
|
||||
&[empty_range(0, "ⓐⓑ⋯ⓔ".len())]
|
||||
);
|
||||
view.move_left(&MoveLeft, cx);
|
||||
assert_eq!(
|
||||
view.selections.display_ranges(cx),
|
||||
&[empty_range(0, "ⓐⓑ…".len())]
|
||||
&[empty_range(0, "ⓐⓑ⋯".len())]
|
||||
);
|
||||
view.move_left(&MoveLeft, cx);
|
||||
assert_eq!(
|
||||
|
@ -2134,13 +2134,13 @@ fn test_move_line_up_down(cx: &mut gpui::MutableAppContext) {
|
|||
});
|
||||
assert_eq!(
|
||||
view.display_text(cx),
|
||||
"aa…bbb\nccc…eeee\nfffff\nggggg\n…i\njjjjj"
|
||||
"aa⋯bbb\nccc⋯eeee\nfffff\nggggg\n⋯i\njjjjj"
|
||||
);
|
||||
|
||||
view.move_line_up(&MoveLineUp, cx);
|
||||
assert_eq!(
|
||||
view.display_text(cx),
|
||||
"aa…bbb\nccc…eeee\nggggg\n…i\njjjjj\nfffff"
|
||||
"aa⋯bbb\nccc⋯eeee\nggggg\n⋯i\njjjjj\nfffff"
|
||||
);
|
||||
assert_eq!(
|
||||
view.selections.display_ranges(cx),
|
||||
|
@ -2157,7 +2157,7 @@ fn test_move_line_up_down(cx: &mut gpui::MutableAppContext) {
|
|||
view.move_line_down(&MoveLineDown, cx);
|
||||
assert_eq!(
|
||||
view.display_text(cx),
|
||||
"ccc…eeee\naa…bbb\nfffff\nggggg\n…i\njjjjj"
|
||||
"ccc⋯eeee\naa⋯bbb\nfffff\nggggg\n⋯i\njjjjj"
|
||||
);
|
||||
assert_eq!(
|
||||
view.selections.display_ranges(cx),
|
||||
|
@ -2174,7 +2174,7 @@ fn test_move_line_up_down(cx: &mut gpui::MutableAppContext) {
|
|||
view.move_line_down(&MoveLineDown, cx);
|
||||
assert_eq!(
|
||||
view.display_text(cx),
|
||||
"ccc…eeee\nfffff\naa…bbb\nggggg\n…i\njjjjj"
|
||||
"ccc⋯eeee\nfffff\naa⋯bbb\nggggg\n⋯i\njjjjj"
|
||||
);
|
||||
assert_eq!(
|
||||
view.selections.display_ranges(cx),
|
||||
|
@ -2191,7 +2191,7 @@ fn test_move_line_up_down(cx: &mut gpui::MutableAppContext) {
|
|||
view.move_line_up(&MoveLineUp, cx);
|
||||
assert_eq!(
|
||||
view.display_text(cx),
|
||||
"ccc…eeee\naa…bbb\nggggg\n…i\njjjjj\nfffff"
|
||||
"ccc⋯eeee\naa⋯bbb\nggggg\n⋯i\njjjjj\nfffff"
|
||||
);
|
||||
assert_eq!(
|
||||
view.selections.display_ranges(cx),
|
||||
|
@ -2600,14 +2600,14 @@ fn test_split_selection_into_lines(cx: &mut gpui::MutableAppContext) {
|
|||
DisplayPoint::new(4, 4)..DisplayPoint::new(4, 4),
|
||||
])
|
||||
});
|
||||
assert_eq!(view.display_text(cx), "aa…bbb\nccc…eeee\nfffff\nggggg\n…i");
|
||||
assert_eq!(view.display_text(cx), "aa⋯bbb\nccc⋯eeee\nfffff\nggggg\n⋯i");
|
||||
});
|
||||
|
||||
view.update(cx, |view, cx| {
|
||||
view.split_selection_into_lines(&SplitSelectionIntoLines, cx);
|
||||
assert_eq!(
|
||||
view.display_text(cx),
|
||||
"aaaaa\nbbbbb\nccc…eeee\nfffff\nggggg\n…i"
|
||||
"aaaaa\nbbbbb\nccc⋯eeee\nfffff\nggggg\n⋯i"
|
||||
);
|
||||
assert_eq!(
|
||||
view.selections.display_ranges(cx),
|
||||
|
|
|
@ -1507,7 +1507,7 @@ impl EditorElement {
|
|||
} else {
|
||||
let text_style = self.style.text.clone();
|
||||
Flex::row()
|
||||
.with_child(Label::new("…", text_style).boxed())
|
||||
.with_child(Label::new("⋯", text_style).boxed())
|
||||
.with_children(jump_icon)
|
||||
.contained()
|
||||
.with_padding_left(gutter_padding)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue