Fix tests.

This commit is contained in:
Stephen Chung 2020-08-06 00:24:25 +08:00
parent fff08d29b6
commit 41b41ff834
2 changed files with 6 additions and 6 deletions

View File

@ -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<EvalAltResult>> {
// Register type.
engine.register_type_with_name::<API>("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);

View File

@ -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<EvalAltResult>> {
let engine = Engine::new();
assert_eq!(
engine.eval::<i64>(
engine.eval::<INT>(
r"
fn foo(n) { if n <= 1 { 0 } else { n + foo(n-1) } }
foo(8)