use super::*; /// Comment and uncomment #[tokio::test(flavor = "multi_thread")] async fn test_injected_comment_tokens_simple() -> anyhow::Result<()> { // Uncomment inner injection test(( indoc! {r#"\
Comment toggle on this line should use the HTML comment token(s).
"#}, ":lang htmlComment toggle on this line should use the HTML comment token(s).
"#}, )) .await?; // Comment inner injection test(( indoc! {r#"\Comment toggle on this line should use the HTML comment token(s).
"#}, ":lang htmlComment toggle on this line should use the HTML comment token(s).
"#}, )) .await?; // Block comment inner injection test(( indoc! {r#"\Comment toggle on this line should use the HTML comment token(s).
"#}, ":lang htmlComment toggle on this line should use the HTML comment token(s).
"#}, )) .await?; // Block uncomment inner injection test(( indoc! {r#"\Comment toggle on this line should use the HTML comment token(s).
"#}, ":lang htmlComment toggle on this line should use the HTML comment token(s).
"#}, )) .await?; Ok(()) } /// Selections in different regions #[tokio::test(flavor = "multi_thread")] async fn test_injected_comment_tokens_multiple_selections() -> anyhow::Result<()> { // Comments two different injection layers with different comments test(( indoc! {r#"\Comment toggle #[|on this line ]#should use the HTML comment token(s).
"#}, ":lang htmlComment toggle #[|on this line ]#should use the HTML comment token(s).
"#}, )) .await?; // Works with multiple selections test(( indoc! {r#"\Comment toggle #(|on this line )#should use the HTML comment token(s).
"#}, ":lang htmlComment toggle #(|on this line)# should use the HTML comment token(s).
"#}, )) .await?; // Works with block comment toggle across different layers test(( indoc! {r#"\Comment toggle #(|on this line)# should use the HTML comment token(s).
"#}, ":lang htmlComment toggle #(|)# should use the HTML comment token(s).
"#}, )) .await?; // Many selections on the same line test(( indoc! {r#"\C#[|o]#mment t#(|o)#ggle #(|o)#n this line sh#(|o)#uld use the HTML c#(|o)#mment t#(|o)#ken(s).
"#}, ":lang htmlC#[|]#mment t#(|)#ggle #(|)#n this line sh#(|)#uld use the HTML c#(|)#mment t#(|)#ken(s).
"#}, )) .await?; test(( indoc! {r#"\C#[|]#mment t#(|)#ggle #(|)#n this line sh#(|)#uld use the HTML c#(|)#mment t#(|)#ken(s).
"#}, ":lang htmlC#[|o]#mment t#(|o)#ggle #(|o)#n this line sh#(|o)#uld use the HTML c#(|o)#mment t#(|o)#ken(s).
"#}, )) .await?; // Many single-selections test(( indoc! {r#"\C#[|o]#mment t#(|o)#ggle #(|o)#n this line sh#(|o)#uld use the HTML c#(|o)#mment t#(|o)#ken(s).
"#}, ":lang htmlC#[|]#mment t#(|)#ggle #(|)#n this line sh#(|)#uld use the HTML c#(|)#mment t#(|)#ken(s).
"#}, )) .await?; test(( indoc! {r#"\C#[|]#mment t#(|)#ggle #(|)#n this line sh#(|)#uld use the HTML c#(|)#mment t#(|)#ken(s).
"#}, ":lang htmlC#[|o]#mment t#(|o)#ggle #(|o)#n this line sh#(|o)#uld use the HTML c#(|o)#mment t#(|o)#ken(s).
"#}, )) .await?; Ok(()) } /// A selection that spans across several injections takes comment tokens /// from the injection with the bigger scope #[tokio::test(flavor = "multi_thread")] async fn test_injected_comment_tokens_selection_across_different_layers() -> anyhow::Result<()> { test(( indoc! {r#"\Comment tog#[|gle on this line should use the HTML comment token(s).
"#}, ":lang htmlComment tog#[|gle on this line should use the HTML comment token(s).
"#}, ":lang htmlComment tog#[|]#le on this line should use the javascript comment token(s).
foo();
"#},
))
.await?;
Ok(())
}
#[tokio::test(flavor = "multi_thread")]
async fn test_join_selections_comment() -> anyhow::Result<()> {
test((
indoc! {"\
/// #[a|]#bc
/// def
"},
":lang rust