Fix tests.

This commit is contained in:
Stephen Chung 2022-08-20 22:19:29 +08:00
parent de3b7cbbee
commit 1adc094383
2 changed files with 7 additions and 7 deletions

View File

@ -193,7 +193,7 @@ fn test_custom_syntax() -> Result<(), Box<EvalAltResult>> {
// The first symbol must be an identifier // The first symbol must be an identifier
assert_eq!( assert_eq!(
*engine *engine
.register_custom_syntax(&["!"], false, |_, _| Ok(Dynamic::UNIT)) .register_custom_syntax(["!"], false, |_, _| Ok(Dynamic::UNIT))
.expect_err("should error") .expect_err("should error")
.err_type(), .err_type(),
ParseErrorType::BadInput(LexError::ImproperSymbol( ParseErrorType::BadInput(LexError::ImproperSymbol(
@ -204,9 +204,9 @@ fn test_custom_syntax() -> Result<(), Box<EvalAltResult>> {
// Check self-termination // Check self-termination
engine engine
.register_custom_syntax(&["test1", "$block$"], true, |_, _| Ok(Dynamic::UNIT))? .register_custom_syntax(["test1", "$block$"], true, |_, _| Ok(Dynamic::UNIT))?
.register_custom_syntax(&["test2", "}"], true, |_, _| Ok(Dynamic::UNIT))? .register_custom_syntax(["test2", "}"], true, |_, _| Ok(Dynamic::UNIT))?
.register_custom_syntax(&["test3", ";"], true, |_, _| Ok(Dynamic::UNIT))?; .register_custom_syntax(["test3", ";"], true, |_, _| Ok(Dynamic::UNIT))?;
assert_eq!(engine.eval::<INT>("test1 { x = y + z; } 42")?, 42); assert_eq!(engine.eval::<INT>("test1 { x = y + z; } 42")?, 42);
assert_eq!(engine.eval::<INT>("test2 } 42")?, 42); assert_eq!(engine.eval::<INT>("test2 } 42")?, 42);
@ -214,7 +214,7 @@ fn test_custom_syntax() -> Result<(), Box<EvalAltResult>> {
// Register the custom syntax: var x = ??? // Register the custom syntax: var x = ???
engine.register_custom_syntax( engine.register_custom_syntax(
&["var", "$ident$", "=", "$expr$"], ["var", "$ident$", "=", "$expr$"],
true, true,
|context, inputs| { |context, inputs| {
let var_name = inputs[0].get_string_value().unwrap(); let var_name = inputs[0].get_string_value().unwrap();

View File

@ -12,7 +12,7 @@ fn test_debugging() -> Result<(), Box<EvalAltResult>> {
let mut engine = Engine::new(); let mut engine = Engine::new();
engine.register_debugger( engine.register_debugger(
|| Dynamic::UNIT, |_| Dynamic::UNIT,
|_, _, _, _, _| Ok(rhai::debugger::DebuggerCommand::Continue), |_, _, _, _, _| Ok(rhai::debugger::DebuggerCommand::Continue),
); );
@ -47,7 +47,7 @@ fn test_debugger_state() -> Result<(), Box<EvalAltResult>> {
let mut engine = Engine::new(); let mut engine = Engine::new();
engine.register_debugger( engine.register_debugger(
|| { |_| {
// Say, use an object map for the debugger state // Say, use an object map for the debugger state
let mut state = Map::new(); let mut state = Map::new();
// Initialize properties // Initialize properties