mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
expr: Add tests for is_valid_range_quantifier
function
This commit is contained in:
parent
4ee93ed6d8
commit
837bab24c1
1 changed files with 19 additions and 0 deletions
|
@ -793,6 +793,7 @@ pub fn is_truthy(s: &NumOrStr) -> bool {
|
|||
mod test {
|
||||
use crate::ExprError;
|
||||
use crate::ExprError::InvalidBracketContent;
|
||||
use crate::syntax_tree::is_valid_range_quantifier;
|
||||
|
||||
use super::{
|
||||
AstNode, AstNodeInner, BinOp, NumericOp, RelationOp, StringOp, check_posix_regex_errors,
|
||||
|
@ -1041,4 +1042,22 @@ mod test {
|
|||
Err(InvalidBracketContent)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_is_valid_range_quantifier() {
|
||||
assert!(is_valid_range_quantifier(&"3\\}".chars()));
|
||||
assert!(is_valid_range_quantifier(&"3,\\}".chars()));
|
||||
assert!(is_valid_range_quantifier(&",6\\}".chars()));
|
||||
assert!(is_valid_range_quantifier(&"3,6\\}".chars()));
|
||||
assert!(is_valid_range_quantifier(&",\\}".chars()));
|
||||
assert!(is_valid_range_quantifier(&"3,6\\}anything".chars()));
|
||||
assert!(!is_valid_range_quantifier(&"\\{3,6\\}".chars()));
|
||||
assert!(!is_valid_range_quantifier(&"\\}".chars()));
|
||||
assert!(!is_valid_range_quantifier(&"".chars()));
|
||||
assert!(!is_valid_range_quantifier(&"3".chars()));
|
||||
assert!(!is_valid_range_quantifier(&"3,".chars()));
|
||||
assert!(!is_valid_range_quantifier(&",6".chars()));
|
||||
assert!(!is_valid_range_quantifier(&"3,6".chars()));
|
||||
assert!(!is_valid_range_quantifier(&",".chars()));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue