From dad3efc07d428fb36be8d5c4cec89c5490fa14a4 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Fri, 17 Feb 2023 00:44:47 +0100 Subject: [PATCH] fix up head and tail --- tests/coreutils/head.rs | 10 ++++------ tests/coreutils/tail.rs | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/tests/coreutils/head.rs b/tests/coreutils/head.rs index d34f753..5498836 100644 --- a/tests/coreutils/head.rs +++ b/tests/coreutils/head.rs @@ -29,7 +29,7 @@ where } // Parse the shorthand by turning it into a String (via OsString) - // The format we're parsing is `{+/-}[NUM][bcl][f]`. + // The format we're parsing is `-[NUM][bkm][cqv]`. let os_string = shorthand.into(); // The part of the string that is not parsed yet @@ -58,10 +58,8 @@ where let num = rest[..end_num].parse().unwrap_or(10); rest = &rest[end_num..]; - // Parse the optional size modifier - // Parse the other options (`-c`, `-q`, `-v`), which can appear any number - // of times. `-z` is also supported, though that is undocumented. + // of times. `-z` is also supported, though that is undocumented in GNU. let mut mode = Mode::Lines; let mut verbose = false; let mut zero = false; @@ -76,7 +74,7 @@ where } Some(Settings { - number: SigNum::Positive(num), + number: SigNum::Negative(num), mode, inputs: vec![input.into().into()], verbose, @@ -161,7 +159,7 @@ impl Value for SigNum { let number = match multiplier.and_then(|m| m.checked_mul(num)) { Some(number) => number, - None => return Err("Value too large for defined data type".into()) + None => return Err("Value too large for defined data type".into()), }; Ok(sign(number)) diff --git a/tests/coreutils/tail.rs b/tests/coreutils/tail.rs index 037f5f0..244dfcb 100644 --- a/tests/coreutils/tail.rs +++ b/tests/coreutils/tail.rs @@ -200,7 +200,7 @@ impl Value for SigNum { let number = match multiplier.and_then(|m| m.checked_mul(num)) { Some(number) => number, - None => return Err("Value too large for defined data type".into()) + None => return Err("Value too large for defined data type".into()), }; Ok(sign(number))