Skip to content

Commit

Permalink
fix CI: generate doctest
Browse files Browse the repository at this point in the history
  • Loading branch information
Young-Flash committed Oct 12, 2023
1 parent a7fada4 commit 3605bb3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use syntax::ast::{self, AstNode};

use crate::{AssistContext, AssistId, AssistKind, Assists};

// Assist: replace_is_some_with_if_let
// Assist: replace_is_some_with_if_let_some
//
// Replace `if x.is_some()` with `if let Some(_tmp) = x`.
//
Expand Down Expand Up @@ -57,7 +57,7 @@ mod tests {
use super::replace_is_some_with_if_let_some;

#[test]
fn replace_is_some_with_if_let_works() {
fn replace_is_some_with_if_let_some_works() {
check_assist(
replace_is_some_with_if_let_some,
r#"
Expand All @@ -76,7 +76,7 @@ fn main() {
}

#[test]
fn replace_is_some_with_if_let_not_applicable() {
fn replace_is_some_with_if_let_some_not_applicable() {
check_assist_not_applicable(
replace_is_some_with_if_let_some,
r#"
Expand Down
19 changes: 19 additions & 0 deletions crates/ide-assists/src/tests/generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2558,6 +2558,25 @@ fn handle(action: Action) {
)
}

#[test]
fn doctest_replace_is_some_with_if_let_some() {
check_doc_test(
"replace_is_some_with_if_let_some",
r#####"
fn main() {
let x = Some(1);
if x.is_som$0e() {}
}
"#####,
r#####"
fn main() {
let x = Some(1);
if let Some(_tmp) = x {}
}
"#####,
)
}

#[test]
fn doctest_replace_let_with_if_let() {
check_doc_test(
Expand Down

0 comments on commit 3605bb3

Please sign in to comment.