From 41b41ff834e114778689207aac9224a014eca91c Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Thu, 6 Aug 2020 00:24:25 +0800 Subject: [PATCH] Fix tests. --- tests/side_effects.rs | 8 ++++---- tests/stack.rs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/side_effects.rs b/tests/side_effects.rs index bee1cb2f..69e33de1 100644 --- a/tests/side_effects.rs +++ b/tests/side_effects.rs @@ -5,16 +5,16 @@ use std::sync::{Arc, Mutex, RwLock}; /// Simulate a command object. struct Command { /// Simulate an external state. - state: i64, + state: INT, } impl Command { /// Do some action. - pub fn action(&mut self, val: i64) { + pub fn action(&mut self, val: INT) { self.state = val; } /// Get current value. - pub fn get(&self) -> i64 { + pub fn get(&self) -> INT { self.state } } @@ -39,7 +39,7 @@ fn test_side_effects_command() -> Result<(), Box> { // Register type. engine.register_type_with_name::("CommandType"); - engine.register_fn("action", |api: &mut API, x: i64| { + engine.register_fn("action", |api: &mut API, x: INT| { let mut command = api.lock().unwrap(); let val = command.get(); command.action(val + x); diff --git a/tests/stack.rs b/tests/stack.rs index 29828fef..47202b47 100644 --- a/tests/stack.rs +++ b/tests/stack.rs @@ -1,5 +1,5 @@ #![cfg(not(feature = "unchecked"))] -use rhai::{Engine, EvalAltResult, ParseError, ParseErrorType}; +use rhai::{Engine, EvalAltResult, ParseError, ParseErrorType, INT}; #[test] #[cfg(not(feature = "no_function"))] @@ -7,7 +7,7 @@ fn test_stack_overflow_fn_calls() -> Result<(), Box> { let engine = Engine::new(); assert_eq!( - engine.eval::( + engine.eval::( r" fn foo(n) { if n <= 1 { 0 } else { n + foo(n-1) } } foo(8)