And some more

This commit is contained in:
Conrad Irwin 2023-12-11 15:14:13 -07:00
parent 3baf125f4a
commit e37173fe97

View file

@ -587,439 +587,439 @@ fn surrounding_markers(
) )
} }
// #[cfg(test)] #[cfg(test)]
// mod test { mod test {
// use indoc::indoc; use indoc::indoc;
// use crate::{ use crate::{
// state::Mode, state::Mode,
// test::{ExemptionFeatures, NeovimBackedTestContext, VimTestContext}, test::{ExemptionFeatures, NeovimBackedTestContext, VimTestContext},
// }; };
// const WORD_LOCATIONS: &'static str = indoc! {" const WORD_LOCATIONS: &'static str = indoc! {"
// The quick ˇbrowˇnˇ••• The quick ˇbrowˇnˇ
// fox ˇjuˇmpsˇ over fox ˇjuˇmpsˇ over
// the lazy dogˇ•• the lazy dogˇ
// ˇ ˇ
// ˇ ˇ
// ˇ ˇ
// Thˇeˇ-ˇquˇickˇ ˇbrownˇ• Thˇeˇ-ˇquˇickˇ ˇbrownˇ
// ˇ•• ˇ
// ˇ•• ˇ
// ˇ fox-jumpˇs over ˇ fox-jumpˇs over
// the lazy dogˇ• the lazy dogˇ
// ˇ ˇ
// " "
// }; };
// #[gpui::test] #[gpui::test]
// async fn test_change_word_object(cx: &mut gpui::TestAppContext) { async fn test_change_word_object(cx: &mut gpui::TestAppContext) {
// let mut cx = NeovimBackedTestContext::new(cx).await; let mut cx = NeovimBackedTestContext::new(cx).await;
// cx.assert_binding_matches_all(["c", "i", "w"], WORD_LOCATIONS) cx.assert_binding_matches_all(["c", "i", "w"], WORD_LOCATIONS)
// .await; .await;
// cx.assert_binding_matches_all(["c", "i", "shift-w"], WORD_LOCATIONS) cx.assert_binding_matches_all(["c", "i", "shift-w"], WORD_LOCATIONS)
// .await; .await;
// cx.assert_binding_matches_all(["c", "a", "w"], WORD_LOCATIONS) cx.assert_binding_matches_all(["c", "a", "w"], WORD_LOCATIONS)
// .await; .await;
// cx.assert_binding_matches_all(["c", "a", "shift-w"], WORD_LOCATIONS) cx.assert_binding_matches_all(["c", "a", "shift-w"], WORD_LOCATIONS)
// .await; .await;
// } }
// #[gpui::test] #[gpui::test]
// async fn test_delete_word_object(cx: &mut gpui::TestAppContext) { async fn test_delete_word_object(cx: &mut gpui::TestAppContext) {
// let mut cx = NeovimBackedTestContext::new(cx).await; let mut cx = NeovimBackedTestContext::new(cx).await;
// cx.assert_binding_matches_all(["d", "i", "w"], WORD_LOCATIONS) cx.assert_binding_matches_all(["d", "i", "w"], WORD_LOCATIONS)
// .await; .await;
// cx.assert_binding_matches_all(["d", "i", "shift-w"], WORD_LOCATIONS) cx.assert_binding_matches_all(["d", "i", "shift-w"], WORD_LOCATIONS)
// .await; .await;
// cx.assert_binding_matches_all(["d", "a", "w"], WORD_LOCATIONS) cx.assert_binding_matches_all(["d", "a", "w"], WORD_LOCATIONS)
// .await; .await;
// cx.assert_binding_matches_all(["d", "a", "shift-w"], WORD_LOCATIONS) cx.assert_binding_matches_all(["d", "a", "shift-w"], WORD_LOCATIONS)
// .await; .await;
// } }
// #[gpui::test] #[gpui::test]
// async fn test_visual_word_object(cx: &mut gpui::TestAppContext) { async fn test_visual_word_object(cx: &mut gpui::TestAppContext) {
// let mut cx = NeovimBackedTestContext::new(cx).await; let mut cx = NeovimBackedTestContext::new(cx).await;
// /* /*
// cx.set_shared_state("The quick ˇbrown\nfox").await; cx.set_shared_state("The quick ˇbrown\nfox").await;
// cx.simulate_shared_keystrokes(["v"]).await; cx.simulate_shared_keystrokes(["v"]).await;
// cx.assert_shared_state("The quick «bˇ»rown\nfox").await; cx.assert_shared_state("The quick «bˇ»rown\nfox").await;
// cx.simulate_shared_keystrokes(["i", "w"]).await; cx.simulate_shared_keystrokes(["i", "w"]).await;
// cx.assert_shared_state("The quick «brownˇ»\nfox").await; cx.assert_shared_state("The quick «brownˇ»\nfox").await;
// */ */
// cx.set_shared_state("The quick brown\nˇ\nfox").await; cx.set_shared_state("The quick brown\nˇ\nfox").await;
// cx.simulate_shared_keystrokes(["v"]).await; cx.simulate_shared_keystrokes(["v"]).await;
// cx.assert_shared_state("The quick brown\n«\nˇ»fox").await; cx.assert_shared_state("The quick brown\n«\nˇ»fox").await;
// cx.simulate_shared_keystrokes(["i", "w"]).await; cx.simulate_shared_keystrokes(["i", "w"]).await;
// cx.assert_shared_state("The quick brown\n«\nˇ»fox").await; cx.assert_shared_state("The quick brown\n«\nˇ»fox").await;
// cx.assert_binding_matches_all(["v", "i", "w"], WORD_LOCATIONS) cx.assert_binding_matches_all(["v", "i", "w"], WORD_LOCATIONS)
// .await; .await;
// cx.assert_binding_matches_all_exempted( cx.assert_binding_matches_all_exempted(
// ["v", "h", "i", "w"], ["v", "h", "i", "w"],
// WORD_LOCATIONS, WORD_LOCATIONS,
// ExemptionFeatures::NonEmptyVisualTextObjects, ExemptionFeatures::NonEmptyVisualTextObjects,
// ) )
// .await; .await;
// cx.assert_binding_matches_all_exempted( cx.assert_binding_matches_all_exempted(
// ["v", "l", "i", "w"], ["v", "l", "i", "w"],
// WORD_LOCATIONS, WORD_LOCATIONS,
// ExemptionFeatures::NonEmptyVisualTextObjects, ExemptionFeatures::NonEmptyVisualTextObjects,
// ) )
// .await; .await;
// cx.assert_binding_matches_all(["v", "i", "shift-w"], WORD_LOCATIONS) cx.assert_binding_matches_all(["v", "i", "shift-w"], WORD_LOCATIONS)
// .await; .await;
// cx.assert_binding_matches_all_exempted( cx.assert_binding_matches_all_exempted(
// ["v", "i", "h", "shift-w"], ["v", "i", "h", "shift-w"],
// WORD_LOCATIONS, WORD_LOCATIONS,
// ExemptionFeatures::NonEmptyVisualTextObjects, ExemptionFeatures::NonEmptyVisualTextObjects,
// ) )
// .await; .await;
// cx.assert_binding_matches_all_exempted( cx.assert_binding_matches_all_exempted(
// ["v", "i", "l", "shift-w"], ["v", "i", "l", "shift-w"],
// WORD_LOCATIONS, WORD_LOCATIONS,
// ExemptionFeatures::NonEmptyVisualTextObjects, ExemptionFeatures::NonEmptyVisualTextObjects,
// ) )
// .await; .await;
// cx.assert_binding_matches_all_exempted( cx.assert_binding_matches_all_exempted(
// ["v", "a", "w"], ["v", "a", "w"],
// WORD_LOCATIONS, WORD_LOCATIONS,
// ExemptionFeatures::AroundObjectLeavesWhitespaceAtEndOfLine, ExemptionFeatures::AroundObjectLeavesWhitespaceAtEndOfLine,
// ) )
// .await; .await;
// cx.assert_binding_matches_all_exempted( cx.assert_binding_matches_all_exempted(
// ["v", "a", "shift-w"], ["v", "a", "shift-w"],
// WORD_LOCATIONS, WORD_LOCATIONS,
// ExemptionFeatures::AroundObjectLeavesWhitespaceAtEndOfLine, ExemptionFeatures::AroundObjectLeavesWhitespaceAtEndOfLine,
// ) )
// .await; .await;
// } }
// const SENTENCE_EXAMPLES: &[&'static str] = &[ const SENTENCE_EXAMPLES: &[&'static str] = &[
// "ˇThe quick ˇbrownˇ?ˇ ˇFox Jˇumpsˇ!ˇ Ovˇer theˇ lazyˇ.", "ˇThe quick ˇbrownˇ?ˇ ˇFox Jˇumpsˇ!ˇ Ovˇer theˇ lazyˇ.",
// indoc! {" indoc! {"
// ˇThe quick ˇbrownˇ ˇThe quick ˇbrownˇ
// fox jumps over fox jumps over
// the lazy doˇgˇ.ˇ ˇThe quick ˇ the lazy doˇgˇ.ˇ ˇThe quick ˇ
// brown fox jumps over brown fox jumps over
// "}, "},
// indoc! {" indoc! {"
// The quick brown fox jumps. The quick brown fox jumps.
// Over the lazy dog Over the lazy dog
// ˇ ˇ
// ˇ ˇ
// ˇ fox-jumpˇs over ˇ fox-jumpˇs over
// the lazy dog.ˇ the lazy dog.ˇ
// ˇ ˇ
// "}, "},
// r#"ˇThe ˇquick brownˇ.)ˇ]ˇ'ˇ" Brown ˇfox jumpsˇ.ˇ "#, r#"ˇThe ˇquick brownˇ.)ˇ]ˇ'ˇ" Brown ˇfox jumpsˇ.ˇ "#,
// ]; ];
// #[gpui::test] #[gpui::test]
// async fn test_change_sentence_object(cx: &mut gpui::TestAppContext) { async fn test_change_sentence_object(cx: &mut gpui::TestAppContext) {
// let mut cx = NeovimBackedTestContext::new(cx) let mut cx = NeovimBackedTestContext::new(cx)
// .await .await
// .binding(["c", "i", "s"]); .binding(["c", "i", "s"]);
// cx.add_initial_state_exemptions( cx.add_initial_state_exemptions(
// "The quick brown fox jumps.\nOver the lazy dog\nˇ\nˇ\n fox-jumps over\nthe lazy dog.\n\n", "The quick brown fox jumps.\nOver the lazy dog\nˇ\nˇ\n fox-jumps over\nthe lazy dog.\n\n",
// ExemptionFeatures::SentenceOnEmptyLines); ExemptionFeatures::SentenceOnEmptyLines);
// cx.add_initial_state_exemptions( cx.add_initial_state_exemptions(
// "The quick brown fox jumps.\nOver the lazy dog\n\n\nˇ foxˇ-ˇjumpˇs over\nthe lazy dog.\n\n", "The quick brown fox jumps.\nOver the lazy dog\n\n\nˇ foxˇ-ˇjumpˇs over\nthe lazy dog.\n\n",
// ExemptionFeatures::SentenceAtStartOfLineWithWhitespace); ExemptionFeatures::SentenceAtStartOfLineWithWhitespace);
// cx.add_initial_state_exemptions( cx.add_initial_state_exemptions(
// "The quick brown fox jumps.\nOver the lazy dog\n\n\n fox-jumps over\nthe lazy dog.ˇ\nˇ\n", "The quick brown fox jumps.\nOver the lazy dog\n\n\n fox-jumps over\nthe lazy dog.ˇ\nˇ\n",
// ExemptionFeatures::SentenceAfterPunctuationAtEndOfFile); ExemptionFeatures::SentenceAfterPunctuationAtEndOfFile);
// for sentence_example in SENTENCE_EXAMPLES { for sentence_example in SENTENCE_EXAMPLES {
// cx.assert_all(sentence_example).await; cx.assert_all(sentence_example).await;
// } }
// let mut cx = cx.binding(["c", "a", "s"]); let mut cx = cx.binding(["c", "a", "s"]);
// cx.add_initial_state_exemptions( cx.add_initial_state_exemptions(
// "The quick brown?ˇ Fox Jumps! Over the lazy.", "The quick brown?ˇ Fox Jumps! Over the lazy.",
// ExemptionFeatures::IncorrectLandingPosition, ExemptionFeatures::IncorrectLandingPosition,
// ); );
// cx.add_initial_state_exemptions( cx.add_initial_state_exemptions(
// "The quick brown.)]\'\" Brown fox jumps.ˇ ", "The quick brown.)]\'\" Brown fox jumps.ˇ ",
// ExemptionFeatures::AroundObjectLeavesWhitespaceAtEndOfLine, ExemptionFeatures::AroundObjectLeavesWhitespaceAtEndOfLine,
// ); );
// for sentence_example in SENTENCE_EXAMPLES { for sentence_example in SENTENCE_EXAMPLES {
// cx.assert_all(sentence_example).await; cx.assert_all(sentence_example).await;
// } }
// } }
// #[gpui::test] #[gpui::test]
// async fn test_delete_sentence_object(cx: &mut gpui::TestAppContext) { async fn test_delete_sentence_object(cx: &mut gpui::TestAppContext) {
// let mut cx = NeovimBackedTestContext::new(cx) let mut cx = NeovimBackedTestContext::new(cx)
// .await .await
// .binding(["d", "i", "s"]); .binding(["d", "i", "s"]);
// cx.add_initial_state_exemptions( cx.add_initial_state_exemptions(
// "The quick brown fox jumps.\nOver the lazy dog\nˇ\nˇ\n fox-jumps over\nthe lazy dog.\n\n", "The quick brown fox jumps.\nOver the lazy dog\nˇ\nˇ\n fox-jumps over\nthe lazy dog.\n\n",
// ExemptionFeatures::SentenceOnEmptyLines); ExemptionFeatures::SentenceOnEmptyLines);
// cx.add_initial_state_exemptions( cx.add_initial_state_exemptions(
// "The quick brown fox jumps.\nOver the lazy dog\n\n\nˇ foxˇ-ˇjumpˇs over\nthe lazy dog.\n\n", "The quick brown fox jumps.\nOver the lazy dog\n\n\nˇ foxˇ-ˇjumpˇs over\nthe lazy dog.\n\n",
// ExemptionFeatures::SentenceAtStartOfLineWithWhitespace); ExemptionFeatures::SentenceAtStartOfLineWithWhitespace);
// cx.add_initial_state_exemptions( cx.add_initial_state_exemptions(
// "The quick brown fox jumps.\nOver the lazy dog\n\n\n fox-jumps over\nthe lazy dog.ˇ\nˇ\n", "The quick brown fox jumps.\nOver the lazy dog\n\n\n fox-jumps over\nthe lazy dog.ˇ\nˇ\n",
// ExemptionFeatures::SentenceAfterPunctuationAtEndOfFile); ExemptionFeatures::SentenceAfterPunctuationAtEndOfFile);
// for sentence_example in SENTENCE_EXAMPLES { for sentence_example in SENTENCE_EXAMPLES {
// cx.assert_all(sentence_example).await; cx.assert_all(sentence_example).await;
// } }
// let mut cx = cx.binding(["d", "a", "s"]); let mut cx = cx.binding(["d", "a", "s"]);
// cx.add_initial_state_exemptions( cx.add_initial_state_exemptions(
// "The quick brown?ˇ Fox Jumps! Over the lazy.", "The quick brown?ˇ Fox Jumps! Over the lazy.",
// ExemptionFeatures::IncorrectLandingPosition, ExemptionFeatures::IncorrectLandingPosition,
// ); );
// cx.add_initial_state_exemptions( cx.add_initial_state_exemptions(
// "The quick brown.)]\'\" Brown fox jumps.ˇ ", "The quick brown.)]\'\" Brown fox jumps.ˇ ",
// ExemptionFeatures::AroundObjectLeavesWhitespaceAtEndOfLine, ExemptionFeatures::AroundObjectLeavesWhitespaceAtEndOfLine,
// ); );
// for sentence_example in SENTENCE_EXAMPLES { for sentence_example in SENTENCE_EXAMPLES {
// cx.assert_all(sentence_example).await; cx.assert_all(sentence_example).await;
// } }
// } }
// #[gpui::test] #[gpui::test]
// async fn test_visual_sentence_object(cx: &mut gpui::TestAppContext) { async fn test_visual_sentence_object(cx: &mut gpui::TestAppContext) {
// let mut cx = NeovimBackedTestContext::new(cx) let mut cx = NeovimBackedTestContext::new(cx)
// .await .await
// .binding(["v", "i", "s"]); .binding(["v", "i", "s"]);
// for sentence_example in SENTENCE_EXAMPLES { for sentence_example in SENTENCE_EXAMPLES {
// cx.assert_all_exempted(sentence_example, ExemptionFeatures::SentenceOnEmptyLines) cx.assert_all_exempted(sentence_example, ExemptionFeatures::SentenceOnEmptyLines)
// .await; .await;
// } }
// let mut cx = cx.binding(["v", "a", "s"]); let mut cx = cx.binding(["v", "a", "s"]);
// for sentence_example in SENTENCE_EXAMPLES { for sentence_example in SENTENCE_EXAMPLES {
// cx.assert_all_exempted( cx.assert_all_exempted(
// sentence_example, sentence_example,
// ExemptionFeatures::AroundSentenceStartingBetweenIncludesWrongWhitespace, ExemptionFeatures::AroundSentenceStartingBetweenIncludesWrongWhitespace,
// ) )
// .await; .await;
// } }
// } }
// // Test string with "`" for opening surrounders and "'" for closing surrounders // Test string with "`" for opening surrounders and "'" for closing surrounders
// const SURROUNDING_MARKER_STRING: &str = indoc! {" const SURROUNDING_MARKER_STRING: &str = indoc! {"
// ˇTh'ˇe ˇ`ˇ'ˇquˇi`ˇck broˇ'wn` ˇTh'ˇe ˇ`ˇ'ˇquˇi`ˇck broˇ'wn`
// 'ˇfox juˇmps ovˇ`ˇer 'ˇfox juˇmps ovˇ`ˇer
// the ˇlazy dˇ'ˇoˇ`ˇg"}; the ˇlazy 'ˇ`ˇg"};
// const SURROUNDING_OBJECTS: &[(char, char)] = &[ const SURROUNDING_OBJECTS: &[(char, char)] = &[
// ('\'', '\''), // Quote ('\'', '\''), // Quote
// ('`', '`'), // Back Quote ('`', '`'), // Back Quote
// ('"', '"'), // Double Quote ('"', '"'), // Double Quote
// ('(', ')'), // Parentheses ('(', ')'), // Parentheses
// ('[', ']'), // SquareBrackets ('[', ']'), // SquareBrackets
// ('{', '}'), // CurlyBrackets ('{', '}'), // CurlyBrackets
// ('<', '>'), // AngleBrackets ('<', '>'), // AngleBrackets
// ]; ];
// #[gpui::test] #[gpui::test]
// async fn test_change_surrounding_character_objects(cx: &mut gpui::TestAppContext) { async fn test_change_surrounding_character_objects(cx: &mut gpui::TestAppContext) {
// let mut cx = NeovimBackedTestContext::new(cx).await; let mut cx = NeovimBackedTestContext::new(cx).await;
// for (start, end) in SURROUNDING_OBJECTS { for (start, end) in SURROUNDING_OBJECTS {
// let marked_string = SURROUNDING_MARKER_STRING let marked_string = SURROUNDING_MARKER_STRING
// .replace('`', &start.to_string()) .replace('`', &start.to_string())
// .replace('\'', &end.to_string()); .replace('\'', &end.to_string());
// cx.assert_binding_matches_all(["c", "i", &start.to_string()], &marked_string) cx.assert_binding_matches_all(["c", "i", &start.to_string()], &marked_string)
// .await; .await;
// cx.assert_binding_matches_all(["c", "i", &end.to_string()], &marked_string) cx.assert_binding_matches_all(["c", "i", &end.to_string()], &marked_string)
// .await; .await;
// cx.assert_binding_matches_all(["c", "a", &start.to_string()], &marked_string) cx.assert_binding_matches_all(["c", "a", &start.to_string()], &marked_string)
// .await; .await;
// cx.assert_binding_matches_all(["c", "a", &end.to_string()], &marked_string) cx.assert_binding_matches_all(["c", "a", &end.to_string()], &marked_string)
// .await; .await;
// } }
// } }
// #[gpui::test] #[gpui::test]
// async fn test_singleline_surrounding_character_objects(cx: &mut gpui::TestAppContext) { async fn test_singleline_surrounding_character_objects(cx: &mut gpui::TestAppContext) {
// let mut cx = NeovimBackedTestContext::new(cx).await; let mut cx = NeovimBackedTestContext::new(cx).await;
// cx.set_shared_wrap(12).await; cx.set_shared_wrap(12).await;
// cx.set_shared_state(indoc! { cx.set_shared_state(indoc! {
// "helˇlo \"world\"!" "helˇlo \"world\"!"
// }) })
// .await; .await;
// cx.simulate_shared_keystrokes(["v", "i", "\""]).await; cx.simulate_shared_keystrokes(["v", "i", "\""]).await;
// cx.assert_shared_state(indoc! { cx.assert_shared_state(indoc! {
// "hello \"«worldˇ»\"!" "hello \"«worldˇ»\"!"
// }) })
// .await; .await;
// cx.set_shared_state(indoc! { cx.set_shared_state(indoc! {
// "hello \"wˇorld\"!" "hello \"wˇorld\"!"
// }) })
// .await; .await;
// cx.simulate_shared_keystrokes(["v", "i", "\""]).await; cx.simulate_shared_keystrokes(["v", "i", "\""]).await;
// cx.assert_shared_state(indoc! { cx.assert_shared_state(indoc! {
// "hello \"«worldˇ»\"!" "hello \"«worldˇ»\"!"
// }) })
// .await; .await;
// cx.set_shared_state(indoc! { cx.set_shared_state(indoc! {
// "hello \"wˇorld\"!" "hello \"wˇorld\"!"
// }) })
// .await; .await;
// cx.simulate_shared_keystrokes(["v", "a", "\""]).await; cx.simulate_shared_keystrokes(["v", "a", "\""]).await;
// cx.assert_shared_state(indoc! { cx.assert_shared_state(indoc! {
// "hello« \"world\"ˇ»!" "hello« \"world\"ˇ»!"
// }) })
// .await; .await;
// cx.set_shared_state(indoc! { cx.set_shared_state(indoc! {
// "hello \"wˇorld\" !" "hello \"wˇorld\" !"
// }) })
// .await; .await;
// cx.simulate_shared_keystrokes(["v", "a", "\""]).await; cx.simulate_shared_keystrokes(["v", "a", "\""]).await;
// cx.assert_shared_state(indoc! { cx.assert_shared_state(indoc! {
// "hello «\"world\" ˇ»!" "hello «\"world\" ˇ»!"
// }) })
// .await; .await;
// cx.set_shared_state(indoc! { cx.set_shared_state(indoc! {
// "hello \"wˇorld\" "hello \"wˇorld\"
// goodbye" goodbye"
// }) })
// .await; .await;
// cx.simulate_shared_keystrokes(["v", "a", "\""]).await; cx.simulate_shared_keystrokes(["v", "a", "\""]).await;
// cx.assert_shared_state(indoc! { cx.assert_shared_state(indoc! {
// "hello «\"world\" ˇ» "hello «\"world\" ˇ»
// goodbye" goodbye"
// }) })
// .await; .await;
// } }
// #[gpui::test] #[gpui::test]
// async fn test_multiline_surrounding_character_objects(cx: &mut gpui::TestAppContext) { async fn test_multiline_surrounding_character_objects(cx: &mut gpui::TestAppContext) {
// let mut cx = NeovimBackedTestContext::new(cx).await; let mut cx = NeovimBackedTestContext::new(cx).await;
// cx.set_shared_state(indoc! { cx.set_shared_state(indoc! {
// "func empty(a string) bool { "func empty(a string) bool {
// if a == \"\" { if a == \"\" {
// return true return true
// } }
// ˇreturn false ˇreturn false
// }" }"
// }) })
// .await; .await;
// cx.simulate_shared_keystrokes(["v", "i", "{"]).await; cx.simulate_shared_keystrokes(["v", "i", "{"]).await;
// cx.assert_shared_state(indoc! {" cx.assert_shared_state(indoc! {"
// func empty(a string) bool { func empty(a string) bool {
// « if a == \"\" { « if a == \"\" {
// return true return true
// } }
// return false return false
// ˇ»}"}) ˇ»}"})
// .await; .await;
// cx.set_shared_state(indoc! { cx.set_shared_state(indoc! {
// "func empty(a string) bool { "func empty(a string) bool {
// if a == \"\" { if a == \"\" {
// ˇreturn true ˇreturn true
// } }
// return false return false
// }" }"
// }) })
// .await; .await;
// cx.simulate_shared_keystrokes(["v", "i", "{"]).await; cx.simulate_shared_keystrokes(["v", "i", "{"]).await;
// cx.assert_shared_state(indoc! {" cx.assert_shared_state(indoc! {"
// func empty(a string) bool { func empty(a string) bool {
// if a == \"\" { if a == \"\" {
// « return true « return true
// ˇ» } ˇ» }
// return false return false
// }"}) }"})
// .await; .await;
// cx.set_shared_state(indoc! { cx.set_shared_state(indoc! {
// "func empty(a string) bool { "func empty(a string) bool {
// if a == \"\" ˇ{ if a == \"\" ˇ{
// return true return true
// } }
// return false return false
// }" }"
// }) })
// .await; .await;
// cx.simulate_shared_keystrokes(["v", "i", "{"]).await; cx.simulate_shared_keystrokes(["v", "i", "{"]).await;
// cx.assert_shared_state(indoc! {" cx.assert_shared_state(indoc! {"
// func empty(a string) bool { func empty(a string) bool {
// if a == \"\" { if a == \"\" {
// « return true « return true
// ˇ» } ˇ» }
// return false return false
// }"}) }"})
// .await; .await;
// } }
// #[gpui::test] #[gpui::test]
// async fn test_vertical_bars(cx: &mut gpui::TestAppContext) { async fn test_vertical_bars(cx: &mut gpui::TestAppContext) {
// let mut cx = VimTestContext::new(cx, true).await; let mut cx = VimTestContext::new(cx, true).await;
// cx.set_state( cx.set_state(
// indoc! {" indoc! {"
// fn boop() { fn boop() {
// baz(ˇ|a, b| { bar(|j, k| { })}) baz(ˇ|a, b| { bar(|j, k| { })})
// }" }"
// }, },
// Mode::Normal, Mode::Normal,
// ); );
// cx.simulate_keystrokes(["c", "i", "|"]); cx.simulate_keystrokes(["c", "i", "|"]);
// cx.assert_state( cx.assert_state(
// indoc! {" indoc! {"
// fn boop() { fn boop() {
// baz(|ˇ| { bar(|j, k| { })}) baz(|ˇ| { bar(|j, k| { })})
// }" }"
// }, },
// Mode::Insert, Mode::Insert,
// ); );
// cx.simulate_keystrokes(["escape", "1", "8", "|"]); cx.simulate_keystrokes(["escape", "1", "8", "|"]);
// cx.assert_state( cx.assert_state(
// indoc! {" indoc! {"
// fn boop() { fn boop() {
// baz(|| { bar(ˇ|j, k| { })}) baz(|| { bar(ˇ|j, k| { })})
// }" }"
// }, },
// Mode::Normal, Mode::Normal,
// ); );
// cx.simulate_keystrokes(["v", "a", "|"]); cx.simulate_keystrokes(["v", "a", "|"]);
// cx.assert_state( cx.assert_state(
// indoc! {" indoc! {"
// fn boop() { fn boop() {
// baz(|| { bar(«|j, k| ˇ»{ })}) baz(|| { bar(«|j, k| ˇ»{ })})
// }" }"
// }, },
// Mode::Visual, Mode::Visual,
// ); );
// } }
// #[gpui::test] #[gpui::test]
// async fn test_delete_surrounding_character_objects(cx: &mut gpui::TestAppContext) { async fn test_delete_surrounding_character_objects(cx: &mut gpui::TestAppContext) {
// let mut cx = NeovimBackedTestContext::new(cx).await; let mut cx = NeovimBackedTestContext::new(cx).await;
// for (start, end) in SURROUNDING_OBJECTS { for (start, end) in SURROUNDING_OBJECTS {
// let marked_string = SURROUNDING_MARKER_STRING let marked_string = SURROUNDING_MARKER_STRING
// .replace('`', &start.to_string()) .replace('`', &start.to_string())
// .replace('\'', &end.to_string()); .replace('\'', &end.to_string());
// cx.assert_binding_matches_all(["d", "i", &start.to_string()], &marked_string) cx.assert_binding_matches_all(["d", "i", &start.to_string()], &marked_string)
// .await; .await;
// cx.assert_binding_matches_all(["d", "i", &end.to_string()], &marked_string) cx.assert_binding_matches_all(["d", "i", &end.to_string()], &marked_string)
// .await; .await;
// cx.assert_binding_matches_all(["d", "a", &start.to_string()], &marked_string) cx.assert_binding_matches_all(["d", "a", &start.to_string()], &marked_string)
// .await; .await;
// cx.assert_binding_matches_all(["d", "a", &end.to_string()], &marked_string) cx.assert_binding_matches_all(["d", "a", &end.to_string()], &marked_string)
// .await; .await;
// } }
// } }
// } }