Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/uu/pr/src/pr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1443,7 +1443,7 @@ fn write_page(
writer.write_all(line_separator)?;
}
}
if options.display_header_and_trailer || options.form_feed_used {
if options.display_header_and_trailer {
writer.write_all(page_separator)?;
}
writer.flush()?;
Expand Down
20 changes: 13 additions & 7 deletions tests/by-util/test_pr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -972,6 +972,17 @@ fn test_form_feed_newlines() {
.stdout_matches(&regex);
}

#[test]
fn test_form_feed_and_omit_header() {
for args in [&["-t", "-f"], &["-t", "-F"], &["-T", "-F"], &["-T", "-f"]] {
new_ucmd!()
.args(args)
.pipe_in("a\nb\n")
.succeeds()
.stdout_is("a\nb\n");
}
}

#[test]
fn test_new_line_followed_by_form_feed() {
// Here we define the expected output.
Expand Down Expand Up @@ -1216,17 +1227,12 @@ fn test_simple_expand_tab() {
fn test_expand_tab_at_end_of_short_flag_cluster() {
// `-e` closing a cluster of value-less short flags carries no attached argument, so it has
// to fall back to the defaults rather than report a missing value.
for (arg, expected) in [
("-tre", "oi\n"),
("-tre8", "oi\n"),
("-tfre", "oi\n\x0c"),
("-tfre8", "oi\n\x0c"),
] {
for arg in ["-tre", "-tre8", "-tfre", "-tfre8"] {
new_ucmd!()
.arg(arg)
.pipe_in("oi\n")
.succeeds()
.stdout_only(expected);
.stdout_only("oi\n");
}
}

Expand Down
Loading