1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 19:17:43 +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,
#[error("Unmatched ) or \\}}")]
UnmatchedClosingBrace,
#[error("Invalid content of {0}")]
InvalidContent(String),
#[error("Invalid content of \\{{\\}}")]
InvalidBracketContent,
}
impl UError for ExprError {

View file

@ -264,7 +264,7 @@ fn check_posix_regex_errors(pattern: &str) -> ExprResult<()> {
(true, true, false) => Ok(()),
(_, false, _) => Err(ExprError::UnmatchedOpeningBrace),
(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)]
mod test {
use crate::ExprError;
use crate::ExprError::InvalidContent;
use crate::ExprError::InvalidBracketContent;
use super::{check_posix_regex_errors, AstNode, BinOp, NumericOp, RelationOp, StringOp};
@ -795,7 +795,7 @@ mod test {
fn check_regex_empty_repeating_pattern() {
assert_eq!(
check_posix_regex_errors("ab\\{\\}"),
Err(InvalidContent(r"\{\}".to_string()))
Err(InvalidBracketContent)
)
}
@ -804,27 +804,27 @@ mod test {
assert_eq!(
// out of order
check_posix_regex_errors("ab\\{1,0\\}"),
Err(InvalidContent(r"\{\}".to_string()))
Err(InvalidBracketContent)
);
assert_eq!(
check_posix_regex_errors("ab\\{1,a\\}"),
Err(InvalidContent(r"\{\}".to_string()))
Err(InvalidBracketContent)
);
assert_eq!(
check_posix_regex_errors("ab\\{a,3\\}"),
Err(InvalidContent(r"\{\}".to_string()))
Err(InvalidBracketContent)
);
assert_eq!(
check_posix_regex_errors("ab\\{a,b\\}"),
Err(InvalidContent(r"\{\}".to_string()))
Err(InvalidBracketContent)
);
assert_eq!(
check_posix_regex_errors("ab\\{a,\\}"),
Err(InvalidContent(r"\{\}".to_string()))
Err(InvalidBracketContent)
);
assert_eq!(
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");
}
#[ignore]
#[ignore = "rust-onig bug, see https://github.com/rust-onig/rust-onig/issues/188"]
#[test]
fn test_bre10() {
new_ucmd!()