Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-term/tests/test/languages/yaml.rs')
| -rw-r--r-- | helix-term/tests/test/languages/yaml.rs | 357 |
1 files changed, 108 insertions, 249 deletions
diff --git a/helix-term/tests/test/languages/yaml.rs b/helix-term/tests/test/languages/yaml.rs index 1d959640..19e88f58 100644 --- a/helix-term/tests/test/languages/yaml.rs +++ b/helix-term/tests/test/languages/yaml.rs @@ -6,7 +6,7 @@ async fn auto_indent() -> anyhow::Result<()> { let below_tests = [ ( - indoc! {r##" + helpers::platform_line(indoc! {r##" #[t|]#op: baz: foo bazi: @@ -17,9 +17,9 @@ async fn auto_indent() -> anyhow::Result<()> { - 2 bax: foox fook: - "##}, + "##}), "o", - indoc! {"\ + helpers::platform_line(indoc! {"\ top: #[\n|]# baz: foo @@ -31,10 +31,10 @@ async fn auto_indent() -> anyhow::Result<()> { - 2 bax: foox fook: - "}, + "}), ), ( - indoc! {r##" + helpers::platform_line(indoc! {r##" top: b#[a|]#z: foo bazi: @@ -45,9 +45,9 @@ async fn auto_indent() -> anyhow::Result<()> { - 2 bax: foox fook: - "##}, + "##}), "o", - indoc! {"\ + helpers::platform_line(indoc! {"\ top: baz: foo #[\n|]# @@ -59,10 +59,10 @@ async fn auto_indent() -> anyhow::Result<()> { - 2 bax: foox fook: - "}, + "}), ), ( - indoc! {r##" + helpers::platform_line(indoc! {r##" top: baz: foo bazi#[:|]# @@ -73,9 +73,9 @@ async fn auto_indent() -> anyhow::Result<()> { - 2 bax: foox fook: - "##}, + "##}), "o", - indoc! {"\ + helpers::platform_line(indoc! {"\ top: baz: foo bazi: @@ -87,10 +87,10 @@ async fn auto_indent() -> anyhow::Result<()> { - 2 bax: foox fook: - "}, + "}), ), ( - indoc! {r##" + helpers::platform_line(indoc! {r##" top: baz: foo bazi: @@ -101,9 +101,9 @@ async fn auto_indent() -> anyhow::Result<()> { - 2 bax: foox fook: - "##}, + "##}), "o", - indoc! {"\ + helpers::platform_line(indoc! {"\ top: baz: foo bazi: @@ -115,10 +115,10 @@ async fn auto_indent() -> anyhow::Result<()> { - 2 bax: foox fook: - "}, + "}), ), ( - indoc! {r##" + helpers::platform_line(indoc! {r##" top: baz: foo bazi: @@ -129,9 +129,9 @@ async fn auto_indent() -> anyhow::Result<()> { - 2 bax: foox fook: - "##}, + "##}), "o", - indoc! {"\ + helpers::platform_line(indoc! {"\ top: baz: foo bazi: @@ -143,10 +143,10 @@ async fn auto_indent() -> anyhow::Result<()> { - 2 bax: foox fook: - "}, + "}), ), ( - indoc! {"\ + helpers::platform_line(indoc! {"\ top: baz: foo bazi: @@ -157,9 +157,9 @@ async fn auto_indent() -> anyhow::Result<()> { - 2 bax: foox fook: - "}, + "}), "o", - indoc! {"\ + helpers::platform_line(indoc! {"\ top: baz: foo bazi: @@ -171,10 +171,10 @@ async fn auto_indent() -> anyhow::Result<()> { - 2 bax: foox fook: - "}, + "}), ), ( - indoc! {"\ + helpers::platform_line(indoc! {"\ top: baz: foo bazi: @@ -185,9 +185,9 @@ async fn auto_indent() -> anyhow::Result<()> { - 2 bax: foox fook: - "}, + "}), "o", - indoc! {"\ + helpers::platform_line(indoc! {"\ top: baz: foo bazi: @@ -199,10 +199,10 @@ async fn auto_indent() -> anyhow::Result<()> { - 2 bax: foox fook: - "}, + "}), ), ( - indoc! {"\ + helpers::platform_line(indoc! {"\ top: baz: foo bazi: @@ -213,9 +213,9 @@ async fn auto_indent() -> anyhow::Result<()> { - 2 bax: foox fook:#[\n|]# - "}, + "}), "o", - indoc! {"\ + helpers::platform_line(indoc! {"\ top: baz: foo bazi: @@ -227,10 +227,10 @@ async fn auto_indent() -> anyhow::Result<()> { bax: foox fook: #[\n|]# - "}, + "}), ), ( - indoc! {"\ + helpers::platform_line(indoc! {"\ top: baz: foo bax: | @@ -239,9 +239,9 @@ async fn auto_indent() -> anyhow::Result<()> { line string#[\n|]# fook: - "}, + "}), "o", - indoc! {"\ + helpers::platform_line(indoc! {"\ top: baz: foo bax: | @@ -251,10 +251,10 @@ async fn auto_indent() -> anyhow::Result<()> { string #[\n|]# fook: - "}, + "}), ), ( - indoc! {"\ + helpers::platform_line(indoc! {"\ top: baz: foo bax: > @@ -263,9 +263,9 @@ async fn auto_indent() -> anyhow::Result<()> { line#[\n|]# string fook: - "}, + "}), "o", - indoc! {"\ + helpers::platform_line(indoc! {"\ top: baz: foo bax: > @@ -275,128 +275,71 @@ async fn auto_indent() -> anyhow::Result<()> { #[\n|]# string fook: - "}, + "}), ), ( - indoc! {"\ + helpers::platform_line(indoc! {"\ top: baz: foo bax: >#[\n|]# fook: - "}, + "}), "o", - indoc! {"\ + helpers::platform_line(indoc! {"\ top: baz: foo bax: > #[\n|]# fook: - "}, + "}), ), ( - indoc! {"\ + helpers::platform_line(indoc! {"\ - top:#[\n|]# baz: foo bax: foox fook: - "}, + "}), "o", - indoc! {"\ + helpers::platform_line(indoc! {"\ - top: #[\n|]# baz: foo bax: foox fook: - "}, + "}), ), ( - indoc! {"\ + helpers::platform_line(indoc! {"\ - top: baz: foo#[\n|]# bax: foox fook: - "}, + "}), "o", - indoc! {"\ + helpers::platform_line(indoc! {"\ - top: baz: foo #[\n|]# bax: foox fook: - "}, + "}), ), ( - indoc! {"\ + helpers::platform_line(indoc! {"\ - top: baz: foo bax: foox#[\n|]# fook: - "}, + "}), "o", - indoc! {"\ + helpers::platform_line(indoc! {"\ - top: baz: foo bax: foox #[\n|]# fook: - "}, - ), - ( - indoc! {"\ - top: - baz: - - one: two#[\n|]# - three: four - - top: - baz: foo - bax: foox - "}, - "o", - indoc! {"\ - top: - baz: - - one: two - #[\n|]# - three: four - - top: - baz: foo - bax: foox - "}, - ), - // yaml map without a key - ( - indoc! {"\ - top:#[\n|]# - "}, - "o", - indoc! {"\ - top: - #[\n|]# - "}, - ), - ( - indoc! {"\ - top#[:|]# - bottom: withvalue - "}, - "o", - indoc! {"\ - top: - #[\n|]# - bottom: withvalue - "}, - ), - ( - indoc! {"\ - bottom: withvalue - top#[:|]# - "}, - "o", - indoc! {"\ - bottom: withvalue - top: - #[\n|]# - "}, + "}), ), ]; @@ -406,7 +349,7 @@ async fn auto_indent() -> anyhow::Result<()> { let above_tests = [ ( - indoc! {r##" + helpers::platform_line(indoc! {r##" #[t|]#op: baz: foo bazi: @@ -417,9 +360,9 @@ async fn auto_indent() -> anyhow::Result<()> { - 2 bax: foox fook: - "##}, + "##}), "O", - indoc! {"\ + helpers::platform_line(indoc! {"\ #[\n|]# top: baz: foo @@ -431,10 +374,10 @@ async fn auto_indent() -> anyhow::Result<()> { - 2 bax: foox fook: - "}, + "}), ), ( - indoc! {r##" + helpers::platform_line(indoc! {r##" top: b#[a|]#z: foo bazi: @@ -445,9 +388,9 @@ async fn auto_indent() -> anyhow::Result<()> { - 2 bax: foox fook: - "##}, + "##}), "O", - indoc! {"\ + helpers::platform_line(indoc! {"\ top: #[\n|]# baz: foo @@ -459,10 +402,10 @@ async fn auto_indent() -> anyhow::Result<()> { - 2 bax: foox fook: - "}, + "}), ), ( - indoc! {r##" + helpers::platform_line(indoc! {r##" top: baz: foo bazi#[:|]# @@ -473,9 +416,9 @@ async fn auto_indent() -> anyhow::Result<()> { - 2 bax: foox fook: - "##}, + "##}), "O", - indoc! {"\ + helpers::platform_line(indoc! {"\ top: baz: foo #[\n|]# @@ -487,10 +430,10 @@ async fn auto_indent() -> anyhow::Result<()> { - 2 bax: foox fook: - "}, + "}), ), ( - indoc! {r##" + helpers::platform_line(indoc! {r##" top: baz: foo bazi: @@ -501,9 +444,9 @@ async fn auto_indent() -> anyhow::Result<()> { - 2 bax: foox fook: - "##}, + "##}), "O", - indoc! {"\ + helpers::platform_line(indoc! {"\ top: baz: foo bazi: @@ -515,10 +458,10 @@ async fn auto_indent() -> anyhow::Result<()> { - 2 bax: foox fook: - "}, + "}), ), ( - indoc! {r##" + helpers::platform_line(indoc! {r##" top: baz: foo bazi: @@ -529,9 +472,9 @@ async fn auto_indent() -> anyhow::Result<()> { - 2 bax: foox fook: - "##}, + "##}), "O", - indoc! {"\ + helpers::platform_line(indoc! {"\ top: baz: foo bazi: @@ -543,10 +486,10 @@ async fn auto_indent() -> anyhow::Result<()> { - 2 bax: foox fook: - "}, + "}), ), ( - indoc! {"\ + helpers::platform_line(indoc! {"\ top: baz: foo bazi: @@ -557,9 +500,9 @@ async fn auto_indent() -> anyhow::Result<()> { - 2 bax: foox fook: - "}, + "}), "O", - indoc! {"\ + helpers::platform_line(indoc! {"\ top: baz: foo bazi: @@ -571,10 +514,10 @@ async fn auto_indent() -> anyhow::Result<()> { - 2 bax: foox fook: - "}, + "}), ), ( - indoc! {"\ + helpers::platform_line(indoc! {"\ top: baz: foo bazi: @@ -585,9 +528,9 @@ async fn auto_indent() -> anyhow::Result<()> { - 2 bax: foox fook: - "}, + "}), "O", - indoc! {"\ + helpers::platform_line(indoc! {"\ top: baz: foo bazi: @@ -599,10 +542,10 @@ async fn auto_indent() -> anyhow::Result<()> { - 2 bax: foox fook: - "}, + "}), ), ( - indoc! {"\ + helpers::platform_line(indoc! {"\ top: baz: foo bazi: @@ -613,9 +556,9 @@ async fn auto_indent() -> anyhow::Result<()> { - 2 bax: foox fook:#[\n|]# - "}, + "}), "O", - indoc! {"\ + helpers::platform_line(indoc! {"\ top: baz: foo bazi: @@ -627,10 +570,10 @@ async fn auto_indent() -> anyhow::Result<()> { bax: foox #[\n|]# fook: - "}, + "}), ), ( - indoc! {"\ + helpers::platform_line(indoc! {"\ top: baz: foo bax: | @@ -639,9 +582,9 @@ async fn auto_indent() -> anyhow::Result<()> { line string#[\n|]# fook: - "}, + "}), "O", - indoc! {"\ + helpers::platform_line(indoc! {"\ top: baz: foo bax: | @@ -651,10 +594,10 @@ async fn auto_indent() -> anyhow::Result<()> { #[\n|]# string fook: - "}, + "}), ), ( - indoc! {"\ + helpers::platform_line(indoc! {"\ top: baz: foo bax: > @@ -663,9 +606,9 @@ async fn auto_indent() -> anyhow::Result<()> { line string fook: - "}, + "}), "O", - indoc! {"\ + helpers::platform_line(indoc! {"\ top: baz: foo bax: > @@ -675,112 +618,55 @@ async fn auto_indent() -> anyhow::Result<()> { line string fook: - "}, + "}), ), ( - indoc! {"\ + helpers::platform_line(indoc! {"\ top: baz: foo bax: > fook:#[\n|]# - "}, + "}), "O", - indoc! {"\ + helpers::platform_line(indoc! {"\ top: baz: foo bax: > #[\n|]# fook: - "}, + "}), ), ( - indoc! {"\ + helpers::platform_line(indoc! {"\ - top: baz: foo#[\n|]# bax: foox fook: - "}, + "}), "O", - indoc! {"\ + helpers::platform_line(indoc! {"\ - top: #[\n|]# baz: foo bax: foox fook: - "}, + "}), ), ( - indoc! {"\ + helpers::platform_line(indoc! {"\ - top: baz: foo bax: foox fook:#[\n|]# - "}, + "}), "O", - indoc! {"\ + helpers::platform_line(indoc! {"\ - top: baz: foo bax: foox #[\n|]# fook: - "}, - ), - ( - indoc! {"\ - top: - baz: - - one: two#[\n|]# - three: four - - top: - baz: foo - bax: foox - "}, - "O", - indoc! {"\ - top: - baz: - #[\n|]# - - one: two - three: four - - top: - baz: foo - bax: foox - "}, - ), - // yaml map without a key - ( - indoc! {"\ - top:#[\n|]# - "}, - "O", - indoc! {"\ - #[\n|]# - top: - "}, - ), - ( - indoc! {"\ - bottom: withvalue - top#[:|]# - "}, - "O", - indoc! {"\ - bottom: withvalue - #[\n|]# - top: - "}, - ), - ( - indoc! {"\ - top: - bottom:#[ |]#withvalue - "}, - "O", - indoc! {"\ - top: - #[\n|]# - bottom: withvalue - "}, + "}), ), ]; @@ -788,32 +674,5 @@ async fn auto_indent() -> anyhow::Result<()> { test_with_config(app(), test).await?; } - let enter_tests = [ - ( - indoc! {r##" - foo: #[b|]#ar - "##}, - "i<ret>", - indoc! {"\ - foo: - #[|b]#ar - "}, - ), - ( - indoc! {"\ - foo:#[\n|]# - "}, - "i<ret>", - indoc! {"\ - foo: - #[|\n]# - "}, - ), - ]; - - for test in enter_tests { - test_with_config(app(), test).await?; - } - Ok(()) } |