Format code
This commit is contained in:
parent
b85e8e1b75
commit
21b308f3ae
@ -103,7 +103,7 @@ impl Context for HashMapContext {
|
|||||||
///
|
///
|
||||||
/// let ctx = evalexpr::context_map! {
|
/// let ctx = evalexpr::context_map! {
|
||||||
/// "x" => 8,
|
/// "x" => 8,
|
||||||
/// "f" => Function::new(None, Box::new(|_| Ok(42.into()) ))
|
/// "f" => Function::new(None, Box::new(|_| Ok(42.into()) ))
|
||||||
/// }.unwrap();
|
/// }.unwrap();
|
||||||
///
|
///
|
||||||
/// assert_eq!(eval_with_context("x + f()", &ctx), Ok(50.into()));
|
/// assert_eq!(eval_with_context("x + f()", &ctx), Ok(50.into()));
|
||||||
|
@ -18,7 +18,7 @@ impl fmt::Display for EvalexprError {
|
|||||||
),
|
),
|
||||||
ExpectedString { actual } => {
|
ExpectedString { actual } => {
|
||||||
write!(f, "Expected a Value::String, but got {:?}.", actual)
|
write!(f, "Expected a Value::String, but got {:?}.", actual)
|
||||||
}
|
},
|
||||||
ExpectedInt { actual } => write!(f, "Expected a Value::Int, but got {:?}.", actual),
|
ExpectedInt { actual } => write!(f, "Expected a Value::Int, but got {:?}.", actual),
|
||||||
ExpectedFloat { actual } => write!(f, "Expected a Value::Float, but got {:?}.", actual),
|
ExpectedFloat { actual } => write!(f, "Expected a Value::Float, but got {:?}.", actual),
|
||||||
ExpectedNumber { actual } => write!(
|
ExpectedNumber { actual } => write!(
|
||||||
@ -33,7 +33,7 @@ impl fmt::Display for EvalexprError {
|
|||||||
),
|
),
|
||||||
ExpectedBoolean { actual } => {
|
ExpectedBoolean { actual } => {
|
||||||
write!(f, "Expected a Value::Boolean, but got {:?}.", actual)
|
write!(f, "Expected a Value::Boolean, but got {:?}.", actual)
|
||||||
}
|
},
|
||||||
ExpectedTuple { actual } => write!(f, "Expected a Value::Tuple, but got {:?}.", actual),
|
ExpectedTuple { actual } => write!(f, "Expected a Value::Tuple, but got {:?}.", actual),
|
||||||
ExpectedEmpty { actual } => write!(f, "Expected a Value::Empty, but got {:?}.", actual),
|
ExpectedEmpty { actual } => write!(f, "Expected a Value::Empty, but got {:?}.", actual),
|
||||||
AppendedToLeafNode => write!(f, "Tried to append a node to a leaf node."),
|
AppendedToLeafNode => write!(f, "Tried to append a node to a leaf node."),
|
||||||
@ -53,7 +53,7 @@ impl fmt::Display for EvalexprError {
|
|||||||
),
|
),
|
||||||
TypeError { expected, actual } => {
|
TypeError { expected, actual } => {
|
||||||
write!(f, "Expected one of {:?}, but got {:?}.", expected, actual)
|
write!(f, "Expected one of {:?}, but got {:?}.", expected, actual)
|
||||||
}
|
},
|
||||||
UnmatchedLBrace => write!(f, "Found an unmatched opening parenthesis '('."),
|
UnmatchedLBrace => write!(f, "Found an unmatched opening parenthesis '('."),
|
||||||
UnmatchedRBrace => write!(f, "Found an unmatched closing parenthesis ')'."),
|
UnmatchedRBrace => write!(f, "Found an unmatched closing parenthesis ')'."),
|
||||||
UnmatchedPartialToken { first, second } => {
|
UnmatchedPartialToken { first, second } => {
|
||||||
@ -71,7 +71,7 @@ impl fmt::Display for EvalexprError {
|
|||||||
first
|
first
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
AdditionError { augend, addend } => write!(f, "Error adding {} + {}", augend, addend),
|
AdditionError { augend, addend } => write!(f, "Error adding {} + {}", augend, addend),
|
||||||
SubtractionError {
|
SubtractionError {
|
||||||
minuend,
|
minuend,
|
||||||
@ -84,10 +84,10 @@ impl fmt::Display for EvalexprError {
|
|||||||
} => write!(f, "Error multiplying {} * {}", multiplicand, multiplier),
|
} => write!(f, "Error multiplying {} * {}", multiplicand, multiplier),
|
||||||
DivisionError { dividend, divisor } => {
|
DivisionError { dividend, divisor } => {
|
||||||
write!(f, "Error dividing {} / {}", dividend, divisor)
|
write!(f, "Error dividing {} / {}", dividend, divisor)
|
||||||
}
|
},
|
||||||
ModulationError { dividend, divisor } => {
|
ModulationError { dividend, divisor } => {
|
||||||
write!(f, "Error modulating {} % {}", dividend, divisor)
|
write!(f, "Error modulating {} % {}", dividend, divisor)
|
||||||
}
|
},
|
||||||
InvalidRegex { regex, message } => write!(
|
InvalidRegex { regex, message } => write!(
|
||||||
f,
|
f,
|
||||||
"Regular expression {:?} is invalid: {:?}",
|
"Regular expression {:?} is invalid: {:?}",
|
||||||
|
@ -121,7 +121,7 @@ impl Operator {
|
|||||||
} else {
|
} else {
|
||||||
Ok(Value::Empty)
|
Ok(Value::Empty)
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
Add => {
|
Add => {
|
||||||
expect_operator_argument_amount(arguments.len(), 2)?;
|
expect_operator_argument_amount(arguments.len(), 2)?;
|
||||||
expect_number_or_string(&arguments[0])?;
|
expect_number_or_string(&arguments[0])?;
|
||||||
@ -147,7 +147,7 @@ impl Operator {
|
|||||||
arguments[0].as_number().unwrap() + arguments[1].as_number().unwrap(),
|
arguments[0].as_number().unwrap() + arguments[1].as_number().unwrap(),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
Sub => {
|
Sub => {
|
||||||
expect_operator_argument_amount(arguments.len(), 2)?;
|
expect_operator_argument_amount(arguments.len(), 2)?;
|
||||||
expect_number(&arguments[0])?;
|
expect_number(&arguments[0])?;
|
||||||
@ -168,7 +168,7 @@ impl Operator {
|
|||||||
arguments[0].as_number().unwrap() - arguments[1].as_number().unwrap(),
|
arguments[0].as_number().unwrap() - arguments[1].as_number().unwrap(),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
Neg => {
|
Neg => {
|
||||||
expect_operator_argument_amount(arguments.len(), 1)?;
|
expect_operator_argument_amount(arguments.len(), 1)?;
|
||||||
expect_number(&arguments[0])?;
|
expect_number(&arguments[0])?;
|
||||||
@ -183,7 +183,7 @@ impl Operator {
|
|||||||
} else {
|
} else {
|
||||||
Ok(Value::Float(-arguments[0].as_number().unwrap()))
|
Ok(Value::Float(-arguments[0].as_number().unwrap()))
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
Mul => {
|
Mul => {
|
||||||
expect_operator_argument_amount(arguments.len(), 2)?;
|
expect_operator_argument_amount(arguments.len(), 2)?;
|
||||||
expect_number(&arguments[0])?;
|
expect_number(&arguments[0])?;
|
||||||
@ -204,7 +204,7 @@ impl Operator {
|
|||||||
arguments[0].as_number().unwrap() * arguments[1].as_number().unwrap(),
|
arguments[0].as_number().unwrap() * arguments[1].as_number().unwrap(),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
Div => {
|
Div => {
|
||||||
expect_operator_argument_amount(arguments.len(), 2)?;
|
expect_operator_argument_amount(arguments.len(), 2)?;
|
||||||
expect_number(&arguments[0])?;
|
expect_number(&arguments[0])?;
|
||||||
@ -225,7 +225,7 @@ impl Operator {
|
|||||||
arguments[0].as_number().unwrap() / arguments[1].as_number().unwrap(),
|
arguments[0].as_number().unwrap() / arguments[1].as_number().unwrap(),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
Mod => {
|
Mod => {
|
||||||
expect_operator_argument_amount(arguments.len(), 2)?;
|
expect_operator_argument_amount(arguments.len(), 2)?;
|
||||||
expect_number(&arguments[0])?;
|
expect_number(&arguments[0])?;
|
||||||
@ -246,7 +246,7 @@ impl Operator {
|
|||||||
arguments[0].as_number().unwrap() % arguments[1].as_number().unwrap(),
|
arguments[0].as_number().unwrap() % arguments[1].as_number().unwrap(),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
Exp => {
|
Exp => {
|
||||||
expect_operator_argument_amount(arguments.len(), 2)?;
|
expect_operator_argument_amount(arguments.len(), 2)?;
|
||||||
expect_number(&arguments[0])?;
|
expect_number(&arguments[0])?;
|
||||||
@ -258,7 +258,7 @@ impl Operator {
|
|||||||
.unwrap()
|
.unwrap()
|
||||||
.powf(arguments[1].as_number().unwrap()),
|
.powf(arguments[1].as_number().unwrap()),
|
||||||
))
|
))
|
||||||
}
|
},
|
||||||
Eq => {
|
Eq => {
|
||||||
expect_operator_argument_amount(arguments.len(), 2)?;
|
expect_operator_argument_amount(arguments.len(), 2)?;
|
||||||
|
|
||||||
@ -267,7 +267,7 @@ impl Operator {
|
|||||||
} else {
|
} else {
|
||||||
Ok(Value::Boolean(false))
|
Ok(Value::Boolean(false))
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
Neq => {
|
Neq => {
|
||||||
expect_operator_argument_amount(arguments.len(), 2)?;
|
expect_operator_argument_amount(arguments.len(), 2)?;
|
||||||
|
|
||||||
@ -276,7 +276,7 @@ impl Operator {
|
|||||||
} else {
|
} else {
|
||||||
Ok(Value::Boolean(false))
|
Ok(Value::Boolean(false))
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
Gt => {
|
Gt => {
|
||||||
expect_operator_argument_amount(arguments.len(), 2)?;
|
expect_operator_argument_amount(arguments.len(), 2)?;
|
||||||
expect_number_or_string(&arguments[0])?;
|
expect_number_or_string(&arguments[0])?;
|
||||||
@ -301,7 +301,7 @@ impl Operator {
|
|||||||
Ok(Value::Boolean(false))
|
Ok(Value::Boolean(false))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
Lt => {
|
Lt => {
|
||||||
expect_operator_argument_amount(arguments.len(), 2)?;
|
expect_operator_argument_amount(arguments.len(), 2)?;
|
||||||
expect_number_or_string(&arguments[0])?;
|
expect_number_or_string(&arguments[0])?;
|
||||||
@ -326,7 +326,7 @@ impl Operator {
|
|||||||
Ok(Value::Boolean(false))
|
Ok(Value::Boolean(false))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
Geq => {
|
Geq => {
|
||||||
expect_operator_argument_amount(arguments.len(), 2)?;
|
expect_operator_argument_amount(arguments.len(), 2)?;
|
||||||
expect_number_or_string(&arguments[0])?;
|
expect_number_or_string(&arguments[0])?;
|
||||||
@ -351,7 +351,7 @@ impl Operator {
|
|||||||
Ok(Value::Boolean(false))
|
Ok(Value::Boolean(false))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
Leq => {
|
Leq => {
|
||||||
expect_operator_argument_amount(arguments.len(), 2)?;
|
expect_operator_argument_amount(arguments.len(), 2)?;
|
||||||
expect_number_or_string(&arguments[0])?;
|
expect_number_or_string(&arguments[0])?;
|
||||||
@ -376,7 +376,7 @@ impl Operator {
|
|||||||
Ok(Value::Boolean(false))
|
Ok(Value::Boolean(false))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
And => {
|
And => {
|
||||||
expect_operator_argument_amount(arguments.len(), 2)?;
|
expect_operator_argument_amount(arguments.len(), 2)?;
|
||||||
let a = expect_boolean(&arguments[0])?;
|
let a = expect_boolean(&arguments[0])?;
|
||||||
@ -387,7 +387,7 @@ impl Operator {
|
|||||||
} else {
|
} else {
|
||||||
Ok(Value::Boolean(false))
|
Ok(Value::Boolean(false))
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
Or => {
|
Or => {
|
||||||
expect_operator_argument_amount(arguments.len(), 2)?;
|
expect_operator_argument_amount(arguments.len(), 2)?;
|
||||||
let a = expect_boolean(&arguments[0])?;
|
let a = expect_boolean(&arguments[0])?;
|
||||||
@ -398,7 +398,7 @@ impl Operator {
|
|||||||
} else {
|
} else {
|
||||||
Ok(Value::Boolean(false))
|
Ok(Value::Boolean(false))
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
Not => {
|
Not => {
|
||||||
expect_operator_argument_amount(arguments.len(), 1)?;
|
expect_operator_argument_amount(arguments.len(), 1)?;
|
||||||
let a = expect_boolean(&arguments[0])?;
|
let a = expect_boolean(&arguments[0])?;
|
||||||
@ -408,7 +408,7 @@ impl Operator {
|
|||||||
} else {
|
} else {
|
||||||
Ok(Value::Boolean(false))
|
Ok(Value::Boolean(false))
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
Tuple => {
|
Tuple => {
|
||||||
expect_operator_argument_amount(arguments.len(), 2)?;
|
expect_operator_argument_amount(arguments.len(), 2)?;
|
||||||
if let Value::Tuple(tuple) = &arguments[0] {
|
if let Value::Tuple(tuple) = &arguments[0] {
|
||||||
@ -431,7 +431,7 @@ impl Operator {
|
|||||||
]))
|
]))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
Assign => Err(EvalexprError::ContextNotManipulable),
|
Assign => Err(EvalexprError::ContextNotManipulable),
|
||||||
Chain => {
|
Chain => {
|
||||||
if arguments.is_empty() {
|
if arguments.is_empty() {
|
||||||
@ -439,12 +439,12 @@ impl Operator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Ok(arguments.get(1).cloned().unwrap_or(Value::Empty))
|
Ok(arguments.get(1).cloned().unwrap_or(Value::Empty))
|
||||||
}
|
},
|
||||||
Const { value } => {
|
Const { value } => {
|
||||||
expect_operator_argument_amount(arguments.len(), 0)?;
|
expect_operator_argument_amount(arguments.len(), 0)?;
|
||||||
|
|
||||||
Ok(value.clone())
|
Ok(value.clone())
|
||||||
}
|
},
|
||||||
VariableIdentifier { identifier } => {
|
VariableIdentifier { identifier } => {
|
||||||
if let Some(value) = context.get_value(&identifier).cloned() {
|
if let Some(value) = context.get_value(&identifier).cloned() {
|
||||||
Ok(value)
|
Ok(value)
|
||||||
@ -453,7 +453,7 @@ impl Operator {
|
|||||||
identifier.clone(),
|
identifier.clone(),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
FunctionIdentifier { identifier } => {
|
FunctionIdentifier { identifier } => {
|
||||||
expect_operator_argument_amount(arguments.len(), 1)?;
|
expect_operator_argument_amount(arguments.len(), 1)?;
|
||||||
|
|
||||||
@ -472,7 +472,7 @@ impl Operator {
|
|||||||
identifier.clone(),
|
identifier.clone(),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -490,7 +490,7 @@ impl Operator {
|
|||||||
context.set_value(target.into(), arguments[1].clone())?;
|
context.set_value(target.into(), arguments[1].clone())?;
|
||||||
|
|
||||||
Ok(Value::Empty)
|
Ok(Value::Empty)
|
||||||
}
|
},
|
||||||
_ => self.eval(arguments, context),
|
_ => self.eval(arguments, context),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,7 @@ fn char_to_partial_token(c: char) -> PartialToken {
|
|||||||
} else {
|
} else {
|
||||||
PartialToken::Literal(c.to_string())
|
PartialToken::Literal(c.to_string())
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -233,7 +233,7 @@ fn partial_tokens_to_tokens(mut tokens: &[PartialToken]) -> EvalexprResult<Vec<T
|
|||||||
PartialToken::Token(token) => {
|
PartialToken::Token(token) => {
|
||||||
cutoff = 1;
|
cutoff = 1;
|
||||||
Some(token)
|
Some(token)
|
||||||
}
|
},
|
||||||
PartialToken::Literal(literal) => {
|
PartialToken::Literal(literal) => {
|
||||||
cutoff = 1;
|
cutoff = 1;
|
||||||
if let Ok(number) = literal.parse::<IntType>() {
|
if let Ok(number) = literal.parse::<IntType>() {
|
||||||
@ -245,38 +245,38 @@ fn partial_tokens_to_tokens(mut tokens: &[PartialToken]) -> EvalexprResult<Vec<T
|
|||||||
} else {
|
} else {
|
||||||
Some(Token::Identifier(literal.to_string()))
|
Some(Token::Identifier(literal.to_string()))
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
PartialToken::Whitespace => {
|
PartialToken::Whitespace => {
|
||||||
cutoff = 1;
|
cutoff = 1;
|
||||||
None
|
None
|
||||||
}
|
},
|
||||||
PartialToken::Eq => match second {
|
PartialToken::Eq => match second {
|
||||||
Some(PartialToken::Eq) => Some(Token::Eq),
|
Some(PartialToken::Eq) => Some(Token::Eq),
|
||||||
_ => {
|
_ => {
|
||||||
cutoff = 1;
|
cutoff = 1;
|
||||||
Some(Token::Assign)
|
Some(Token::Assign)
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
PartialToken::ExclamationMark => match second {
|
PartialToken::ExclamationMark => match second {
|
||||||
Some(PartialToken::Eq) => Some(Token::Eq),
|
Some(PartialToken::Eq) => Some(Token::Eq),
|
||||||
_ => {
|
_ => {
|
||||||
cutoff = 1;
|
cutoff = 1;
|
||||||
Some(Token::Not)
|
Some(Token::Not)
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
PartialToken::Gt => match second {
|
PartialToken::Gt => match second {
|
||||||
Some(PartialToken::Eq) => Some(Token::Geq),
|
Some(PartialToken::Eq) => Some(Token::Geq),
|
||||||
_ => {
|
_ => {
|
||||||
cutoff = 1;
|
cutoff = 1;
|
||||||
Some(Token::Gt)
|
Some(Token::Gt)
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
PartialToken::Lt => match second {
|
PartialToken::Lt => match second {
|
||||||
Some(PartialToken::Eq) => Some(Token::Leq),
|
Some(PartialToken::Eq) => Some(Token::Leq),
|
||||||
_ => {
|
_ => {
|
||||||
cutoff = 1;
|
cutoff = 1;
|
||||||
Some(Token::Lt)
|
Some(Token::Lt)
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
PartialToken::Ampersand => match second {
|
PartialToken::Ampersand => match second {
|
||||||
Some(PartialToken::Ampersand) => Some(Token::And),
|
Some(PartialToken::Ampersand) => Some(Token::And),
|
||||||
|
@ -421,7 +421,7 @@ pub(crate) fn tokens_to_operator_tree(tokens: Vec<Token>) -> EvalexprResult<Node
|
|||||||
} else {
|
} else {
|
||||||
Some(Node::new(Operator::Neg))
|
Some(Node::new(Operator::Neg))
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
Token::Star => Some(Node::new(Operator::Mul)),
|
Token::Star => Some(Node::new(Operator::Mul)),
|
||||||
Token::Slash => Some(Node::new(Operator::Div)),
|
Token::Slash => Some(Node::new(Operator::Div)),
|
||||||
Token::Percent => Some(Node::new(Operator::Mod)),
|
Token::Percent => Some(Node::new(Operator::Mod)),
|
||||||
@ -440,14 +440,14 @@ pub(crate) fn tokens_to_operator_tree(tokens: Vec<Token>) -> EvalexprResult<Node
|
|||||||
Token::LBrace => {
|
Token::LBrace => {
|
||||||
root.push(Node::root_node());
|
root.push(Node::root_node());
|
||||||
None
|
None
|
||||||
}
|
},
|
||||||
Token::RBrace => {
|
Token::RBrace => {
|
||||||
if root.len() < 2 {
|
if root.len() < 2 {
|
||||||
return Err(EvalexprError::UnmatchedRBrace);
|
return Err(EvalexprError::UnmatchedRBrace);
|
||||||
} else {
|
} else {
|
||||||
root.pop()
|
root.pop()
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
|
||||||
Token::Comma => Some(Node::new(Operator::Tuple)),
|
Token::Comma => Some(Node::new(Operator::Tuple)),
|
||||||
Token::Assign => Some(Node::new(Operator::Assign)),
|
Token::Assign => Some(Node::new(Operator::Assign)),
|
||||||
@ -463,7 +463,7 @@ pub(crate) fn tokens_to_operator_tree(tokens: Vec<Token>) -> EvalexprResult<Node
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
result
|
result
|
||||||
}
|
},
|
||||||
Token::Float(float) => Some(Node::new(Operator::value(Value::Float(float)))),
|
Token::Float(float) => Some(Node::new(Operator::value(Value::Float(float)))),
|
||||||
Token::Int(int) => Some(Node::new(Operator::value(Value::Int(int)))),
|
Token::Int(int) => Some(Node::new(Operator::value(Value::Int(int)))),
|
||||||
Token::Boolean(boolean) => Some(Node::new(Operator::value(Value::Boolean(boolean)))),
|
Token::Boolean(boolean) => Some(Node::new(Operator::value(Value::Boolean(boolean)))),
|
||||||
|
@ -21,7 +21,7 @@ impl Display for Value {
|
|||||||
value.fmt(f)?;
|
value.fmt(f)?;
|
||||||
}
|
}
|
||||||
write!(f, ")")
|
write!(f, ")")
|
||||||
}
|
},
|
||||||
Value::Empty => write!(f, "()"),
|
Value::Empty => write!(f, "()"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -311,7 +311,7 @@ fn test_regex_functions() {
|
|||||||
Err(EvalexprError::InvalidRegex { regex, message }) => {
|
Err(EvalexprError::InvalidRegex { regex, message }) => {
|
||||||
assert_eq!(regex, "[");
|
assert_eq!(regex, "[");
|
||||||
assert!(message.contains("unclosed character class"));
|
assert!(message.contains("unclosed character class"));
|
||||||
}
|
},
|
||||||
v => panic!(v),
|
v => panic!(v),
|
||||||
};
|
};
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
Loading…
Reference in New Issue
Block a user