1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 03:27:44 +00:00

expr: Remove useless arg in enum variant

This commit is contained in:
Dorian Peron 2025-02-25 01:23:28 +01:00 committed by Sylvestre Ledru
parent 985ac3b381
commit a9d8eed217
3 changed files with 12 additions and 12 deletions

View file

@ -48,8 +48,8 @@ pub enum ExprError {
UnmatchedOpeningBrace, UnmatchedOpeningBrace,
#[error("Unmatched ) or \\}}")] #[error("Unmatched ) or \\}}")]
UnmatchedClosingBrace, UnmatchedClosingBrace,
#[error("Invalid content of {0}")] #[error("Invalid content of \\{{\\}}")]
InvalidContent(String), InvalidBracketContent,
} }
impl UError for ExprError { impl UError for ExprError {

View file

@ -264,7 +264,7 @@ fn check_posix_regex_errors(pattern: &str) -> ExprResult<()> {
(true, true, false) => Ok(()), (true, true, false) => Ok(()),
(_, false, _) => Err(ExprError::UnmatchedOpeningBrace), (_, false, _) => Err(ExprError::UnmatchedOpeningBrace),
(false, _, _) => Err(ExprError::UnmatchedOpeningParenthesis), (false, _, _) => Err(ExprError::UnmatchedOpeningParenthesis),
(true, true, true) => Err(ExprError::InvalidContent(r"\{\}".to_string())), (true, true, true) => Err(ExprError::InvalidBracketContent),
} }
} }
@ -601,7 +601,7 @@ pub fn is_truthy(s: &NumOrStr) -> bool {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use crate::ExprError; use crate::ExprError;
use crate::ExprError::InvalidContent; use crate::ExprError::InvalidBracketContent;
use super::{check_posix_regex_errors, AstNode, BinOp, NumericOp, RelationOp, StringOp}; use super::{check_posix_regex_errors, AstNode, BinOp, NumericOp, RelationOp, StringOp};
@ -795,7 +795,7 @@ mod test {
fn check_regex_empty_repeating_pattern() { fn check_regex_empty_repeating_pattern() {
assert_eq!( assert_eq!(
check_posix_regex_errors("ab\\{\\}"), check_posix_regex_errors("ab\\{\\}"),
Err(InvalidContent(r"\{\}".to_string())) Err(InvalidBracketContent)
) )
} }
@ -804,27 +804,27 @@ mod test {
assert_eq!( assert_eq!(
// out of order // out of order
check_posix_regex_errors("ab\\{1,0\\}"), check_posix_regex_errors("ab\\{1,0\\}"),
Err(InvalidContent(r"\{\}".to_string())) Err(InvalidBracketContent)
); );
assert_eq!( assert_eq!(
check_posix_regex_errors("ab\\{1,a\\}"), check_posix_regex_errors("ab\\{1,a\\}"),
Err(InvalidContent(r"\{\}".to_string())) Err(InvalidBracketContent)
); );
assert_eq!( assert_eq!(
check_posix_regex_errors("ab\\{a,3\\}"), check_posix_regex_errors("ab\\{a,3\\}"),
Err(InvalidContent(r"\{\}".to_string())) Err(InvalidBracketContent)
); );
assert_eq!( assert_eq!(
check_posix_regex_errors("ab\\{a,b\\}"), check_posix_regex_errors("ab\\{a,b\\}"),
Err(InvalidContent(r"\{\}".to_string())) Err(InvalidBracketContent)
); );
assert_eq!( assert_eq!(
check_posix_regex_errors("ab\\{a,\\}"), check_posix_regex_errors("ab\\{a,\\}"),
Err(InvalidContent(r"\{\}".to_string())) Err(InvalidBracketContent)
); );
assert_eq!( assert_eq!(
check_posix_regex_errors("ab\\{,b\\}"), check_posix_regex_errors("ab\\{,b\\}"),
Err(InvalidContent(r"\{\}".to_string())) Err(InvalidBracketContent)
); );
} }
} }

View file

@ -677,7 +677,7 @@ mod gnu_expr {
.stdout_only("\n"); .stdout_only("\n");
} }
#[ignore] #[ignore = "rust-onig bug, see https://github.com/rust-onig/rust-onig/issues/188"]
#[test] #[test]
fn test_bre10() { fn test_bre10() {
new_ucmd!() new_ucmd!()