Skip to content

Commit

Permalink
continue-comments: adding test
Browse files Browse the repository at this point in the history
  • Loading branch information
TornaxO7 committed Oct 7, 2024
1 parent b7f9780 commit 5b9613c
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions helix-core/src/comment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -487,8 +487,8 @@ mod test {
assert_eq!(doc, "");
}

// Test, if `get_comment_tokens` works, even if the content of the file includes chars, whose
// byte size unequal the amount of chars
/// Test, if `get_comment_tokens` works, even if the content of the file includes chars, whose
/// byte size unequal the amount of chars
#[test]
fn test_get_comment_with_char_boundaries() {
let rope = Rope::from("··");
Expand All @@ -499,4 +499,19 @@ mod test {
None
);
}

/// Test for `get_comment_token`.
///
/// Assuming the comment tokens are stored as `["///", "//"]`, `get_comment_token` should still
/// return `///` instead of `//` if the user is in a doc-comment section.
#[test]
fn test_use_longest_comment() {
let text = Rope::from(" /// amogus");
let tokens = ["///", "//"];

assert_eq!(
super::get_comment_token(text.slice(..), tokens.as_slice(), 0),
Some("///")
);
}
}

0 comments on commit 5b9613c

Please sign in to comment.