Skip to content

Commit

Permalink
refill: Add test for refilling text with tabs
Browse files Browse the repository at this point in the history
The `width` in the test depends on how wide `textfill` considers tabs
to be (see mgeisler#419), and this test will fail if and/or when this changes.
  • Loading branch information
LiterallyVoid committed May 10, 2024
1 parent 39914e0 commit b21b85a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/refill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,17 @@ mod tests {
assert_eq!(options.subsequent_indent, " // ");
}

#[test]
fn unfill_tabs() {
let (text, options) = unfill("\t// foo bar\n\t// baz");
assert_eq!(text, "foo bar baz");
// The resulting width includes the width of a tab character, which is
// currently zero (see #419).
assert_eq!(options.width, 11);
assert_eq!(options.initial_indent, "\t// ");
assert_eq!(options.subsequent_indent, "\t// ");
}

#[test]
fn unfill_block_quote() {
let (text, options) = unfill("> foo\n> bar\n> baz");
Expand Down

0 comments on commit b21b85a

Please sign in to comment.