Fix test.

This commit is contained in:
Stephen Chung 2020-03-30 16:18:33 +08:00
parent 0a8b324fec
commit ee18f047b4

View File

@ -1,4 +1,4 @@
use rhai::{Engine, EvalAltResult}; use rhai::{Engine, EvalAltResult, RegisterFn, INT};
#[test] #[test]
fn test_type_of() -> Result<(), EvalAltResult> { fn test_type_of() -> Result<(), EvalAltResult> {
@ -32,7 +32,7 @@ fn test_type_of() -> Result<(), EvalAltResult> {
#[cfg(not(feature = "no_object"))] #[cfg(not(feature = "no_object"))]
{ {
engine.register_type::<TestStruct>("Hello"); engine.register_type_with_name::<TestStruct>("Hello");
engine.register_fn("new_ts", || TestStruct { x: 1 }); engine.register_fn("new_ts", || TestStruct { x: 1 });
assert_eq!(engine.eval::<String>("type_of(new_ts())")?, "Hello"); assert_eq!(engine.eval::<String>("type_of(new_ts())")?, "Hello");