1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668
|
// This file is part of the uutils coreutils package.
//
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
// spell-checker:ignore (ToDO) Sdivide
use jiff::{Timestamp, ToSpan};
use regex::Regex;
use std::fs::metadata;
use uutests::new_ucmd;
use uutests::util::UCommand;
const DATE_TIME_FORMAT_DEFAULT: &str = "%Y-%m-%d %H:%M";
fn file_last_modified_time_format(ucmd: &UCommand, path: &str, format: &str) -> String {
let tmp_dir_path = ucmd.get_full_fixture_path(path);
metadata(tmp_dir_path)
.and_then(|meta| meta.modified())
.map(|mtime| {
let dt: Timestamp = mtime.try_into().unwrap();
dt.strftime(format).to_string()
})
.unwrap_or_default()
}
fn file_last_modified_time(ucmd: &UCommand, path: &str) -> String {
file_last_modified_time_format(ucmd, path, DATE_TIME_FORMAT_DEFAULT)
}
fn all_minutes(from: Timestamp, to: Timestamp) -> Vec<String> {
let to = to + 1.minute();
let mut vec = vec![];
let mut current = from;
while current < to {
vec.push(current.strftime(DATE_TIME_FORMAT_DEFAULT).to_string());
current += 1.minute();
}
vec
}
fn valid_last_modified_template_vars(from: Timestamp) -> Vec<Vec<(String, String)>> {
all_minutes(from, Timestamp::now())
.into_iter()
.map(|time| vec![("{last_modified_time}".to_string(), time)])
.collect()
}
#[test]
fn test_invalid_flag() {
new_ucmd!()
.arg("--invalid-argument")
.fails_with_code(1)
.no_stdout();
}
#[test]
fn test_without_any_options() {
let test_file_path = "test_one_page.log";
let expected_test_file_path = "test_one_page.log.expected";
let mut scenario = new_ucmd!();
let value = file_last_modified_time(&scenario, test_file_path);
scenario
.args(&[test_file_path])
.succeeds()
.stdout_is_templated_fixture(expected_test_file_path, &[("{last_modified_time}", &value)]);
}
#[test]
fn test_with_numbering_option_with_number_width() {
let test_file_path = "test_num_page.log";
let expected_test_file_path = "test_num_page_2.log.expected";
let mut scenario = new_ucmd!();
let value = file_last_modified_time(&scenario, test_file_path);
scenario
.args(&["-n", "2", test_file_path])
.succeeds()
.stdout_is_templated_fixture(expected_test_file_path, &[("{last_modified_time}", &value)]);
}
#[test]
fn test_with_long_header_option() {
let whitespace = " ".repeat(21);
let blank_lines = "\n".repeat(61);
let datetime_pattern = r"\d\d\d\d-\d\d-\d\d \d\d:\d\d";
let pattern =
format!("\n\n{datetime_pattern}{whitespace}new file{whitespace}Page 1\n\n\na{blank_lines}");
let regex = Regex::new(&pattern).unwrap();
new_ucmd!()
.args(&["-h", "new file"])
.pipe_in("a")
.succeeds()
.stdout_matches(®ex);
new_ucmd!()
.args(&["--header=new file"])
.pipe_in("a")
.succeeds()
.stdout_matches(®ex);
}
#[test]
fn test_with_double_space_option() {
let test_file_path = "test_one_page.log";
let expected_test_file_path = "test_one_page_double_line.log.expected";
for arg in ["-d", "--double-space"] {
let mut scenario = new_ucmd!();
let value = file_last_modified_time(&scenario, test_file_path);
scenario
.args(&[arg, test_file_path])
.succeeds()
.stdout_is_templated_fixture(
expected_test_file_path,
&[("{last_modified_time}", &value)],
);
}
}
#[test]
fn test_with_first_line_number_option() {
let test_file_path = "test_one_page.log";
let expected_test_file_path = "test_one_page_first_line.log.expected";
let mut scenario = new_ucmd!();
let value = file_last_modified_time(&scenario, test_file_path);
scenario
.args(&["-N", "5", "-n", test_file_path])
.succeeds()
.stdout_is_templated_fixture(expected_test_file_path, &[("{last_modified_time}", &value)]);
}
#[test]
fn test_with_first_line_number_long_option() {
let test_file_path = "test_one_page.log";
let expected_test_file_path = "test_one_page_first_line.log.expected";
let mut scenario = new_ucmd!();
let value = file_last_modified_time(&scenario, test_file_path);
scenario
.args(&["--first-line-number=5", "-n", test_file_path])
.succeeds()
.stdout_is_templated_fixture(expected_test_file_path, &[("{last_modified_time}", &value)]);
}
#[test]
fn test_with_number_option_with_custom_separator_char() {
let test_file_path = "test_num_page.log";
let expected_test_file_path = "test_num_page_char.log.expected";
let mut scenario = new_ucmd!();
let value = file_last_modified_time(&scenario, test_file_path);
scenario
.args(&["-nc", test_file_path])
.succeeds()
.stdout_is_templated_fixture(expected_test_file_path, &[("{last_modified_time}", &value)]);
}
#[test]
fn test_with_number_option_with_custom_separator_char_and_width() {
let test_file_path = "test_num_page.log";
let expected_test_file_path = "test_num_page_char_one.log.expected";
let mut scenario = new_ucmd!();
let value = file_last_modified_time(&scenario, test_file_path);
scenario
.args(&["-nc1", test_file_path])
.succeeds()
.stdout_is_templated_fixture(expected_test_file_path, &[("{last_modified_time}", &value)]);
}
#[test]
fn test_with_valid_page_ranges() {
let test_file_path = "test_num_page.log";
let mut scenario = new_ucmd!();
scenario
.args(&["--pages=20:5", test_file_path])
.fails()
.stderr_is("pr: invalid --pages argument '20:5'\n")
.stdout_is("");
new_ucmd!()
.args(&["--pages=1:5", test_file_path])
.succeeds();
new_ucmd!().args(&["--pages=1", test_file_path]).succeeds();
new_ucmd!()
.args(&["--pages=-1:5", test_file_path])
.fails()
.stderr_is("pr: invalid --pages argument '-1:5'\n")
.stdout_is("");
new_ucmd!()
.args(&["--pages=1:-5", test_file_path])
.fails()
.stderr_is("pr: invalid --pages argument '1:-5'\n")
.stdout_is("");
new_ucmd!()
.args(&["--pages=5:1", test_file_path])
.fails()
.stderr_is("pr: invalid --pages argument '5:1'\n")
.stdout_is("");
}
#[test]
fn test_with_page_range() {
let test_file_path = "test.log";
let expected_test_file_path = "test_page_range_1.log.expected";
let expected_test_file_path1 = "test_page_range_2.log.expected";
for arg in ["--pages=15", "+15"] {
let mut scenario = new_ucmd!();
let value = file_last_modified_time(&scenario, test_file_path);
scenario
.args(&[arg, test_file_path])
.succeeds()
.stdout_is_templated_fixture(
expected_test_file_path,
&[("{last_modified_time}", &value)],
);
}
for arg in ["--pages=15:17", "+15:17"] {
let mut scenario = new_ucmd!();
let value = file_last_modified_time(&scenario, test_file_path);
scenario
.args(&[arg, test_file_path])
.succeeds()
.stdout_is_templated_fixture(
expected_test_file_path1,
&[("{last_modified_time}", &value)],
);
}
}
#[test]
fn test_with_no_header_trailer_option() {
let test_file_path = "test_one_page.log";
let expected_test_file_path = "test_one_page_no_ht.log.expected";
let mut scenario = new_ucmd!();
let value = file_last_modified_time(&scenario, test_file_path);
scenario
.args(&["-t", test_file_path])
.succeeds()
.stdout_is_templated_fixture(expected_test_file_path, &[("{last_modified_time}", &value)]);
}
#[test]
fn test_with_page_length_option() {
let test_file_path = "test.log";
for (arg, expected) in [
("100", "test_page_length.log.expected"),
("5", "test_page_length1.log.expected"),
] {
let mut scenario = new_ucmd!();
let value = file_last_modified_time(&scenario, test_file_path);
scenario
.args(&["--pages=2:3", "-l", arg, "-n", test_file_path])
.succeeds()
.stdout_is_templated_fixture(expected, &[("{last_modified_time}", &value)]);
}
}
#[test]
fn test_with_suppress_error_option() {
let test_file_path = "test_num_page.log";
let mut scenario = new_ucmd!();
scenario
.args(&["--pages=20:5", "-r", test_file_path])
.fails()
.stderr_is("")
.stdout_is("");
}
#[test]
fn test_with_stdin() {
let expected_file_path = "stdin.log.expected";
let mut scenario = new_ucmd!();
let start = Timestamp::now();
scenario
.pipe_in_fixture("stdin.log")
.args(&["--pages=1:2", "-n", "-"])
.succeeds()
.stdout_is_templated_fixture_any(
expected_file_path,
&valid_last_modified_template_vars(start),
);
}
#[test]
fn test_with_column() {
let test_file_path = "column.log";
let expected_test_file_path = "column.log.expected";
for arg in ["-3", "--column=3"] {
let mut scenario = new_ucmd!();
let value = file_last_modified_time(&scenario, test_file_path);
scenario
.args(&["--pages=3:5", arg, "-n", test_file_path])
.succeeds()
.stdout_is_templated_fixture(
expected_test_file_path,
&[("{last_modified_time}", &value)],
);
}
}
#[test]
fn test_with_column_across_option() {
let test_file_path = "column.log";
let expected_test_file_path = "column_across.log.expected";
let mut scenario = new_ucmd!();
let value = file_last_modified_time(&scenario, test_file_path);
scenario
.args(&["--pages=3:5", "--column=3", "-a", "-n", test_file_path])
.succeeds()
.stdout_is_templated_fixture(expected_test_file_path, &[("{last_modified_time}", &value)]);
}
#[test]
fn test_with_column_across_option_and_column_separator() {
let test_file_path = "column.log";
for (arg, expected) in [
("-s|", "column_across_sep.log.expected"),
("-Sdivide", "column_across_sep1.log.expected"),
] {
let mut scenario = new_ucmd!();
let value = file_last_modified_time(&scenario, test_file_path);
scenario
.args(&["--pages=3:5", "--column=3", arg, "-a", "-n", test_file_path])
.succeeds()
.stdout_is_templated_fixture(expected, &[("{last_modified_time}", &value)]);
}
}
#[test]
fn test_with_mpr() {
let test_file_path = "column.log";
let test_file_path1 = "hosts.log";
let expected_test_file_path = "mpr.log.expected";
let expected_test_file_path1 = "mpr1.log.expected";
let expected_test_file_path2 = "mpr2.log.expected";
let start = Timestamp::now();
new_ucmd!()
.args(&["--pages=1:2", "-m", "-n", test_file_path, test_file_path1])
.succeeds()
.stdout_is_templated_fixture_any(
expected_test_file_path,
&valid_last_modified_template_vars(start),
);
let start = Timestamp::now();
new_ucmd!()
.args(&["--pages=2:4", "-m", "-n", test_file_path, test_file_path1])
.succeeds()
.stdout_is_templated_fixture_any(
expected_test_file_path1,
&valid_last_modified_template_vars(start),
);
let start = Timestamp::now();
new_ucmd!()
.args(&[
"--pages=1:2",
"-l",
"100",
"-n",
"-m",
test_file_path,
test_file_path1,
test_file_path,
])
.succeeds()
.stdout_is_templated_fixture_any(
expected_test_file_path2,
&valid_last_modified_template_vars(start),
);
}
#[test]
fn test_with_mpr_and_column_options() {
let test_file_path = "column.log";
new_ucmd!()
.args(&["--column=2", "-m", "-n", test_file_path])
.fails()
.stderr_is("pr: cannot specify number of columns when printing in parallel\n")
.stdout_is("");
new_ucmd!()
.args(&["-a", "-m", "-n", test_file_path])
.fails()
.stderr_is("pr: cannot specify both printing across and printing in parallel\n")
.stdout_is("");
}
#[test]
fn test_with_offset_space_option() {
let test_file_path = "column.log";
let expected_test_file_path = "column_spaces_across.log.expected";
let mut scenario = new_ucmd!();
let value = file_last_modified_time(&scenario, test_file_path);
scenario
.args(&[
"-o",
"5",
"--pages=3:5",
"--column=3",
"-a",
"-n",
test_file_path,
])
.succeeds()
.stdout_is_templated_fixture(expected_test_file_path, &[("{last_modified_time}", &value)]);
}
#[test]
fn test_with_date_format() {
let whitespace = " ".repeat(50);
let blank_lines = "\n".repeat(61);
let datetime_pattern = r"\d{4}__\d{10}";
let pattern = format!("\n\n{datetime_pattern}{whitespace}Page 1\n\n\na{blank_lines}");
let regex = Regex::new(&pattern).unwrap();
new_ucmd!()
.args(&["-D", "%Y__%s"])
.pipe_in("a")
.succeeds()
.stdout_matches(®ex);
// "Format" doesn't need to contain any replaceable token.
let whitespace = " ".repeat(60);
let blank_lines = "\n".repeat(61);
new_ucmd!()
.args(&["-D", "Hello!"])
.pipe_in("a")
.succeeds()
.stdout_only(format!("\n\nHello!{whitespace}Page 1\n\n\na{blank_lines}"));
// Long option also works
new_ucmd!()
.args(&["--date-format=Hello!"])
.pipe_in("a")
.succeeds()
.stdout_only(format!("\n\nHello!{whitespace}Page 1\n\n\na{blank_lines}"));
// Option takes precedence over environment variables
new_ucmd!()
.env("POSIXLY_CORRECT", "1")
.env("LC_TIME", "POSIX")
.args(&["--date-format=Hello!"])
.pipe_in("a")
.succeeds()
.stdout_only(format!("\n\nHello!{whitespace}Page 1\n\n\na{blank_lines}"));
}
#[test]
fn test_with_date_format_env() {
// POSIXLY_CORRECT + LC_ALL/TIME=POSIX uses "%b %e %H:%M %Y" date format
let whitespace = " ".repeat(49);
let blank_lines = "\n".repeat(61);
let datetime_pattern = r"[A-Z][a-z][a-z] [ \d]\d \d\d:\d\d \d{4}";
let pattern = format!("\n\n{datetime_pattern}{whitespace}Page 1\n\n\na{blank_lines}");
let regex = Regex::new(&pattern).unwrap();
new_ucmd!()
.env("POSIXLY_CORRECT", "1")
.env("LC_ALL", "POSIX")
.pipe_in("a")
.succeeds()
.stdout_matches(®ex);
new_ucmd!()
.env("POSIXLY_CORRECT", "1")
.env("LC_TIME", "POSIX")
.pipe_in("a")
.succeeds()
.stdout_matches(®ex);
// But not if POSIXLY_CORRECT/LC_ALL is something else.
let whitespace = " ".repeat(50);
let datetime_pattern = r"\d\d\d\d-\d\d-\d\d \d\d:\d\d";
let pattern = format!("\n\n{datetime_pattern}{whitespace}Page 1\n\n\na{blank_lines}");
let regex = Regex::new(&pattern).unwrap();
new_ucmd!()
.env("LC_TIME", "POSIX")
.pipe_in("a")
.succeeds()
.stdout_matches(®ex);
new_ucmd!()
.env("POSIXLY_CORRECT", "1")
.env("LC_TIME", "C")
.pipe_in("a")
.succeeds()
.stdout_matches(®ex);
}
#[test]
fn test_with_join_lines_option() {
let test_file_1 = "hosts.log";
let test_file_2 = "test.log";
let expected_file_path = "joined.log.expected";
let mut scenario = new_ucmd!();
let start = Timestamp::now();
scenario
.args(&["+1:2", "-J", "-m", test_file_1, test_file_2])
.succeeds()
.stdout_is_templated_fixture_any(
expected_file_path,
&valid_last_modified_template_vars(start),
);
}
#[test]
fn test_value_for_number_lines() {
// *5 is of the form [SEP[NUMBER]] so is accepted and succeeds
new_ucmd!().args(&["-n", "*5", "test.log"]).succeeds();
// a is of the form [SEP[NUMBER]] so is accepted and succeeds
new_ucmd!().args(&["-n", "a", "test.log"]).succeeds();
// foo5.txt is of not the form [SEP[NUMBER]] so is not used as value.
// Therefore, pr tries to access the file, which does not exist.
new_ucmd!().args(&["-n", "foo5.txt", "test.log"]).fails();
}
#[test]
fn test_header_formatting_with_custom_date_format() {
// This test verifies that the header is properly formatted with:
// - Date/time on the left
// - Filename centered
// - "Page X" on the right
// This matches GNU pr behavior for the time-style test
let test_file_path = "test_one_page.log";
// Set a specific date format like in the GNU test
let output = new_ucmd!()
.args(&["-D", "+%Y-%m-%d %H:%M:%S %z (%Z)", test_file_path])
.succeeds()
.stdout_move_str();
// Extract the header line (3rd line of output)
let lines: Vec<&str> = output.lines().collect();
assert!(
lines.len() >= 5,
"Output should have at least 5 lines for header"
);
let header_line = lines[2];
// The header should be 72 characters wide (default page width)
assert_eq!(header_line.chars().count(), 72);
// Check that it contains the expected parts
assert!(header_line.contains(test_file_path));
assert!(header_line.contains("Page 1"));
// Verify the filename is roughly centered
let filename_pos = header_line.find(test_file_path).unwrap();
let page_pos = header_line.find("Page 1").unwrap();
// Filename should be somewhere in the middle third of the line
assert!(filename_pos > 24 && filename_pos < 48);
// Page should be right-aligned (near the end)
assert!(page_pos >= 60);
}
#[test]
fn test_help() {
new_ucmd!().arg("--help").succeeds();
}
#[test]
fn test_version() {
new_ucmd!().arg("--version").succeeds();
}
#[cfg(unix)]
#[test]
fn test_pr_char_device_dev_null() {
new_ucmd!().arg("/dev/null").succeeds();
}
#[test]
fn test_b_flag_backwards_compat() {
// -b is a no-op for backwards compatibility (column-down is now the default)
new_ucmd!().args(&["-b", "-t"]).pipe_in("a\nb\n").succeeds();
}
#[test]
fn test_page_header_width() {
let whitespace = " ".repeat(50);
let blank_lines = "\n".repeat(61);
let datetime_pattern = r"\d\d\d\d-\d\d-\d\d \d\d:\d\d";
let pattern = format!("\n\n{datetime_pattern}{whitespace}Page 1\n\n\na{blank_lines}");
let regex = Regex::new(&pattern).unwrap();
new_ucmd!().pipe_in("a").succeeds().stdout_matches(®ex);
}
#[test]
fn test_separator_options_default_values() {
// -s and -S without arguments should use default values (TAB and space)
// TODO: verify output matches GNU pr behavior
new_ucmd!()
.args(&["-t", "-2", "-s"])
.pipe_in("a\nb\n")
.succeeds();
new_ucmd!()
.args(&["-t", "-2", "-S"])
.pipe_in("a\nb\n")
.succeeds();
}
#[test]
fn test_omit_pagination_option() {
// -T/--omit-pagination omits headers/trailers and eliminates form feeds
// TODO: verify output matches GNU pr behavior (form feed elimination)
new_ucmd!().args(&["-T"]).pipe_in("a\nb\n").succeeds();
new_ucmd!()
.args(&["--omit-pagination"])
.pipe_in("a\nb\n")
.succeeds();
}
#[test]
fn test_form_feed_newlines() {
// Here we define the expected output.
//
// Each page should have the same number of blank lines before the
// form-feed character.
let whitespace = " ".repeat(50);
let datetime_pattern = r"\d\d\d\d-\d\d-\d\d \d\d:\d\d";
let page1 = format!("\n\n{datetime_pattern}{whitespace}Page 1\n\n\n\n\x0c");
let page2 = format!("\n\n{datetime_pattern}{whitespace}Page 2\n\n\n\n\x0c");
let pattern = format!("{page1}{page2}");
let regex = Regex::new(&pattern).unwrap();
// Command line: `printf "\f\f" | pr -f`.
//
// Escape code `\x0c` in a Rust string literal is the ASCII escape
// code `\f` for the "form feed" character (which appears like
// `^L` in the terminal).
new_ucmd!()
.arg("-f")
.pipe_in("\x0c\x0c")
.succeeds()
.stdout_matches(®ex);
}
#[test]
fn test_new_line_followed_by_form_feed() {
// Here we define the expected output.
let whitespace = " ".repeat(50);
let datetime_pattern = r"\d\d\d\d-\d\d-\d\d \d\d:\d\d";
let pattern = format!("\n\n{datetime_pattern}{whitespace}Page 1\n\n\nabc\n\x0c");
let regex = Regex::new(&pattern).unwrap();
// Command line: `printf "abc\n\f" | pr -f`.
new_ucmd!()
.arg("-f")
.pipe_in("abc\n\x0c")
.succeeds()
.stdout_matches(®ex);
}
#[test]
fn test_form_feed_followed_by_new_line() {
// Here we define the expected output.
let whitespace = " ".repeat(50);
let datetime_pattern = r"\d\d\d\d-\d\d-\d\d \d\d:\d\d";
let blank_lines_61 = "\n".repeat(61);
let blank_lines_60 = "\n".repeat(60);
let page1 = format!("\n\n{datetime_pattern}{whitespace}Page 1\n\n\n{blank_lines_61}");
let page2 = format!("\n\n{datetime_pattern}{whitespace}Page 2\n\n\nabc\n{blank_lines_60}");
let pattern = format!("{page1}{page2}");
let regex = Regex::new(&pattern).unwrap();
// Command line: `printf "\f\nabc" | pr`.
new_ucmd!()
.pipe_in("\x0c\nabc")
.succeeds()
.stdout_matches(®ex);
}
|